tor-browser

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

currententrychange-dispose-ordering.html (979B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 test(t => {
      6  let start_index = navigation.currentEntry.index;
      7  let oncurrententrychange_called = false;
      8  let ondispose_called = false;
      9 
     10  let original_entry = navigation.currentEntry;
     11  original_entry.ondispose = t.step_func(() => {
     12    assert_true(oncurrententrychange_called);
     13    ondispose_called = true;
     14  });
     15 
     16  navigation.oncurrententrychange = t.step_func(e => {
     17    oncurrententrychange_called = true;
     18    assert_equals(e.from, original_entry);
     19    assert_equals(e.from.index, -1);
     20    assert_equals(e.navigationType, "replace");
     21    assert_equals(navigation.currentEntry.index, start_index);
     22  });
     23  navigation.navigate("#foo", { history: "replace" });
     24  assert_true(oncurrententrychange_called);
     25  assert_true(ondispose_called);
     26 }, "Ordering between Navigation currententrychange and NavigationHistoryEntry dispose events");
     27 </script>