tor-browser

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

navigation-navigate-replace-same-doc.html (1006B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 promise_test(async t => {
      6  let start_index = navigation.currentEntry.index;
      7 
      8  // Wait for after the load event so that the navigation doesn't get converted
      9  // into a replace navigation.
     10  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     11 
     12  let oncurrententrychange_called = false;
     13  let original_entry = navigation.currentEntry;
     14  navigation.oncurrententrychange = t.step_func(e => {
     15    oncurrententrychange_called = true;
     16    assert_equals(e.from, original_entry);
     17    assert_equals(e.from.index, -1);
     18    assert_equals(e.navigationType, "replace");
     19    assert_equals(navigation.currentEntry.index, start_index);
     20  });
     21  let result = navigation.navigate("#foo", { history: "replace" });
     22  assert_true(oncurrententrychange_called);
     23  await result.committed;
     24 }, "currententrychange fires for navigation.navigate() with replace");
     25 </script>