tor-browser

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

scroll-after-preventDefault.html (936B)


      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 <script src="../navigation-methods/return-value/resources/helpers.js"></script>
      6 <body>
      7 <div style="height: 200vh; width: 200vw;"></div>
      8 <div id="frag"></div>
      9 <script>
     10 promise_test(async t => {
     11  // Wait for after the load event so that the navigation doesn't get converted
     12  // into a replace navigation.
     13  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     14 
     15  navigation.addEventListener("navigate", t.step_func(e => {
     16    e.intercept();
     17    e.preventDefault();
     18    assert_throws_dom("InvalidStateError", () => e.scroll());
     19  }), { once : true });
     20  await assertBothRejectDOM(t, navigation.navigate("#frag"), "AbortError");
     21 }, "scroll: scroll() should throw after preventDefault");
     22 </script>
     23 </body>