| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 var newWindow; | 5 var newWindow; |
| 6 var intervalId; | 6 var intervalId; |
| 7 var firstIntervalExecution = true; | 7 var firstIntervalExecution = true; |
| 8 | 8 |
| 9 if (window.testRunner) { | 9 if (window.testRunner) { |
| 10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| 11 testRunner.setCanOpenWindows(); | 11 testRunner.setCanOpenWindows(); |
| 12 testRunner.waitUntilDone(); | 12 testRunner.waitUntilDone(); |
| 13 testRunner.setPopupBlockingEnabled(true); | 13 testRunner.setPopupBlockingEnabled(true); |
| 14 } | 14 } |
| 15 | 15 |
| 16 function clickHandler() { | 16 function clickHandler() { |
| 17 intervalId = setInterval(function() { | 17 intervalId = setInterval(function() { |
| 18 debug("Test calling window.open() in a 100 ms interval. A popup
should only be allowed on the first execution of the interval."); | 18 debug("Test calling window.open() in a 100 ms interval. A popup
should only be allowed on the first execution of the interval."); |
| 19 newWindow = window.open("about:blank"); | 19 newWindow = window.open("about:blank"); |
| 20 self.focus(); | 20 self.focus(); |
| 21 if (firstIntervalExecution) { | 21 if (firstIntervalExecution) { |
| 22 shouldBeNonNull("newWindow"); | 22 shouldBeNonNull("newWindow"); |
| 23 firstIntervalExecution = false; | 23 firstIntervalExecution = false; |
| 24 } else { | 24 } else { |
| 25 shouldBeUndefined("newWindow"); | 25 shouldBeNull("newWindow"); |
| 26 clearInterval(intervalId); | 26 clearInterval(intervalId); |
| 27 if (window.testRunner) | 27 if (window.testRunner) |
| 28 testRunner.notifyDone(); | 28 testRunner.notifyDone(); |
| 29 } | 29 } |
| 30 }, 100); | 30 }, 100); |
| 31 } | 31 } |
| 32 | 32 |
| 33 function clickButton() { | 33 function clickButton() { |
| 34 var button = document.getElementById("test"); | 34 var button = document.getElementById("test"); |
| 35 var buttonX = button.offsetLeft + button.offsetWidth / 2; | 35 var buttonX = button.offsetLeft + button.offsetWidth / 2; |
| 36 var buttonY = button.offsetTop + button.offsetHeight / 2; | 36 var buttonY = button.offsetTop + button.offsetHeight / 2; |
| 37 if (window.eventSender) { | 37 if (window.eventSender) { |
| 38 eventSender.mouseMoveTo(buttonX, buttonY); | 38 eventSender.mouseMoveTo(buttonX, buttonY); |
| 39 eventSender.mouseDown(); | 39 eventSender.mouseDown(); |
| 40 eventSender.mouseUp(); | 40 eventSender.mouseUp(); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 </script> | 43 </script> |
| 44 </head> | 44 </head> |
| 45 <body onload="clickButton()"> | 45 <body onload="clickButton()"> |
| 46 <button id="test" onclick="clickHandler()">Click Here</button> | 46 <button id="test" onclick="clickHandler()">Click Here</button> |
| 47 <div id="console"></div> | 47 <div id="console"></div> |
| 48 </body> | 48 </body> |
| OLD | NEW |