summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/clipboard-apis/async-unsanitized-standard-html-read-fail.tentative.https.html
blob: f0884d6c20cbe33caf86ddd5789c264a609c07a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!doctype html>
<meta charset="utf-8">
<title>Async Clipboard unsanitized HTML read validation tests</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<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 waitForUserActivation();
  await promise_rejects_dom(t, 'NotAllowedError',
      navigator.clipboard.read({unsanitized: ['text/html', 'text/plain']}));
}, 'navigator.clipboard.read() fails for multiple unsanitized formats requested.');

promise_test(async t => {
  await tryGrantReadPermission();

  await waitForUserActivation();
  await promise_rejects_dom(t, 'NotAllowedError',
      navigator.clipboard.read({unsanitized: ['text/plain']}));
}, 'navigator.clipboard.read() fails for unsanitized text/plain requested.');

promise_test(async t => {
  await tryGrantReadPermission();

  await waitForUserActivation();
  await promise_rejects_dom(t, 'NotAllowedError',
      navigator.clipboard.read({unsanitized: ['image/png']}));
}, 'navigator.clipboard.read() fails for unsanitized image/png requested.');

promise_test(async t => {
  await tryGrantReadPermission();

  await waitForUserActivation();
  await promise_rejects_dom(t, 'NotAllowedError',
      navigator.clipboard.read({unsanitized: ['image/svg+xml']}));
}, 'navigator.clipboard.read() fails for unsanitized image/svg+xml requested.');

</script>