tor-browser

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

sameDocument-after-fragment-navigate.html (1231B)


      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 = navigation.entries().length;
      7  let start_index = navigation.currentEntry.index;
      8 
      9  // Wait for after the load event so that the navigation doesn't get converted
     10  // into a replace navigation.
     11  window.onload = () => t.step_timeout(t.step_func_done(() => {
     12    let entry1 = navigation.currentEntry;
     13    assert_true(entry1.sameDocument);
     14 
     15    location = "#hash";
     16    let entry2 = navigation.currentEntry;
     17    assert_not_equals(entry1, entry2);
     18    assert_true(entry1.sameDocument);
     19 
     20    history.pushState("push", "", "#push");
     21    let entry3 = navigation.currentEntry;
     22    assert_not_equals(entry1, entry3);
     23    assert_not_equals(entry2, entry3);
     24    assert_true(entry1.sameDocument);
     25    assert_true(entry2.sameDocument);
     26 
     27    assert_equals(navigation.entries().length, start_length + 2);
     28    assert_equals(navigation.entries()[start_index], entry1);
     29    assert_equals(navigation.entries()[start_index + 1], entry2);
     30    assert_equals(navigation.entries()[start_index + 2], entry3);
     31  }), 0);
     32 }, "entry.sameDocument after same-document navigations");
     33 </script>