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.layoutTestController) {
9 layoutTestController.dumpAsText();
10 layoutTestController.dumpChildFramesAsText();
11 layoutTestController.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.layoutTestController)
25 layoutTestController.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.layoutTestController)
36 layoutTestController.notifyDone();
40 <iframe onload="test()" src="resources/before-unload-in-subframe-child.html"></iframe>