blob: 0b85371091dfa36d913e29ecd5335760d0817dda (
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
47
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Required by the .js part of the test. In a more ideal world, the script
could be loaded in the .js part; however, currently, that causes other
problems, which would require other changes in test framework code. -->
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<script src="/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js"></script>
<script src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script>
<script>
function onLoad() {
const readTextResult = document.getElementById("readTextResultId");
const b1 = document.getElementById("invokeReadTextOnceId");
b1.addEventListener("click", async () => {
navigator.clipboard.readText().then(text => {
readTextResult.textContent = "Resolved: " + text;
}, () => { readTextResult.textContent = "Rejected." });
});
const b2 = document.getElementById("invokeReadTextTwiceId");
b2.addEventListener("click", async () => {
const t1 = navigator.clipboard.readText();
const t2 = navigator.clipboard.readText();
const r1 = await t1.then(text => {
return "Resolved 1: " + text;
}, () => { return "Rejected: 1";});
const r2 = await t2.then(text => {
return "Resolved 2: " + text;
}, () => { return "Rejected: 2";});
readTextResult.textContent = r1 + "; " + r2;
});
}
</script>
</head>
<body onload="onLoad()">
<button id="invokeReadTextOnceId">1</button>
<button id="invokeReadTextTwiceId">2</button>
<div id="readTextResultId"/>
</body>
</html>
|