summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/browser_bug527935.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /editor/libeditor/tests/browser_bug527935.js
parentInitial commit. (diff)
downloadfirefox-upstream/124.0.1.tar.xz
firefox-upstream/124.0.1.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editor/libeditor/tests/browser_bug527935.js')
-rw-r--r--editor/libeditor/tests/browser_bug527935.js78
1 files changed, 78 insertions, 0 deletions
diff --git a/editor/libeditor/tests/browser_bug527935.js b/editor/libeditor/tests/browser_bug527935.js
new file mode 100644
index 0000000000..cece783491
--- /dev/null
+++ b/editor/libeditor/tests/browser_bug527935.js
@@ -0,0 +1,78 @@
+add_task(async function () {
+ await new Promise(resolve => waitForFocus(resolve, window));
+
+ const kPageURL =
+ "http://example.org/browser/editor/libeditor/tests/bug527935.html";
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: kPageURL,
+ },
+ async function (aBrowser) {
+ var popupShown = false;
+ function listener() {
+ popupShown = true;
+ }
+ SpecialPowers.addAutoCompletePopupEventListener(
+ window,
+ "popupshowing",
+ listener
+ );
+
+ await SpecialPowers.spawn(aBrowser, [], async function () {
+ var window = content.window.wrappedJSObject;
+ var document = window.document;
+ var formTarget = document.getElementById("formTarget");
+ var initValue = document.getElementById("initValue");
+
+ window.loadPromise = new Promise(resolve => {
+ formTarget.onload = resolve;
+ });
+
+ initValue.focus();
+ initValue.value = "foo";
+ });
+
+ EventUtils.synthesizeKey("KEY_Enter");
+
+ await SpecialPowers.spawn(aBrowser, [], async function () {
+ var window = content.window.wrappedJSObject;
+ var document = window.document;
+
+ await window.loadPromise;
+
+ var newInput = document.createElement("input");
+ newInput.setAttribute("name", "test");
+ document.body.appendChild(newInput);
+
+ var event = new window.KeyboardEvent("keypress", {
+ bubbles: true,
+ cancelable: true,
+ view: null,
+ keyCode: 0,
+ charCode: "f".charCodeAt(0),
+ });
+ newInput.value = "";
+ newInput.focus();
+ newInput.dispatchEvent(event);
+ });
+
+ await new Promise(resolve => hitEventLoop(resolve, 100));
+
+ ok(!popupShown, "Popup must not be opened");
+ SpecialPowers.removeAutoCompletePopupEventListener(
+ window,
+ "popupshowing",
+ listener
+ );
+ }
+ );
+});
+
+function hitEventLoop(func, times) {
+ if (times > 0) {
+ setTimeout(hitEventLoop, 0, func, times - 1);
+ } else {
+ setTimeout(func, 0);
+ }
+}