blob: f922da78cca21977cc71ddf096586c1671fc4082 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>This tests beforeunload event in subframes. You should see PASS below:</p>
<pre id="log"></pre>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpChildFramesAsText();
testRunner.waitUntilDone();
}
var log = document.getElementById('log');
var done = false;
function test() {
if (done) {
// 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';
if (window.testRunner)
testRunner.notifyDone();
return;
}
done = true;
document.getElementsByTagName('iframe')[0].contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
}
function fired() {
if (!log.innerHTML.length)
log.innerHTML = 'PASS\n';
else
log.innerHTML = 'FAIL: beforeunload event was dispatched after the second load event.'
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<iframe onload="test()" src="resources/before-unload-in-subframe-child.html"></iframe>
</body>
</html>