history-traversal-navigate-parent-while-child-loading.html (1224B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i"></iframe> 5 <body> 6 <script> 7 async_test(t => { 8 let starting_history_length = history.length; 9 let iframe_url = (new URL("/common/blank.html", location.href)).href; 10 i.src = iframe_url; 11 12 history.pushState("a", "", "#a"); 13 assert_equals(history.length, starting_history_length + 1, "First history length"); 14 15 i.onload = t.step_func(() => { 16 assert_equals(history.length, starting_history_length + 1, "Second history length"); 17 assert_equals(i.contentWindow.location.href, iframe_url); 18 assert_equals(location.hash, "#a"); 19 history.back(); 20 // Wait a while for a back navigation. Since all of the possible outcomes 21 // are either same-document or navigating to about:blank, this doesn't need 22 // to wait terribly long. 23 t.step_timeout(t.step_func_done(() => { 24 assert_equals(location.hash, "", "top frame should have navigated back"); 25 assert_equals(i.contentWindow.location.href, iframe_url, "iframe should not have navigated"); 26 }), 100); 27 }); 28 }, "pushState() in parent while child is doing initial navigation, then go back"); 29 </script> 30 </body>