tor-browser

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

disambigaute-forward.html (2079B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <iframe id="i" src="/common/blank.html"></iframe>
      5 <script>
      6 async_test(t => {
      7  let start_length = navigation.entries().length;
      8  let start_index = navigation.currentEntry.index;
      9  // Wait for after the load event so that the navigation doesn't get converted
     10  // into a replace navigation.
     11  window.onload = () => t.step_timeout(() => {
     12    assert_equals(navigation.entries().length, start_length);
     13    assert_equals(i.contentWindow.navigation.entries().length, 1);
     14    navigation.navigate("#top");
     15    assert_equals(navigation.entries().length, start_length+1);
     16    assert_equals(i.contentWindow.navigation.entries().length, 1);
     17    i.contentWindow.navigation.navigate("#1");
     18    assert_equals(navigation.entries().length, start_length+1);
     19    assert_equals(i.contentWindow.navigation.entries().length, 2);
     20    assert_equals(navigation.currentEntry.index, start_index+1);
     21    assert_equals(i.contentWindow.navigation.currentEntry.index, 1);
     22    assert_true(navigation.canGoBack);
     23    assert_true(i.contentWindow.navigation.canGoBack);
     24 
     25    i.contentWindow.navigation.back().committed.then(t.step_func(() => {
     26      assert_equals(navigation.currentEntry.index, start_index+1);
     27      assert_equals(i.contentWindow.navigation.currentEntry.index, 0);
     28      navigation.back().committed.then(t.step_func(() => {
     29        assert_equals(navigation.currentEntry.index, start_index);
     30        assert_equals(i.contentWindow.navigation.currentEntry.index, 0);
     31        // There are 2 joint session history entries containing the top window's
     32        // final key. Navigate to the nearest one (which navigates only the
     33        // top window).
     34        navigation.forward().committed.then(t.step_func_done(() => {
     35          assert_equals(navigation.currentEntry.index, start_index+1);
     36          assert_equals(i.contentWindow.navigation.currentEntry.index, 0);
     37        }));
     38      }));
     39    }));
     40  }, 0);
     41 }, "navigation.forward() goes to the nearest forward entry");
     42 </script>