navigation-reload-intercept.html (886B)
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.currentEntry); 13 assert_equals(e.navigationType, "reload"); 14 assert_equals(i.contentWindow.navigation.currentEntry.index, 0); 15 }); 16 i.contentWindow.navigation.onnavigate = e => e.intercept(); 17 let result = i.contentWindow.navigation.reload(); 18 assert_true(oncurrententrychange_called); 19 await result.committed; 20 }, "currententrychange fires for navigation.reload() intercepted by intercept()"); 21 </script>