4 <p>This tests beforeunload event in multiple subframes. You should see PASS below:</p>
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.waitUntilDone();
13 var log = document.getElementById('log');
15 function test(iframe) {
19 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
22 var numberOfBeforeUnloadInSubframes = 0;
23 var numberOfFrames = 3;
26 log.innerHTML = 'FAIL: ' + numberOfBeforeUnloadInSubframes + ' beforeunload events are fired but expected ' + numberOfFrames + ' events';
31 function fired(contentWindow) {
32 numberOfBeforeUnloadInSubframes++;
33 if (numberOfBeforeUnloadInSubframes == numberOfFrames) {
34 log.innerHTML = 'PASS';
35 if (window.testRunner)
36 testRunner.notifyDone();
40 contentWindow.frameElement.fired = true;
44 <iframe onload="test(this)" src="resources/before-unload-in-subframe-child.html"></iframe>
45 <iframe onload="test(this)" src="resources/before-unload-in-subframe-child.html"></iframe>
46 <iframe onload="test(this)" src="resources/before-unload-in-subframe-child.html"></iframe>