3 <script src="../js/resources/js-test-pre.js"></script>
6 <button id="test" onclick="clickHandler()">Click Here</button>
7 <div id="console"></div>
11 function clickHandler1()
13 stolenEvent = window.event;
14 win = window.open("about:blank", "blank");
15 shouldBeNonNull("win");
19 function clickHandler2()
21 window.event = stolenEvent;
22 win = window.open("about:blank", "blank");
23 shouldBeUndefined("win");
26 clickHandler = clickHandler1;
28 if (window.testRunner) {
29 testRunner.dumpAsText();
30 testRunner.setCanOpenWindows();
31 testRunner.setPopupBlockingEnabled(true);
32 testRunner.setCloseRemainingWindowsWhenComplete(true);
33 testRunner.waitUntilDone();
35 var button = document.getElementById("test");
37 if (window.eventSender) {
38 eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
43 clickHandler = clickHandler2;
44 window.event = stolenEvent;
47 testRunner.notifyDone();