intercept-history-replaceState.html (796B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 async_test(t => { 6 let start_length = history.length; 7 navigation.onnavigate = t.step_func(e => { 8 e.intercept({ handler: async () => { 9 await new Promise(r => t.step_timeout(r, 0)); 10 t.step_timeout(t.step_func_done(() => { 11 assert_equals(location.hash, "#1"); 12 assert_equals(history.state, "update"); 13 assert_equals(history.length, start_length); 14 }, 0)); 15 }}); 16 }); 17 18 history.replaceState("update", "", "#1"); 19 assert_equals(location.hash, "#1"); 20 assert_equals(history.state, "update"); 21 assert_equals(history.length, start_length); 22 }, "event.intercept() should proceed if the given promise resolves"); 23 </script>