blob: 55bcfe59d870b08e55745698d7c283b0a2334060 [file] [log] [blame]
<html>
<body>
New window with beforeUnload handler.<br>
You should see "beforeUnload" in the console log if you try to close the window.<br>
<iframe src="resources/onbeforeunload-focused-iframe-frame.html" id="focusedFrame"></iframe>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpChildFramesAsText();
testRunner.waitUntilDone();
}
window.onbeforeunload = beforeUnload;
function beforeUnload()
{
console.log("beforeUnload");
window.onbeforeunload = null;
}
function simulateCloseWindow()
{
if (window.testRunner) {
// Simulate an attempt to close the window
if (!testRunner.callShouldCloseOnWebView())
alert("Should have run the beforeUnload handler.");
testRunner.notifyDone();
}
}
</script>
</body>
</html>