002-1.html (1366B)
1 <!DOCTYPE HTML> 2 <script> 3 var t = opener.t; 4 5 var do_test = t.step_func(function() { 6 localStorage.test6564729 += '1'; 7 var d = document; 8 // This document's unload not triggered here because `document.open` erases 9 // all of the document's handlers. However the iframe's event handlers (002b) 10 // will fire. The `beforeunload` event handler will not fire because this is 11 // not a navigation resulting from a user interaction. 12 var e = document.open(); 13 localStorage.test6564729 += (e == d) ? '8' : 'X'; 14 var s = 'FAIL if you see this | ' + localStorage.test6564729; 15 document.write(s); 16 localStorage.test6564729 += document.body.textContent == s ? '9' : 'x'; 17 document.close(); 18 localStorage.test6564729 += 'Z'; 19 document.body.textContent += ' // ' + localStorage.test6564729; 20 location = '002a.html'; // unload triggers again here, but they're not registered event listeners any more 21 }); 22 23 onload = t.step_func(function() { 24 localStorage.test6564729 = '0'; 25 setTimeout(function() {document.getElementsByTagName("input")[0].click()}, 100); 26 }); 27 </script> 28 <body onbeforeunload="localStorage.test6564729 += '2'" 29 onpagehide="localStorage.test6564729 += '4'" 30 onunload="localStorage.test6564729 += '5'"> 31 <input type=button value="Activate this button to run the test" onclick="do_test()"> 32 <p><iframe src="002b.html"></iframe>