navigate-state-repeated.html (749B)
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 navigation.onnavigate = e => e.intercept(); 7 8 let result1 = navigation.navigate('/foo', {state: {foo: 1}}); 9 assert_equals(navigation.currentEntry.getState().foo, 1); 10 11 // Don't let the harness fail because of the "AbortError" DOMException that is caused by interrupting the navigation. 12 result1.finished.catch(() => {}); 13 14 let result2 = navigation.navigate('/foo', {state: {foo: 2}}); 15 assert_equals(navigation.currentEntry.getState().foo, 2); 16 17 await result1.committed; 18 await result2.committed; 19 }, "navigate() with state should work correctly when called repeatedly"); 20 </script>