tor-browser

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

entries-across-origins.html (1326B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/common/get-host-info.sub.js"></script>
      5 <script src="resources/is_uuid.js"></script>
      6 <iframe id="i" src="/common/blank.html"></iframe>
      7 <script>
      8 async_test(t => {
      9  window.onload = t.step_func(() => {
     10    let start_key = i.contentWindow.navigation.currentEntry.key;
     11    let start_id = i.contentWindow.navigation.currentEntry.id;
     12 
     13    let cross_origin_url = new URL("resources/post-entries-length-to-top.html", location.href);
     14    cross_origin_url.hostname = get_host_info().REMOTE_HOST;
     15    i.contentWindow.location.assign(cross_origin_url.href);
     16 
     17    window.onmessage = t.step_func(e => {
     18      assert_equals(e.data, 1);
     19 
     20      i.src = "/common/blank.html?2";
     21      i.onload = t.step_func_done(() => {
     22        let entries = i.contentWindow.navigation.entries();
     23        assert_equals(entries.length, 1);
     24        assert_equals(new URL(entries[0].url).search, "?2");
     25        assert_not_equals(entries[0].key, start_key);
     26        assert_not_equals(entries[0].id, start_id);
     27        assert_true(isUUID(entries[0].key));
     28        assert_true(isUUID(entries[0].id));
     29      });
     30    });
     31  });
     32 }, "navigation.entries() should only contain entries that are both same-origin and contiguous");
     33 </script>