diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /dom/events/test/clipboard/simple_navigator_clipboard_readText.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/events/test/clipboard/simple_navigator_clipboard_readText.html')
-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> |