tor-browser

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

navigation-updateCurrentEntry.html (834B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 test(t => {
      6  let oncurrententrychange_count = 0;
      7  navigation.oncurrententrychange = t.step_func(e => {
      8    oncurrententrychange_count++;
      9    assert_equals(e.from, navigation.currentEntry);
     10    assert_equals(e.navigationType, null);
     11    assert_equals(navigation.currentEntry.getState(), "newState");
     12  });
     13  navigation.updateCurrentEntry({ state: "newState" });
     14  assert_equals(oncurrententrychange_count, 1);
     15 
     16  // "Updating" the state to the current state should still fire currententrychange.
     17  navigation.updateCurrentEntry({ state: navigation.currentEntry.getState() });
     18  assert_equals(oncurrententrychange_count, 2);
     19 }, "currententrychange fires for navigation.updateCurrentEntry()");
     20 </script>