navigation-navigate-intercept.html (910B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i" src="/common/blank.html"></iframe> 5 <script> 6 promise_test(async t => { 7 await new Promise(resolve => window.onload = resolve); 8 9 let oncurrententrychange_called = false; 10 i.contentWindow.navigation.oncurrententrychange = t.step_func(e => { 11 oncurrententrychange_called = true; 12 assert_equals(e.from, i.contentWindow.navigation.entries()[0]); 13 assert_equals(e.navigationType, "push"); 14 assert_equals(i.contentWindow.navigation.currentEntry.index, 1); 15 }); 16 i.contentWindow.navigation.onnavigate = e => e.intercept(); 17 let result = i.contentWindow.navigation.navigate("/common/blank.html?1"); 18 assert_true(oncurrententrychange_called); 19 await result.committed; 20 }, "currententrychange fires for navigation.navigate() intercepted by intercept()"); 21 </script>