Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /clipboard-apis/async-clipboard-read-unsanitized-null.https.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<title>Async Clipboard read with unsanitized:null should not crash</title>
<body>Body needed for test_driver.click()</body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/user-activation.js"></script>
<script>
'use strict';
promise_test(async t => {
await tryGrantReadPermission();
await tryGrantWritePermission();
const textInput = "<p>hello</p>";
const format1 = 'text/html';
const blobInput1 = new Blob([textInput], {type: format1});
const clipboardItemInput = new ClipboardItem({[format1]: blobInput1});
await waitForUserActivation();
await navigator.clipboard.write([clipboardItemInput]);
await waitForUserActivation();
const items = navigator.clipboard.read({unsanitized: null});
await promise_rejects_js(t, TypeError, items);
}, 'unsanitized: null should reject with TypeError');
</script>