tor-browser

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

activation-push.html (1521B)


      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  // Wait for after the load event so that the navigation doesn't get converted
      8  // into a replace navigation.
      9  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     10 
     11  i.contentWindow.navigation.navigate("/common/blank.html?a");
     12  await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0));
     13  let current_entry_after_nav = i.contentWindow.navigation.currentEntry;
     14 
     15  assert_equals(i.contentWindow.navigation.entries().length, 2);
     16  assert_equals(i.contentWindow.navigation.activation.entry, current_entry_after_nav);
     17  assert_equals(i.contentWindow.navigation.activation.from,
     18                i.contentWindow.navigation.entries()[0]);
     19  assert_equals(i.contentWindow.navigation.activation.navigationType, "push");
     20 
     21  // Same-document navigation doesn't change navigation.activation.
     22  await i.contentWindow.navigation.navigate("/common/blank.html?a#fragment").finished;
     23 
     24  assert_equals(i.contentWindow.navigation.entries().length, 3);
     25  assert_equals(i.contentWindow.navigation.activation.entry, current_entry_after_nav);
     26  assert_equals(i.contentWindow.navigation.activation.from,
     27                i.contentWindow.navigation.entries()[0]);
     28  assert_equals(i.contentWindow.navigation.activation.navigationType, "push");
     29 }, "navigation.activation after push");
     30 </script>