tor-browser

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

navigate-history-back-after-pushState.html (1261B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 async_test(t => {
      6  window.onload = () => t.step_timeout(() => {
      7    let start_history_length = history.length;
      8    let start_index = navigation.currentEntry.index;
      9    let target_key = navigation.currentEntry.key;
     10    let target_id = navigation.currentEntry.id;
     11    history.pushState(1, "", "pushState.html");
     12    assert_equals(history.length, start_history_length + 1);
     13 
     14    navigation.onnavigate = t.step_func_done(e => {
     15      assert_equals(e.navigationType, "traverse");
     16      assert_true(e.cancelable);
     17      assert_true(e.canIntercept);
     18      assert_false(e.userInitiated);
     19      assert_false(e.hashChange);
     20      assert_equals(e.downloadRequest, null);
     21      assert_equals(new URL(e.destination.url).hash, "");
     22      assert_true(e.destination.sameDocument);
     23      assert_equals(e.destination.key, target_key);
     24      assert_equals(e.destination.id, target_id);
     25      assert_equals(e.destination.index, start_index);
     26      assert_equals(e.formData, null);
     27      assert_equals(e.sourceElement, null);
     28    });
     29 
     30    history.back();
     31  }, 0);
     32 }, "history.back() fires the navigate event when reversing a pushState()");
     33 </script>