4 <p>This test ensures a beforeunload event handler can safely remove the frame to which the event is fired. You should see PASS below:
</p>
8 if (window
.testRunner
) {
9 testRunner
.dumpAsText();
10 testRunner
.dumpChildFramesAsText();
11 testRunner
.waitUntilDone();
14 var log
= document
.getElementById('log');
19 // log's not having any content implies that load event was dispatched for the second time before beforeunload is dispatched.
20 if (!log
.innerHTML
.length
)
21 log
.innerHTML
= 'FAIL: beforeunload event was never dispatched.\n';
23 log
.innerHTML
= 'FAIL: beforeunload event handler did not remove the frame.\n';
24 if (window
.testRunner
)
25 testRunner
.notifyDone();
29 document
.getElementsByTagName('iframe')[0].contentWindow
.location
.href
= 'resources/before-unload-in-subframe-child.html';
33 document
.body
.removeChild(document
.body
.getElementsByTagName('iframe')[0]);
34 log
.innerHTML
= 'PASS\n';
35 if (window
.testRunner
)
36 testRunner
.notifyDone();
40 <iframe onload=
"test()" src=
"resources/before-unload-in-subframe-child.html"></iframe>