tor-browser

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

navigate-destination-getState-back-forward.html (1160B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 async_test(t => {
      6  // Wait for after the load event so that the navigation doesn't get converted
      7  // into a replace navigation.
      8  window.onload = () => t.step_timeout(t.step_func_done(() => {
      9    let navState = { statevar: "state" };
     10    navigation.navigate("#foo", { history: "replace", state: navState });
     11    let target_key = navigation.currentEntry.key;
     12    let target_id = navigation.currentEntry.id;
     13    navigation.navigate("#bar");
     14    navigation.onnavigate = t.step_func_done(e => {
     15      assert_equals(e.navigationType, "traverse");
     16      assert_not_equals(e.destination, null);
     17      assert_not_equals(e.destination.getState(), undefined);
     18      assert_not_equals(e.destination.getState(), e.destination.getState());
     19      assert_equals(e.destination.key, "");
     20      assert_equals(e.destination.id, "");
     21      assert_equals(e.destination.index, -1);
     22      assert_equals(e.sourceElement, null);
     23    });
     24    navigation.back();
     25  }), 0);
     26 }, "navigate event destination.getState() on back/forward navigation");
     27 </script>