navigate-history-state-replace.html (577B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 promise_test(async () => { 6 history.replaceState("state1", "", "#1"); 7 assert_equals(history.state, "state1"); 8 9 let onnavigate_called = false; 10 navigation.onnavigate = () => onnavigate_called = true; 11 await navigation.navigate("#2", { history: "replace" }).committed; 12 assert_equals(location.hash, "#2"); 13 assert_true(onnavigate_called); 14 assert_equals(history.state, null); 15 }, "history.state should be nulled by navigate()"); 16 </script>