summaryrefslogtreecommitdiffstats
path: root/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs')
-rw-r--r--toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs48
1 files changed, 8 insertions, 40 deletions
diff --git a/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs b/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs
index 411d9249db..187caf9d62 100644
--- a/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs
+++ b/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs
@@ -7,7 +7,10 @@
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
-import { GenericAutocompleteItem } from "resource://gre/modules/FillHelpers.sys.mjs";
+import {
+ GenericAutocompleteItem,
+ sendFillRequestToParent,
+} from "resource://gre/modules/FillHelpers.sys.mjs";
const lazy = {};
@@ -487,7 +490,7 @@ export class LoginAutoComplete {
* @param {string} aSearchString The value typed in the field.
* @param {nsIAutoCompleteResult} aPreviousResult
* @param {HTMLInputElement} aElement
- * @param {nsIFormAutoCompleteObserver} aCallback
+ * @param {nsIFormFillCompleteObserver} aCallback
*/
startSearch(aSearchString, aPreviousResult, aElement, aCallback) {
let { isNullPrincipal } = aElement.nodePrincipal;
@@ -717,7 +720,6 @@ export class LoginAutoComplete {
let gAutoCompleteListener = {
added: false,
- fillRequestId: 0,
init() {
if (!this.added) {
@@ -729,45 +731,11 @@ let gAutoCompleteListener = {
async observe(subject, topic, data) {
switch (topic) {
case "autocomplete-will-enter-text": {
- await this.sendFillRequestToLoginManagerParent(subject, data);
+ if (subject && subject == lazy.formFillController.controller.input) {
+ await sendFillRequestToParent("LoginManager", subject, data);
+ }
break;
}
}
},
-
- async sendFillRequestToLoginManagerParent(input, comment) {
- if (!comment) {
- return;
- }
-
- if (input != lazy.formFillController.controller.input) {
- return;
- }
-
- const { fillMessageName, fillMessageData } = JSON.parse(comment ?? "{}");
- if (!fillMessageName) {
- return;
- }
-
- this.fillRequestId++;
- const fillRequestId = this.fillRequestId;
- const child = lazy.LoginManagerChild.forWindow(
- input.focusedInput.ownerGlobal
- );
- const value = await child.sendQuery(fillMessageName, fillMessageData ?? {});
-
- // skip fill if another fill operation started during await
- if (fillRequestId != this.fillRequestId) {
- return;
- }
-
- if (typeof value !== "string") {
- return;
- }
-
- // If LoginManagerParent returned a string to fill, we must do it here because
- // nsAutoCompleteController.cpp already finished it's work before we finished await.
- input.textValue = value;
- input.selectTextRange(value.length, value.length);
- },
};