opaque-origin-page.html (933B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <!-- Put this page in a sandbox to give it an opaque origin --> 4 5 <script> 6 promise_test(async t => { 7 // Wait for after the load event so that the navigation doesn't get converted 8 // into a replace navigation. 9 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 10 11 location.hash = "#1"; 12 await new Promise(resolve => window.onhashchange = resolve); 13 location.hash = "#2"; 14 await new Promise(resolve => window.onhashchange = resolve); 15 history.back(); 16 await new Promise(resolve => window.onhashchange = resolve); 17 18 assert_equals(location.hash, "#1"); 19 20 assert_equals(navigation.currentEntry, null); 21 assert_equals(navigation.entries().length, 0); 22 assert_false(navigation.canGoBack); 23 assert_false(navigation.canGoForward); 24 }, "navigation.currentEntry/entries()/canGoBack/canGoForward in an opaque origin iframe"); 25 </script>