tor-browser

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

navigate-navigation-back-same-document.html (1466B)


      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(() => {
      9    let target_key = navigation.currentEntry.key;
     10    let target_id = navigation.currentEntry.id;
     11    let target_index = navigation.currentEntry.index;
     12    navigation.navigate("#foo").committed.then(t.step_func(() => {
     13      navigation.onnavigate = t.step_func_done(e => {
     14        assert_equals(e.navigationType, "traverse");
     15        assert_true(e.cancelable);
     16        assert_true(e.canIntercept);
     17        assert_false(e.userInitiated);
     18        assert_true(e.hashChange);
     19        assert_equals(e.downloadRequest, null);
     20        assert_equals(new URL(e.destination.url).hash, "");
     21        assert_true(e.destination.sameDocument);
     22        assert_equals(e.destination.key, target_key);
     23        assert_equals(e.destination.id, target_id);
     24        assert_equals(e.destination.index, target_index);
     25        assert_equals(e.formData, null);
     26        assert_equals(e.info, "hi");
     27        assert_not_equals(e.hasUAVisualTransition, undefined);
     28        assert_equals(e.sourceElement, null);
     29      });
     30      assert_true(navigation.canGoBack);
     31      navigation.back({ info: "hi" });
     32    }));
     33  }, 0);
     34 }, "navigate event for navigation.back() - same-document");
     35 </script>