tor-browser

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

manual-scroll-repeated.html (1047B)


      1 <!doctype html>
      2 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <body>
      6 <div style="height: 200vh; width: 200vw;"></div>
      7 <div id="frag"></div>
      8 <script>
      9 promise_test(async t => {
     10  // Wait for after the load event so that the navigation doesn't get converted
     11  // into a replace navigation.
     12  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     13  assert_equals(window.scrollY, 0);
     14  await navigation.navigate("#frag").finished;
     15  assert_not_equals(window.scrollY, 0);
     16  navigation.onnavigate = e => {
     17    e.intercept({
     18      scroll: "manual",
     19      handler: t.step_func(() => {
     20        e.scroll();
     21        assert_equals(window.scrollY, 0);
     22        assert_throws_dom("InvalidStateError", () => e.scroll());
     23      })
     24    });
     25  };
     26  await navigation.back().finished;
     27  assert_equals(window.scrollY, 0);
     28 }, "scroll: scroll() should throw if called a second time");
     29 </script>
     30 </body>