tor-browser

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

history-back-same-doc.html (1115B)


      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_length = navigation.entries().length;
      7  let start_index = navigation.currentEntry.index;
      8 
      9  // Wait for after the load event so that the navigation doesn't get converted
     10  // into a replace navigation.
     11  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     12  await navigation.navigate("#foo").finished;
     13  assert_equals(navigation.entries().length, start_length + 1);
     14 
     15  let oncurrententrychange_called = false;
     16  navigation.oncurrententrychange = t.step_func(e => {
     17    oncurrententrychange_called = true;
     18    assert_equals(e.from, navigation.entries()[start_index + 1]);
     19    assert_equals(e.navigationType, "traverse");
     20    assert_equals(navigation.currentEntry.index, start_index);
     21  });
     22  history.back();
     23  assert_false(oncurrententrychange_called);
     24  await new Promise(resolve => window.onpopstate = resolve);
     25  assert_true(oncurrententrychange_called);
     26 }, "currententrychange fires for history.back()");
     27 </script>