commit 9f253c255864400ce909843b175f76a4cf0d8f0f
parent 711e72297a67bb7962e3159f5d7d98866c7c11c9
Author: Neil Deakin <neil@mozilla.com>
Date: Fri, 31 Oct 2025 21:52:14 +0000
Bug 1997318, fix issue where == was inadvertently used instead of =, r=dimi,credential-management-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D270664
Diffstat:
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js
@@ -242,8 +242,8 @@ add_heuristic_tests([
description: `Form field where fathom detects credit card name`,
fixtureData: `
<html><body>
- <label>Nom<input/></label>
<label>Prénom<input/></label>
+ <label>Nom<input/></label>
<label>Saisir une adresse avec un numéro de maison<input/></label>
<label>Ligne d'adresse 2<input/></label>
<label>Code postal<input/></label>
@@ -255,8 +255,8 @@ add_heuristic_tests([
reason: "regex-heuristic",
},
fields: [
- { fieldName: "family-name", reason: "update-heuristic" },
{ fieldName: "given-name" },
+ { fieldName: "name", reason: "update-heuristic-alternate" },
{ fieldName: "address-line1", reason: "update-heuristic-alternate" },
{ fieldName: "address-line2", reason: "update-heuristic" },
{ fieldName: "postal-code" },
diff --git a/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs b/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs
@@ -1032,6 +1032,7 @@ export const FormAutofillHeuristics = {
}
let fathomFoundType;
+ let matchedFieldNames = [];
if (lazy.FormAutofillUtils.isFathomCreditCardsEnabled()) {
// We don't care fields that are not supported by fathom
@@ -1054,7 +1055,8 @@ export const FormAutofillHeuristics = {
return [matchedFieldName, inferredInfo];
}
- fathomFoundType == CC_TYPE;
+ matchedFieldNames = [matchedFieldName];
+ fathomFoundType = CC_TYPE;
}
// Continue to run regex-based heuristics even when fathom doesn't recognize
@@ -1105,11 +1107,12 @@ export const FormAutofillHeuristics = {
}
// Find a matched field name using regexp-based heuristics
- const matchedFieldNames = this._findMatchedFieldNames(
+ const heuristicMatchedFieldNames = this._findMatchedFieldNames(
element,
fields,
fathomFoundType
);
+ matchedFieldNames.push(...heuristicMatchedFieldNames);
// If regular expression based heuristics doesn't find any matched field name,
// and the input type is "tel", just use "tel" as the field name.