Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / window-focus-self.html
blobe1fb6dbe3e230b203f9cb077ec6fb90a5b1183d0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 function runTest() {
6 window.onfocus = windowFocused;
7 window.onblur = windowBlurred;
9 if (window.testRunner) {
10 testRunner.waitUntilDone();
11 testRunner.dumpAsText();
12 testRunner.setWindowIsKey(false);
13 window.open('javascript:window.focus()', '_self', '');
14 setTimeout(function() { testRunner.notifyDone(); }, 0);
18 function log(message) {
19 var console = document.getElementById("console");
20 var li = document.createElement("li");
21 var text = document.createTextNode(message);
23 console.appendChild(li);
24 li.appendChild(text);
27 function windowFocused() {
28 log("FAIL: Window was focused");
31 function windowBlurred() {
32 log("Window was blurred");
34 </script>
35 </head>
36 <body>
37 This tests that a window cannot focus itself by using javascript: urls.
38 <ul id="console"></ul>
39 <script>runTest();</script>
40 </body>
41 </html>