location-assign.html (1155B)
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 startURL = "resources/code-injector.html?pipe=sub(none)&code=" + encodeURIComponent("location.assign(`/common/blank.html?thereplacement`);"); 15 const afterReplacementURL = "/common/blank.html?thereplacement"; 16 const iframe = insertIframe(t, startURL); 17 assert_equals(history.length, startingHistoryLength, "Inserting the under-test iframe must not change history.length"); 18 19 await waitForLoad(t, iframe, afterReplacementURL); 20 assert_equals(history.length, startingHistoryLength, "history.length must not change after waiting for the replacement"); 21 22 await checkSentinelIframe(t, sentinelIframe); 23 assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); 24 }, "Replace before load, triggered by location.assign()"); 25 </script>