blob: 35bde8e5016bd3ff045ebe8cc3e0e39b08d90dc1 (
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
|
<!DOCTYPE html>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-action.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="user-activation.js"></script>
<div style="width: 10px; height: 10px"></div>
<script>
window.addEventListener("message", async (e) => {
if (e.data && e.data[0] == "write") {
test_driver.set_test_context(window.parent);
await test_driver.set_permission({name: 'clipboard-read'}, 'granted');
await test_driver.set_permission({name: 'clipboard-write'}, 'granted');
await waitForUserActivation();
await navigator.clipboard.write([
new ClipboardItem({
"text/plain": e.data[1],
}),
]).catch(() => {
assert_true(false, `should not fail`);
});
window.parent.postMessage("done", "*");
}
});
</script>
</html>
|