blob: cdbf9b70cdfe406f6531bb535c67da355eb6f7d4 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>This test ensures navigation is forbidden while beforeunload event is being fired. You should see PASS 1/2 and PASS 2/2 below:</p>
<pre id="log">FAIL</pre>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpChildFramesAsText();
testRunner.waitUntilDone();
}
var log = document.getElementById('log');
function test(iframe) {
if (iframe.done) {
if (iframe.halfPassed) {
iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-destination.html';
iframe.halfPassed = false;
}
return;
}
iframe.done = true;
iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
}
function fired(contentWindow) {
location.href = 'resources/before-unload-in-subframe-fail.html';
contentWindow.location.href = 'resources/before-unload-in-subframe-fail.html';
log.innerHTML = 'PASS 1/2';
contentWindow.frameElement.halfPassed = true;
}
</script>
<iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html"></iframe>
</body>
</html>