tor-browser

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

async-clipboard-read-unsanitized-null.https.html (1048B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Async Clipboard read with unsanitized:null should not crash</title>
      4 <body>Body needed for test_driver.click()</body>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 <script src="resources/user-activation.js"></script>
     10 <script>
     11 'use strict';
     12 
     13 promise_test(async t => {
     14  await tryGrantReadPermission();
     15  await tryGrantWritePermission();
     16 
     17  const textInput = "<p>hello</p>";
     18  const format1 = 'text/html';
     19  const blobInput1 = new Blob([textInput], {type: format1});
     20  const clipboardItemInput = new ClipboardItem({[format1]: blobInput1});
     21 
     22  await waitForUserActivation();
     23  await navigator.clipboard.write([clipboardItemInput]);
     24  await waitForUserActivation();
     25  const items = navigator.clipboard.read({unsanitized: null});
     26  await promise_rejects_js(t, TypeError, items);
     27 }, 'unsanitized: null should reject with TypeError');
     28 </script>