back-same-document.html (1353B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <meta name="variant" content="?no-currententrychange"> 5 <meta name="variant" content="?currententrychange"> 6 7 <script type="module"> 8 import { Recorder, hasVariant } from "./resources/helpers.mjs"; 9 10 promise_test(async t => { 11 // Wait for after the load event so that the navigation doesn't get converted 12 // into a replace navigation. 13 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 14 await navigation.navigate("#1").finished; 15 16 const recorder = new Recorder({ 17 skipCurrentChange: !hasVariant("currententrychange"), 18 finalExpectedEvent: "finished fulfilled" 19 }); 20 21 recorder.setUpNavigationAPIListeners(); 22 23 const result = navigation.back(); 24 recorder.setUpResultListeners(result); 25 26 Promise.resolve().then(() => recorder.record("promise microtask")); 27 28 await recorder.readyToAssert; 29 30 recorder.assert([ 31 /* event name, location.hash value, navigation.transition properties */ 32 ["promise microtask", "#1", null], 33 ["navigate", "#1", null], 34 ["currententrychange", "", null], 35 ["committed fulfilled", "", null], 36 ["navigatesuccess", "", null], 37 ["finished fulfilled", "", null], 38 ]); 39 }, "event and promise ordering for same-document navigation.back()"); 40 </script>