navigate-cross-origin-iframe-to-same-url-with-fragment.html (948B)
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 <body> 6 <script> 7 async_test(t => { 8 let starting_history_length = history.length; 9 let cross_origin_url = new URL(get_host_info().HTTPS_REMOTE_ORIGIN); 10 cross_origin_url.pathname = "/common/blank.html"; 11 cross_origin_url.hash = "#foo"; 12 let i = document.createElement("iframe"); 13 i.src = cross_origin_url; 14 document.body.appendChild(i); 15 16 window.onload = () => t.step_timeout(() => { 17 assert_equals(starting_history_length, history.length); 18 i.src = cross_origin_url; 19 // Give the navigation time to happen - no events will fire. 20 t.step_timeout(() => { 21 assert_equals(starting_history_length + 1, history.length); 22 t.done(); 23 }, 100); 24 }, 0); 25 }, "Navigating a cross-origin iframe to its current url should not replace"); 26 </script> 27 </body>