navigation-api-back.tentative.html (1176B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Detect navigation.back()</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="resources/soft-navigation-helper.js"></script> 11 </head> 12 <body> 13 <a id=link>Click me!</a> 14 <main id=main></main> 15 <script> 16 window.onload = async () => { 17 // Wait for after the load event so that the navigation doesn't get converted 18 // into a replace navigation. 19 await new Promise(r => step_timeout(r, 0)); 20 21 navigation.onnavigate = e => { 22 e.intercept(); 23 }; 24 // Push a couple of navigation entries, so that we'd have a navigation entry to go back to. 25 await navigation.navigate("foobar.html").finished; 26 await navigation.navigate("another.html").committed; 27 28 testSoftNavigation({ 29 testName: "`navigation.back()` properly works with SoftNavigationHeuristics", 30 pushState: async () =>{ 31 await navigation.back().committed; 32 }, 33 }); 34 }; 35 </script> 36 </body> 37 </html>