activation-replace-cross-origin.html (1217B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/common/get-host-info.sub.js"></script> 5 <script> 6 promise_test(async t => { 7 // Wait for after the load event so that the navigation doesn't get converted 8 // into a replace navigation. 9 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 10 11 let i = document.createElement("iframe"); 12 i.src = get_host_info().HTTP_ORIGIN_WITH_DIFFERENT_PORT + "/common/blank.html"; 13 document.body.appendChild(i); 14 await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0)); 15 16 i.contentWindow.location.replace("/common/blank.html"); 17 await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0)); 18 let current_entry_after_nav = i.contentWindow.navigation.currentEntry; 19 20 assert_equals(i.contentWindow.navigation.entries().length, 1); 21 assert_equals(i.contentWindow.navigation.activation.entry, current_entry_after_nav); 22 assert_equals(i.contentWindow.navigation.activation.from, null); 23 assert_equals(i.contentWindow.navigation.activation.navigationType, "replace"); 24 }, "navigation.activation after replace cross-origin"); 25 </script>