tor-browser

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

navigate-replace-cross-document.html (1344B)


      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  // Wait for after the load event so that the navigation doesn't get converted
      8  // into a replace navigation (which would defeat the point of the test).
      9  window.onload = () => t.step_timeout(() => {
     10    let start_length = navigation.entries().length;
     11    let start_history_length = history.length;
     12    let start_entry_top = navigation.currentEntry;
     13    let start_entry_iframe_id = i.contentWindow.navigation.currentEntry.id;
     14    let start_entry_iframe_key = i.contentWindow.navigation.currentEntry.key;
     15 
     16    i.contentWindow.navigation.navigate("?1", { history: "replace" });
     17    i.onload = t.step_func_done(() => {
     18      assert_equals(history.length, start_history_length);
     19 
     20      assert_equals(navigation.entries().length, start_length);
     21      assert_equals(navigation.currentEntry, start_entry_top);
     22 
     23      assert_equals(i.contentWindow.navigation.entries().length, 1);
     24      let iframe_entry = i.contentWindow.navigation.currentEntry;
     25      assert_not_equals(start_entry_iframe_id, iframe_entry.id);
     26      assert_equals(start_entry_iframe_key, iframe_entry.key);
     27    });
     28  }, 0);
     29 }, "navigate() with history: 'replace' option");
     30 </script>