tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

popstate.tentative.html (1273B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>Detect simple soft navigation.</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>
     15  </main>
     16  <script>
     17    // Push state twice, so that history.back() will trigger a popstate event,
     18    // when the first push state is restored.
     19    history.pushState({}, "", "foobar.html");
     20    history.pushState({}, "", "another_one.html");
     21 
     22    testSoftNavigation({
     23      testName: "A soft navigation that uses a same-document initiated popstate"
     24        + " event is recognized by SoftNavigationHeuristics",
     25      // Test already have a default clock which will call back(), we want
     26      // "the event" that triggers navigation to be the popstate event.
     27      eventListenerCb: () => history.back(),
     28      registerRouteChange: (cb) => addEventListener('popstate', cb),
     29      pushState: () => { },
     30      // Although we will own the pushState, we need to set the expected URL
     31      pushUrl: "foobar.html",
     32    });
     33  </script>
     34 </body>
     35 </html>