blob: 2e0af39aca7bba1d0eec6068ae5f81335e428477 [file] [log] [blame]
<html>
<body>
New window with beforeUnload handler.<br>
You should see an alert with "beforeUnload" 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()
{
alert("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>