| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script> | |
| 5 if (window.testRunner) { | |
| 6 testRunner.dumpAsText(); | |
| 7 testRunner.setCanOpenWindows(true); | |
| 8 testRunner.overridePreference('WebKitSupportsMultipleWindows', false); | |
| 9 testRunner.waitUntilDone(); | |
| 10 } | |
| 11 | |
| 12 function click(elmt) | |
| 13 { | |
| 14 var event = document.createEvent('MouseEvent'); | |
| 15 event.initEvent('click', true, true); | |
| 16 elmt.dispatchEvent(event); | |
| 17 } | |
| 18 | |
| 19 function runTest() | |
| 20 { | |
| 21 if (window.testRunner) | |
| 22 testRunner.initialWindowCount = testRunner.windowCount(); | |
| 23 var button = document.getElementById("post-button"); | |
| 24 click(button); | |
| 25 if (window.testRunner) { | |
| 26 start = new Date(); | |
| 27 testInterval = setInterval(checkIfDone, 1); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 function checkIfDone () | |
| 32 { | |
| 33 if (testRunner.globalFlag) { | |
| 34 document.writeln('FAIL: Popup opened in a new window'); | |
| 35 clearInterval(testInterval); | |
| 36 testRunner.notifyDone(); | |
| 37 } else if ((new Date() - start) > 10000) { | |
| 38 document.writeln('FAIL: Popup did not open'); | |
| 39 clearInterval(testInterval); | |
| 40 testRunner.notifyDone(); | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 window.addEventListener('load', runTest, true); | |
| 45 </script> | |
| 46 </head> | |
| 47 <body> | |
| 48 You need popups to be enabled to run this test. | |
| 49 <form method="post" target="_blank" action="data:text/html;charset=utf-8,<html
><head><script>function test() { if (!window.testRunner) return; testRunner.glob
alFlag=1; if (testRunner.initialWindowCount != testRunner.windowCount()) return;
document.writeln('PASS: Popup opened in the same window'); testRunner.notifyDon
e(); }</script></head><body onload='test()'>The test passes if this page opens i
n the same window</body></html>"> | |
| 50 <input id="post-button" type="submit" value="Click me!" /> | |
| 51 </form> | |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |