tor-browser

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

clipboard-write-enabled-on-self-origin-by-feature-policy.tentative.https.sub.html (1402B)


      1 <!doctype html>
      2 <body>Body needed for test_driver.click()</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  await waitForUserActivation();
     20  await navigator.clipboard.writeText('test text');
     21 }, 'Feature-Policy header clipboard-write "self" allows the top-level document.');
     22 
     23 promise_test(async t => {
     24  await waitForUserActivation();
     25  test_feature_availability(
     26    'navigator.clipboard.writeText("test text")',
     27    t,
     28    same_origin_src,
     29    expect_feature_available_default
     30  );
     31 }, 'Feature-Policy header clipboard-write "self" allows same-origin iframes.');
     32 
     33 promise_test(async t => {
     34  test_feature_availability(
     35    'navigator.clipboard.writeText("test text")',
     36    t,
     37    cross_origin_src,
     38    expect_feature_unavailable_default
     39  );
     40 }, 'Feature-Policy header clipboard-write "self" disallows cross-origin iframes.');
     41 </script>