tor-browser

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

navigate-history-pushState.html (1077B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 async_test(t => {
      6  let start_length = history.length;
      7  navigation.onnavigate = t.step_func(e => {
      8    assert_equals(e.navigationType, "push");
      9    assert_true(e.cancelable);
     10    assert_true(e.canIntercept);
     11    assert_false(e.userInitiated);
     12    assert_false(e.hashChange);
     13    assert_equals(e.downloadRequest, null);
     14    assert_equals(new URL(e.destination.url).hash, "#1");
     15    assert_true(e.destination.sameDocument);
     16    assert_equals(e.destination.key, "");
     17    assert_equals(e.destination.id, "");
     18    assert_equals(e.destination.index, -1);
     19    assert_equals(e.formData, null);
     20    assert_equals(e.sourceElement, null);
     21    e.preventDefault();
     22    t.step_timeout(t.step_func_done(() => {
     23      assert_equals(location.hash, "");
     24      assert_equals(history.state, null);
     25      assert_equals(history.length, start_length);
     26    }), 0);
     27  });
     28  history.pushState(1, null, "#1");
     29 }, "history.pushState() fires the navigate event");
     30 </script>