tor-browser

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

navigate-history-push-same-url.html (1161B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="resources/helpers.js"></script>
      5 
      6 <script>
      7 promise_test(async t => {
      8  let start_length = navigation.entries().length;
      9  let start_index = navigation.currentEntry.index;
     10  // Wait for after the load event so that the navigation doesn't get converted
     11  // into a replace navigation due to onload not having completed.
     12  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     13  assert_equals(navigation.entries().length, start_length);
     14 
     15 
     16  let navigateEventType;
     17  navigation.onnavigate = e => {
     18    navigateEventType = e.navigationType;
     19    e.intercept();
     20  }
     21  navigation.onnavigateerror = t.unreached_func("onnavigateerror should not be called");
     22 
     23  await navigation.navigate(location.href, { history: "push" }).finished;
     24  assert_equals(navigateEventType, "push");
     25  assert_equals(navigation.entries().length, start_length+1);
     26  assert_equals(navigation.currentEntry.index, start_index+1);
     27 }, "navigate() to the current URL with history: 'push' and intercept so it remains same-document");
     28 </script>