3 <script src="../js/resources/js-test-pre.js"></script>
7 var firstIntervalExecution = true;
9 if (window.testRunner) {
10 testRunner.dumpAsText();
11 testRunner.setCanOpenWindows();
12 testRunner.waitUntilDone();
13 testRunner.setPopupBlockingEnabled(true);
16 function clickHandler() {
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.");
19 newWindow = window.open("about:blank");
21 if (firstIntervalExecution) {
22 shouldBeNonNull("newWindow");
23 firstIntervalExecution = false;
25 shouldBeUndefined("newWindow");
26 clearInterval(intervalId);
27 if (window.testRunner)
28 testRunner.notifyDone();
33 function clickButton() {
34 var button = document.getElementById("test");
35 var buttonX = button.offsetLeft + button.offsetWidth / 2;
36 var buttonY = button.offsetTop + button.offsetHeight / 2;
37 if (window.eventSender) {
38 eventSender.mouseMoveTo(buttonX, buttonY);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
45 <body onload="clickButton()">
46 <button id="test" onclick="clickHandler()">Click Here</button>
47 <div id="console"></div>