navigate-destination-getState-reload.html (1071B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 async_test(t => { 6 // Wait for after the load event so that the navigation doesn't get converted 7 // into a replace navigation. 8 window.onload = () => t.step_timeout(() => { 9 let navState = { statevar: "state" }; 10 navigation.onnavigate = t.step_func_done(e => { 11 assert_equals(e.navigationType, "reload"); 12 assert_not_equals(e.destination, null); 13 assert_not_equals(e.destination.getState(), undefined); 14 assert_equals(e.destination.getState().statevar, "state"); 15 assert_not_equals(e.destination.getState(), e.destination.getState()); 16 assert_equals(e.destination.key, ""); 17 assert_equals(e.destination.id, ""); 18 assert_equals(e.destination.index, -1); 19 assert_equals(e.sourceElement, null); 20 e.intercept(); 21 }); 22 navigation.updateCurrentEntry({ state: navState }); 23 location.reload(); 24 }, 0); 25 }, "navigate event destination.getState() on location.reload()"); 26 </script>