diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/events/test/clipboard/simple_navigator_clipboard_readText.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/events/test/clipboard/simple_navigator_clipboard_readText.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/events/test/clipboard/simple_navigator_clipboard_readText.html b/dom/events/test/clipboard/simple_navigator_clipboard_readText.html new file mode 100644 index 0000000000..0b85371091 --- /dev/null +++ b/dom/events/test/clipboard/simple_navigator_clipboard_readText.html @@ -0,0 +1,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> |