tor-browser

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

web-share.https.html (1292B)


      1 <!DOCTYPE html>
      2 <title>Test of Web Share</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="/resources/testdriver-actions.js"></script>
      8 <script src="/common/dispatcher/dispatcher.js"></script>
      9 <script src="resources/utils.js"></script>
     10 <script src="/common/utils.js"></script>
     11 
     12 <body>
     13 
     14 <script>
     15 promise_test(async t => {
     16  const fenced_frame = attachFencedFrameContext();
     17 
     18  // Make sure the fenced frame is alive, then click on it.
     19  await fenced_frame.execute(() => {});
     20  await multiClick(10, 10, fenced_frame.element);
     21 
     22  await fenced_frame.execute(async () => {
     23    try {
     24      await navigator.share({text: 'hello world'});
     25      assert_unreached("Web share should not succeed in a fenced frame.");
     26    } catch(e) {
     27      assert_equals(e.name, 'NotAllowedError');
     28      // The 'web-share' permission is not allowed to be enabled inside fenced
     29      // frames. If that changes, this check will need to be updated.
     30      assert_true(e.message.includes(
     31          "Failed to execute 'share' on 'Navigator': Permission denied"));
     32    }
     33  });
     34 }, 'Web Sharelock in a fenced frame must fail');
     35 </script>
     36 
     37 </body>