tor-browser

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

index-not-in-entries.html (990B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <iframe id="i" src="/common/blank.html"></iframe>
      5 <script>
      6 async_test(t => {
      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    // Remove the entry by replacing it.
     13    let replaced_entry = navigation.currentEntry;
     14    assert_equals(replaced_entry.index, start_index);
     15    navigation.navigate("#0", { history: "replace" });
     16    assert_equals(replaced_entry.index, -1);
     17 
     18    // Remove the entry by detaching its window.
     19    let iframe_entry = i.contentWindow.navigation.currentEntry;
     20    assert_equals(iframe_entry.index, 0);
     21    i.remove();
     22    assert_equals(iframe_entry.index, -1);
     23    t.done();
     24  }), 0);
     25 }, "entry.index should return -1 when not in navigation.entries()");
     26 </script>