tor-browser

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

share-consume-activation.https.html (1149B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta charset="utf-8" />
      5    <title>WebShare Test: consume user activation</title>
      6    <link rel="help" href="https://w3c.github.io/web-share/#share-method">
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <script src="/resources/testdriver.js"></script>
     10    <script src="/resources/testdriver-vendor.js"></script>
     11  </head>
     12  <body>
     13    <script>
     14      promise_test(async t => {
     15        // Not activated by user gesture, so not allowed!
     16        await promise_rejects_dom(t, "NotAllowedError", navigator.share());
     17 
     18        await test_driver.bless("web share");
     19 
     20        // We have a gesture, but the URL is invalid - so TypeError!
     21        await promise_rejects_js(
     22          t,
     23          TypeError,
     24          navigator.share({ url: "http://example.com:65536" })
     25        );
     26 
     27        // The activation has been consumed, so calling share() again would require
     28        // a new gesture.
     29        await promise_rejects_dom(t, "NotAllowedError", navigator.share());
     30      }, "Calling share consumes user activation");
     31    </script>
     32  </body>
     33 </html>