commit cfa8b20dfaaedf214790d480dd62a4d26ce8b626
parent f57c260f8415e635172f61e8bbd2c96fe3f96756
Author: Henrik Skupin <mail@hskupin.info>
Date: Wed, 12 Nov 2025 12:53:17 +0000
Bug 1998953 - [remote] Directly return in async methods of PromptListener. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D271974
Diffstat:
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/remote/shared/Prompt.sys.mjs b/remote/shared/Prompt.sys.mjs
@@ -146,6 +146,12 @@ modal.Dialog = class {
return null;
}
+ /**
+ * Sets the text of a prompt's input field.
+ *
+ * @param {string} inputText
+ * The text to set for the input field.
+ */
set text(inputText) {
if (lazy.AppInfo.isAndroid) {
this.window.setInputText(inputText);
@@ -156,6 +162,9 @@ modal.Dialog = class {
}
}
+ /**
+ * Accept the user prompt.
+ */
accept() {
if (lazy.AppInfo.isAndroid) {
// GeckoView does not have a UI, so the methods are called directly
@@ -166,6 +175,9 @@ modal.Dialog = class {
}
}
+ /**
+ * Dismiss the user prompt.
+ */
dismiss() {
if (lazy.AppInfo.isAndroid) {
// GeckoView does not have a UI, so the methods are called directly
@@ -179,28 +191,28 @@ modal.Dialog = class {
/**
* Returns text of the prompt.
*
- * @returns {string | Promise}
- * Returns string on desktop and Promise on Android.
+ * @returns {Promise<string>}
+ * Returns a Promise resolving to the prompt text.
*/
- async getText() {
+ getText() {
if (lazy.AppInfo.isAndroid) {
- const textPromise = await this.window.getPromptText();
- return textPromise;
+ return this.window.getPromptText();
}
- return this.ui.infoBody.textContent;
+
+ return Promise.resolve(this.ui.infoBody.textContent);
}
/**
* Returns text of the prompt input.
*
- * @returns {string}
- * Returns string on desktop and Promise on Android.
+ * @returns {Promise<string>}
+ * Returns a Promise resolving to the input's text.
*/
- async getInputText() {
+ getInputText() {
if (lazy.AppInfo.isAndroid) {
- const textPromise = await this.window.getInputText();
- return textPromise;
+ return this.window.getInputText();
}
- return this.ui.loginTextbox.value;
+
+ return Promise.resolve(this.ui.loginTextbox.value);
}
};