summaryrefslogtreecommitdiffstats
path: root/remote/shared
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /remote/shared
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/shared')
-rw-r--r--remote/shared/Prompt.sys.mjs43
-rw-r--r--remote/shared/listeners/PromptListener.sys.mjs11
-rw-r--r--remote/shared/messagehandler/test/browser/browser_handle_command_retry.js4
-rw-r--r--remote/shared/messagehandler/test/browser/browser_session_data_browser_element.js2
-rw-r--r--remote/shared/messagehandler/test/xpcshell/test_Errors.js2
-rw-r--r--remote/shared/webdriver/Capabilities.sys.mjs5
6 files changed, 21 insertions, 46 deletions
diff --git a/remote/shared/Prompt.sys.mjs b/remote/shared/Prompt.sys.mjs
index bacf24c5d1..39292d4bfd 100644
--- a/remote/shared/Prompt.sys.mjs
+++ b/remote/shared/Prompt.sys.mjs
@@ -42,7 +42,7 @@ modal.findPrompt = function (context) {
win.opener === context.window
) {
lazy.logger.trace("Found open window modal prompt");
- return new modal.Dialog(() => context, win);
+ return new modal.Dialog(win);
}
}
@@ -51,7 +51,7 @@ modal.findPrompt = function (context) {
if (geckoViewPrompts.length) {
lazy.logger.trace("Found open GeckoView prompt");
const prompt = geckoViewPrompts[0];
- return new modal.Dialog(() => context, prompt);
+ return new modal.Dialog(prompt);
}
}
@@ -65,7 +65,7 @@ modal.findPrompt = function (context) {
let dialogs = contentBrowser.tabDialogBox.getTabDialogManager().dialogs;
if (dialogs.length) {
lazy.logger.trace("Found open tab modal prompt");
- return new modal.Dialog(() => context, dialogs[0].frameContentWindow);
+ return new modal.Dialog(dialogs[0].frameContentWindow);
}
dialogs = contentBrowser.tabDialogBox.getContentDialogManager().dialogs;
@@ -74,36 +74,23 @@ modal.findPrompt = function (context) {
// gets lazily added. If it's not set yet, ignore the dialog for now.
if (dialogs.length && dialogs[0].frameContentWindow.Dialog) {
lazy.logger.trace("Found open content prompt");
- return new modal.Dialog(() => context, dialogs[0].frameContentWindow);
+ return new modal.Dialog(dialogs[0].frameContentWindow);
}
}
-
- // If no modal dialog has been found yet, check for old non SubDialog based
- // content modal dialogs. Even with those deprecated in Firefox 89 we should
- // keep supporting applications that don't have them implemented yet.
- if (contentBrowser?.tabModalPromptBox) {
- const prompts = contentBrowser.tabModalPromptBox.listPrompts();
- if (prompts.length) {
- lazy.logger.trace("Found open old-style content prompt");
- return new modal.Dialog(() => context, null);
- }
- }
-
return null;
};
/**
* Represents a modal dialog.
*
- * @param {function(): browser.Context} curBrowserFn
- * Function that returns the current |browser.Context|.
* @param {DOMWindow} dialog
* DOMWindow of the dialog.
*/
modal.Dialog = class {
- constructor(curBrowserFn, dialog) {
- this.curBrowserFn_ = curBrowserFn;
- this.win_ = Cu.getWeakReference(dialog);
+ #win;
+
+ constructor(dialog) {
+ this.#win = Cu.getWeakReference(dialog);
}
get args() {
@@ -114,10 +101,6 @@ modal.Dialog = class {
return tm ? tm.args : null;
}
- get curBrowser_() {
- return this.curBrowserFn_();
- }
-
get isOpen() {
if (lazy.AppInfo.isAndroid) {
return this.window !== null;
@@ -136,11 +119,7 @@ modal.Dialog = class {
}
get tabModal() {
- let win = this.window;
- if (win) {
- return win.Dialog;
- }
- return this.curBrowser_.getTabModal();
+ return this.window?.Dialog;
}
get promptType() {
@@ -164,8 +143,8 @@ modal.Dialog = class {
* it is currently attached to the DOM.
*/
get window() {
- if (this.win_) {
- let win = this.win_.get();
+ if (this.#win) {
+ let win = this.#win.get();
if (win && (lazy.AppInfo.isAndroid || win.parent)) {
return win;
}
diff --git a/remote/shared/listeners/PromptListener.sys.mjs b/remote/shared/listeners/PromptListener.sys.mjs
index e04c766970..0e14409051 100644
--- a/remote/shared/listeners/PromptListener.sys.mjs
+++ b/remote/shared/listeners/PromptListener.sys.mjs
@@ -172,7 +172,7 @@ export class PromptListener {
}
this.emit("opened", {
contentBrowser: curBrowser.contentBrowser,
- prompt: new lazy.modal.Dialog(() => curBrowser, subject),
+ prompt: new lazy.modal.Dialog(subject),
});
break;
@@ -190,7 +190,6 @@ export class PromptListener {
// the selected tab.
const tab = tabBrowser.selectedTab;
const contentBrowser = lazy.TabManager.getBrowserForTab(tab);
- const window = lazy.TabManager.getWindowForTab(tab);
// Do not send the event if the curBrowser is specified,
// and it's different from prompt browser.
@@ -200,13 +199,7 @@ export class PromptListener {
this.emit("opened", {
contentBrowser,
- prompt: new lazy.modal.Dialog(
- () => ({
- contentBrowser,
- window,
- }),
- prompt
- ),
+ prompt: new lazy.modal.Dialog(prompt),
});
return;
}
diff --git a/remote/shared/messagehandler/test/browser/browser_handle_command_retry.js b/remote/shared/messagehandler/test/browser/browser_handle_command_retry.js
index 1d020397e1..815990079b 100644
--- a/remote/shared/messagehandler/test/browser/browser_handle_command_retry.js
+++ b/remote/shared/messagehandler/test/browser/browser_handle_command_retry.js
@@ -12,8 +12,8 @@ PromiseTestUtils.allowMatchingRejectionsGlobally(
);
// The tests in this file assert the retry behavior for MessageHandler commands.
-// We call "blocked" commands from resources/modules/windowglobal/retry.jsm and
-// then trigger reload and navigations to simulate AbortErrors and force the
+// We call "blocked" commands from resources/modules/windowglobal/retry.sys.mjs
+// and then trigger reload and navigations to simulate AbortErrors and force the
// MessageHandler to retry the commands, when possible.
// Test that without retry behavior, a pending command rejects when the
diff --git a/remote/shared/messagehandler/test/browser/browser_session_data_browser_element.js b/remote/shared/messagehandler/test/browser/browser_session_data_browser_element.js
index 9c15974ae6..f435ad2a91 100644
--- a/remote/shared/messagehandler/test/browser/browser_session_data_browser_element.js
+++ b/remote/shared/messagehandler/test/browser/browser_session_data_browser_element.js
@@ -27,7 +27,7 @@ add_task(async function test_session_data_broadcast() {
const root = createRootMessageHandler("session-id-event");
- // When the windowglobal command.jsm module applies the session data
+ // When the windowglobal command.sys.mjs module applies the session data
// browser_session_data_browser_element, it will emit an event.
// Collect the events to detect which MessageHandlers have been started.
info("Watch events emitted when session data is applied");
diff --git a/remote/shared/messagehandler/test/xpcshell/test_Errors.js b/remote/shared/messagehandler/test/xpcshell/test_Errors.js
index 26187dac11..1a1d50e97e 100644
--- a/remote/shared/messagehandler/test/xpcshell/test_Errors.js
+++ b/remote/shared/messagehandler/test/xpcshell/test_Errors.js
@@ -7,7 +7,7 @@ const { error } = ChromeUtils.importESModule(
);
// Note: this test file is similar to remote/shared/webdriver/test/xpcshell/test_Errors.js
-// because shared/webdriver/Errors.jsm and shared/messagehandler/Errors.jsm share
+// because shared/webdriver/Errors.sys.mjs and shared/messagehandler/Errors.sys.mjs share
// similar helpers.
add_task(function test_toJSON() {
diff --git a/remote/shared/webdriver/Capabilities.sys.mjs b/remote/shared/webdriver/Capabilities.sys.mjs
index 3c30ea0789..8ed9836306 100644
--- a/remote/shared/webdriver/Capabilities.sys.mjs
+++ b/remote/shared/webdriver/Capabilities.sys.mjs
@@ -1031,7 +1031,10 @@ export function validateCapabilities(capabilities) {
*/
export function processCapabilities(params) {
const { capabilities } = params;
- lazy.assert.object(capabilities);
+ lazy.assert.object(
+ capabilities,
+ lazy.pprint`Expected "capabilities" to be an object, got ${capabilities}`
+ );
let {
alwaysMatch: requiredCapabilities = {},