back-cross-document-event-order.html (1691B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i" src="resources/notify-top-early.html"></iframe> 5 <script> 6 async_test(t => { 7 let events = []; 8 function finish() { 9 assert_array_equals(events, ["onnavigate", "onunload", "readystateinteractive", "domcontentloaded", "readystatecomplete", "onload", "onpageshow"]); 10 t.done(); 11 }; 12 13 window.onload = t.step_func(() => { 14 i.contentWindow.navigation.navigate("?1"); 15 i.onload = t.step_func(() => { 16 window.childStarted = () => { 17 i.contentWindow.navigation.onnavigatesuccess = () => events.push("onnavigatesuccess"); 18 i.contentWindow.navigation.onnavigateerror = () => events.push("onnavigateerror"); 19 i.contentWindow.onpageshow = () => events.push("onpageshow"); 20 i.contentWindow.onhashchange = () => events.push("onhashchange"); 21 i.contentWindow.onpopstate = () => events.push("onpopstate"); 22 i.onload = t.step_func(() => { 23 events.push("onload"); 24 t.step_timeout(finish, 0); 25 }); 26 i.contentDocument.addEventListener("DOMContentLoaded", () => events.push("domcontentloaded")); 27 i.contentDocument.onreadystatechange = () => events.push("readystate" + i.contentDocument.readyState); 28 }; 29 i.contentWindow.onunload = () => events.push("onunload"); 30 i.contentWindow.navigation.onnavigate = () => events.push("onnavigate"); 31 i.contentWindow.navigation.back().committed.then( 32 () => events.push("promisefulfilled"), () => events.push("promiserejected")); 33 }) 34 }); 35 }, "back() event ordering for cross-document traversal"); 36 </script>