summaryrefslogtreecommitdiffstats
path: root/dom/tests/browser/browser_bug1316330.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /dom/tests/browser/browser_bug1316330.js
parentInitial commit. (diff)
downloadthunderbird-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/tests/browser/browser_bug1316330.js')
-rw-r--r--dom/tests/browser/browser_bug1316330.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/dom/tests/browser/browser_bug1316330.js b/dom/tests/browser/browser_bug1316330.js
new file mode 100644
index 0000000000..c81d489cf7
--- /dev/null
+++ b/dom/tests/browser/browser_bug1316330.js
@@ -0,0 +1,52 @@
+const URL =
+ "data:text/html,<script>" +
+ "window.focus();" +
+ "var down = 0; var press = 0;" +
+ "onkeydown = function(e) {" +
+ " var startTime = Date.now();" +
+ " document.body.setAttribute('data-down', ++down);" +
+ " if (e.keyCode == KeyboardEvent.DOM_VK_D) while (Date.now() - startTime < 500) {}" +
+ "};" +
+ "onkeypress = function(e) {" +
+ " var startTime = Date.now();" +
+ " document.body.setAttribute('data-press', ++press);" +
+ " if (e.charCode == 'p'.charCodeAt(0)) while (Date.now() - startTime < 500) {}" +
+ "};" +
+ "</script>";
+
+add_task(async function () {
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+ let browser = tab.linkedBrowser;
+
+ await EventUtils.synthesizeAndWaitKey("d", { repeat: 3 });
+
+ await SpecialPowers.spawn(browser, [], async function () {
+ is(
+ content.document.body.getAttribute("data-down"),
+ "2",
+ "Correct number of events"
+ );
+ is(
+ content.document.body.getAttribute("data-press"),
+ "2",
+ "Correct number of events"
+ );
+ });
+
+ await EventUtils.synthesizeAndWaitKey("p", { repeat: 3 });
+
+ await SpecialPowers.spawn(browser, [], async function () {
+ is(
+ content.document.body.getAttribute("data-down"),
+ "4",
+ "Correct number of events"
+ );
+ is(
+ content.document.body.getAttribute("data-press"),
+ "4",
+ "Correct number of events"
+ );
+ });
+
+ gBrowser.removeCurrentTab();
+});