| <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> |
| testRunner.dumpChildFramesAsText(); |
| testRunner.waitUntilDone(); |
| var log = document.getElementById('log'); |
| // log's not having any content implies that load event was dispatched for the second time before beforeunload is dispatched. |
| if (!log.innerHTML.length) |
| log.innerHTML = 'FAIL: beforeunload event was never dispatched.\n'; |
| log.innerHTML = 'FAIL: beforeunload event handler did not remove the frame.\n'; |
| document.getElementsByTagName('iframe')[0].contentWindow.location.href = 'resources/before-unload-in-subframe-child.html'; |
| document.body.removeChild(document.body.getElementsByTagName('iframe')[0]); |
| log.innerHTML = 'PASS\n'; |
| <iframe onload="test()" src="resources/before-unload-in-subframe-child.html"></iframe> |