tor-browser

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

clipboard-write-disabled-by-feature-policy.tentative.https.sub.html (1344B)


      1 <!doctype html>
      2 <body>
      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="/feature-policy/resources/featurepolicy.js"></script>
      8 <script src="../../resources/user-activation.js"></script>
      9 <script>
     10 'use strict';
     11 
     12 const same_origin_src =
     13  '/feature-policy/resources/feature-policy-clipboard-write.html';
     14 const cross_origin_src =
     15  'https://{{hosts[alt][]}}:{{ports[https][0]}}' + same_origin_src;
     16 
     17 promise_test(async t => {
     18  await tryGrantWritePermission();
     19  return promise_rejects_dom(t, 'NotAllowedError',
     20      navigator.clipboard.writeText('test text'));
     21 }, 'Feature-Policy header clipboard-write "none" disallows the top-level document.');
     22 
     23 async_test(t => {
     24  test_feature_availability(
     25    'navigator.clipboard.writeText("test text")',
     26    t,
     27    same_origin_src,
     28    expect_feature_unavailable_default
     29  );
     30 }, 'Feature-Policy header clipboard-write "none" disallows same-origin iframes.');
     31 
     32 async_test(t => {
     33  test_feature_availability(
     34    'navigator.clipboard.writeText("test text")',
     35    t,
     36    cross_origin_src,
     37    expect_feature_unavailable_default
     38  );
     39 }, 'Feature-Policy header clipboard-write "none" disallows cross-origin iframes.');
     40 </script>
     41 </body>