e2f32eee59db2dcbc70fbe4bafa016594b55f975
[WebKit-https.git] / LayoutTests / fast / events / popup-blocking-timers4.html
1 <!DOCTYPE html>
2 <head>
3     <script src="../js/resources/js-test-pre.js"></script>
4     <script>
5         var newWindow;
6         
7         if (window.testRunner) {
8             testRunner.dumpAsText();
9             testRunner.setCanOpenWindows();
10             testRunner.waitUntilDone();
11             testRunner.setPopupBlockingEnabled(true);
12         }
13     
14         function clickHandler() {
15             setTimeout(function() {
16                 setTimeout(function() {
17                     newWindow = window.open("about:blank");
18                     self.focus();
19                     debug("Test calling window.open() in a nested call to setTimeout(). A popup should not be allowed.")
20                     shouldBeUndefined("newWindow");
21                     if (window.testRunner)
22                         testRunner.notifyDone();
23                 }, 0);
24             }, 300);
25         }
26         
27         function clickButton() {
28             var button = document.getElementById("test");
29             var buttonX = button.offsetLeft + button.offsetWidth / 2;
30             var buttonY = button.offsetTop + button.offsetHeight / 2;
31             if (window.eventSender) {
32                 eventSender.mouseMoveTo(buttonX, buttonY);
33                 eventSender.mouseDown();
34                 eventSender.mouseUp();
35             }
36         }        
37     </script>
38 </head>
39 <body onload="clickButton()">
40     <button id="test" onclick="clickHandler()">Click Here</button>
41     <div id="console"></div>
42 </body>