window-open-self-during-load.html (1064B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="resources/helpers.js"></script> 6 7 <body> 8 <script> 9 "use strict"; 10 promise_test(async t => { 11 const sentinelIframe = await setupSentinelIframe(t); 12 const startingHistoryLength = history.length; 13 14 const code = ` 15 window.onload = () => { 16 window.open("/common/blank.html?thereplacement", "_self"); 17 }; 18 `; 19 20 const startURL = "resources/code-injector.html?pipe=sub(none)&code=" + encodeURIComponent(code); 21 const afterReplacementURL = "/common/blank.html?thereplacement"; 22 const iframe = insertIframe(t, startURL); 23 24 assert_equals(history.length, startingHistoryLength, "Inserting the under-test iframe must not change history.length"); 25 26 await waitForLoadAllowingIntermediateLoads(t, iframe, afterReplacementURL); 27 assert_equals(history.length, startingHistoryLength + 1, "history.length must increase"); 28 }, "No replace during load, triggered by window.open(_self) on an iframe"); 29 </script>