Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: LayoutTests/fast/dom/Window/window-focus-self.html

Issue 14735005: Disallow a window focusing itself via javascript URLs or using target _self (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/window-focus-self-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Window/window-focus-self.html
diff --git a/LayoutTests/fast/dom/Window/window-focus-self.html b/LayoutTests/fast/dom/Window/window-focus-self.html
new file mode 100644
index 0000000000000000000000000000000000000000..e1fb6dbe3e230b203f9cb077ec6fb90a5b1183d0
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/window-focus-self.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function runTest() {
+ window.onfocus = windowFocused;
+ window.onblur = windowBlurred;
+
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ testRunner.setWindowIsKey(false);
+ window.open('javascript:window.focus()', '_self', '');
+ setTimeout(function() { testRunner.notifyDone(); }, 0);
+ }
+}
+
+function log(message) {
+ var console = document.getElementById("console");
+ var li = document.createElement("li");
+ var text = document.createTextNode(message);
+
+ console.appendChild(li);
+ li.appendChild(text);
+}
+
+function windowFocused() {
+ log("FAIL: Window was focused");
+}
+
+function windowBlurred() {
+ log("Window was blurred");
+}
+</script>
+</head>
+<body>
+ This tests that a window cannot focus itself by using javascript: urls.
+ <ul id="console"></ul>
+ <script>runTest();</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/window-focus-self-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698