<!DOCTYPE HTML>
<script src="../../../../resources/js-test.js"></script>
<script>
description("Updating window.location after the window has been closed, without crashing.");
// This tests opens a new window, sets a timeout to close it, then
// sets a timeout to navigate it via window.location. We pass if we
// don't crash when setting the location of the already closed window,
// or when shutting down just after.
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setPopupBlockingEnabled(false);
testRunner.waitUntilDone();
}
var w = window.open('../../../../resources/window-postmessage-open-close.html');
window.addEventListener("message", processMessage, false);
function finish() {
// Clear out window and force a GC to finalize the Window
// object and its wrapper. Verifies that the shutdown is
// done in an orderly manner.
w = null;
gc();
if (window.testRunner)
testRunner.notifyDone();
}
function processMessage(event) {
if (event.data == "opened")
w.close();
else if (event.data == "closed") {
w.location = '';
setInterval(finish, 0);
}
}
</script>