after-detach.html (1134B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i" src="/common/blank.html"></iframe> 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_navigation = i.contentWindow.navigation; 12 13 await i_navigation.navigate("#1").finished; 14 await i_navigation.navigate("#2").finished; 15 await i_navigation.back().finished; 16 17 assert_not_equals(i_navigation, null); 18 assert_not_equals(i_navigation.currentEntry, null); 19 assert_equals(i_navigation.entries().length, 3); 20 assert_true(i_navigation.canGoBack, "canGoBack"); 21 assert_true(i_navigation.canGoForward, "canGoForward"); 22 23 i.remove(); 24 25 assert_equals(i_navigation.currentEntry, null); 26 assert_equals(i_navigation.entries().length, 0); 27 assert_false(i_navigation.canGoBack); 28 assert_false(i_navigation.canGoForward); 29 }, "navigation.currentEntry/entries()/canGoBack/canGoForward after iframe removal"); 30 </script>