same-url-replace-cross-document.html (1026B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="resources/helpers.js"></script> 5 6 <script> 7 promise_test(async t => { 8 let start_length = navigation.entries().length; 9 let start_index = navigation.currentEntry.index; 10 11 // Wait for after the load event so that we are definitely testing the 12 // same URL as the cause of the rejections. 13 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 14 assert_equals(navigation.entries().length, start_length); 15 16 navigation.onnavigate = t.step_func(e => { 17 e.intercept(); 18 assert_equals(e.navigationType, "replace"); 19 }); 20 navigation.onnavigateerror = t.unreached_func("onnavigateerror should not be called"); 21 22 await navigation.navigate(location.href).finished; 23 assert_equals(navigation.entries().length, start_length); 24 assert_equals(navigation.currentEntry.index, start_index); 25 }, "navigate() to the current URL cross document should replace"); 26 </script>