tor-browser

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

feature-policy-clipboard-write.html (649B)


      1 <script src="/resources/testdriver.js"></script>
      2 <script src="/resources/testdriver-vendor.js"></script>
      3 <script>
      4 'use strict';
      5 
      6 (async () => {
      7  try {
      8    // TODO(https://crbug.com/1074482): Cross-origin focus is asynchronous and
      9    // requires user gesture. Implement testing support for cross-origin focus.
     10    window.focus(); // The Clipboard API requires focus.
     11 
     12    await test_driver.set_permission({ name: 'clipboard-write' }, 'granted');
     13    await navigator.clipboard.writeText('test text');
     14 
     15    window.parent.postMessage({ enabled: true }, "*");
     16  } catch (e) {
     17    window.parent.postMessage({ enabled: false }, "*");
     18  }
     19 })();
     20 </script>