blob: da0078a806595d59986e433dc1fec9d05b3c91eb [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setCanOpenWindows();
testRunner.waitUntilDone();
}
var start;
var myInterval;
//This function should only be used with DRT and thus testRunner
function checkIfDone() {
var numOpenWindows = testRunner.windowCount();
var now = new Date();
if (numOpenWindows == 1) {
var span = document.createElement("span");
span.innerHTML = 'TEST PASSED <br>';
document.getElementById("console").appendChild(span);
clearInterval(myInterval);
testRunner.notifyDone();
} else if (now - start > 10000) {
var span = document.createElement("span");
span.innerHTML = 'TEST FAILED <br> Number of open windows: ' + numOpenWindows + '<br/>';
document.getElementById("console").appendChild(span);
clearInterval(myInterval);
testRunner.notifyDone();
}
}
function openNewWindow() {
var event = document.createEvent('MouseEvent');
event.initEvent( 'click', true, true );
document.getElementById('anchorLink').dispatchEvent(event);
if (window.testRunner) {
testRunner.setCloseRemainingWindowsWhenComplete();
start = new Date();
myInterval = setInterval(checkIfDone, 500);
}
}
</script>
</head>
<body onload="openNewWindow()">
This test checks that a window which has been opened by the DOM can also be closed
byt the DOM. The test will run automatically with popup blocking disabled.
To run the test manually click the link below.
<br/>
<div id="console" />
<br/>
<a href="resources/middle.html" id="anchorLink" target="_blank">Open new window that will close itself</a>
<br/><br/>
</body>
</html>