4 <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>
5 <pre id="log">FAIL</pre>
8 if (window.layoutTestController) {
9 layoutTestController.dumpAsText();
10 layoutTestController.dumpChildFramesAsText();
11 layoutTestController.waitUntilDone();
14 var log = document.getElementById('log');
16 function test(iframe) {
18 if (iframe.halfPassed) {
19 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-destination.html';
20 iframe.halfPassed = false;
25 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
28 function fired(contentWindow) {
29 location.href = 'resources/before-unload-in-subframe-fail.html';
30 contentWindow.location.href = 'resources/before-unload-in-subframe-fail.html';
31 log.innerHTML = 'PASS 1/2';
32 contentWindow.frameElement.halfPassed = true;
36 <iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html"></iframe>