| <!DOCTYPE html> |
| <html> |
| <head> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.setCanOpenWindows(true); |
| testRunner.overridePreference('WebKitSupportsMultipleWindows', false); |
| testRunner.waitUntilDone(); |
| } |
| |
| function click(elmt) |
| { |
| var event = document.createEvent('MouseEvent'); |
| event.initEvent('click', true, true); |
| elmt.dispatchEvent(event); |
| } |
| |
| function runTest() |
| { |
| if (window.testRunner) |
| var windowCount = testRunner.windowCount(); |
| var link = document.getElementById("link"); |
| click(link); |
| if (window.testRunner) { |
| if (windowCount != testRunner.windowCount()) |
| document.writeln('FAIL: Popup opened in a new window'); |
| else |
| document.writeln('PASS: Popup opened in the same window'); |
| testRunner.notifyDone(); |
| } |
| } |
| |
| window.addEventListener('load', runTest, true); |
| </script> |
| </head> |
| <body> |
| You need popups to be enabled to run this test. |
| <a id="link" target="_blank" href="data:text/html;charset=utf-8,<html><body>The test passes if this page opens in the same window</body></html>">Click me!</a> |
| </body> |
| </html> |