49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<p>This tests beforeunload event in multiple subframes. You should see PASS below:</p>
|
|
<pre id="log"></pre>
|
|
<script>
|
|
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
var log = document.getElementById('log');
|
|
|
|
function test(iframe) {
|
|
if (iframe.done)
|
|
return;
|
|
iframe.done = true;
|
|
iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
|
|
}
|
|
|
|
var numberOfBeforeUnloadInSubframes = 0;
|
|
var numberOfFrames = 3;
|
|
|
|
function logError() {
|
|
log.innerHTML = 'FAIL: ' + numberOfBeforeUnloadInSubframes + ' beforeunload events are fired but expected ' + numberOfFrames + ' events';
|
|
}
|
|
|
|
logError();
|
|
|
|
function fired(contentWindow) {
|
|
numberOfBeforeUnloadInSubframes++;
|
|
if (numberOfBeforeUnloadInSubframes == numberOfFrames) {
|
|
log.innerHTML = 'PASS';
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
}
|
|
else
|
|
logError();
|
|
contentWindow.frameElement.fired = true;
|
|
}
|
|
|
|
</script>
|
|
<iframe onload="test(this)" src="resources/before-unload-in-subframe-child.html"></iframe>
|
|
<iframe onload="test(this)" src="resources/before-unload-in-subframe-child.html"></iframe>
|
|
<iframe onload="test(this)" src="resources/before-unload-in-subframe-child.html"></iframe>
|
|
</body>
|
|
</html>
|