tor-browser

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

key-id-location-reload-intercept.html (854B)


      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 promise_test(async t => {
      7  await new Promise(resolve => { window.onload = resolve; });
      8 
      9 
     10  const original = i.contentWindow.navigation.currentEntry;
     11  const { key, id } = original;
     12 
     13  i.contentWindow.navigation.addEventListener("navigate", e => e.intercept());
     14 
     15  i.onload = t.unreached_func("the iframe must not reload");
     16 
     17  await i.contentWindow.location.reload();
     18 
     19  assert_equals(i.contentWindow.navigation.currentEntry, original);
     20  assert_equals(i.contentWindow.navigation.currentEntry.key, key);
     21  assert_equals(i.contentWindow.navigation.currentEntry.id, id);
     22 }, "NavigationHistoryEntry's key and id after location.reload() intercepted by intercept()");
     23 </script>