forward-to-pruned-entry.html (930B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 promise_test(async t => { 6 // Wait for after the load event so that the navigation doesn't get converted 7 // into a replace navigation. 8 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 9 location.hash = "#1"; 10 location.hash = "#2"; 11 history.go(-2); 12 await new Promise(r => window.onpopstate = r); 13 14 // Traverse forward then immediately do a same-document push. This will 15 // truncate the back forward list. 16 history.forward(); 17 location.hash = "#clobber"; 18 19 // history.forward() should be aborted. 20 window.onpopstate = t.unreached_func("history.forward() should have been cancelled"); 21 await new Promise(r => t.step_timeout(r, 20)); 22 assert_equals(location.hash, "#clobber"); 23 }, "If forward pruning clobbers the target of a traverse, abort"); 24 </script>