blob: fddecd73c7274086d8fe53e7d43e996ce316be72 [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" name="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>