commit 756cbe40786a688f8aa04257e9163da44eb29ca3
parent 6d6687e82f8028aeb04daccf549196a4e3510a66
Author: agoloman <agoloman@mozilla.com>
Date: Mon, 1 Dec 2025 23:26:35 +0200
Revert "Bug 1905371 - Fixed edge-case field promotion heuristic r=credential-management-reviewers,dimi,NeilDeakin" for causing bc failures @browser_autocomplete_off_on_form.js.
This reverts commit ce519911be693c53b3527c48b3161f5c7b3b54fe.
Diffstat:
2 files changed, 1 insertion(+), 47 deletions(-)
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_street_lookup.js b/browser/extensions/formautofill/test/browser/address/browser_address_street_lookup.js
@@ -143,40 +143,4 @@ add_autofill_heuristic_tests([
},
],
},
- {
- description:
- "Address search field (address-line1 lookup) is skipped and address-line2 is not promoted",
- fixtureData: `
- <html>
- <body>
- <form>
- <label>First Name: <input id="firstname"></label>
- <label>Last Name: <input id="lastname"></label>
- <label>Address Lookup: <input id="Address1" placeholder="Enter address or postal code"></label>
- <label>Apartment: <input id="apt"></label>
- </form>
- </body>
- </html>
- `,
- profile: TEST_ADDRESS_1,
- expectedResult: [
- {
- default: {
- reason: "regex-heuristic",
- },
- fields: [
- { fieldName: "given-name", autofill: TEST_ADDRESS_1["given-name"] },
- { fieldName: "family-name", autofill: TEST_ADDRESS_1["family-name"] },
- {
- fieldName: "address-line1",
- autofill: "",
- },
- {
- fieldName: "address-line2",
- autofill: TEST_ADDRESS_1["street-address"].split("\n")[1],
- },
- ],
- },
- ],
- },
]);
diff --git a/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs b/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs
@@ -429,7 +429,6 @@ export const FormAutofillHeuristics = {
// during the update.
const fields = [];
const fieldIndicies = [];
-
for (let idx = scanner.parsingIndex; !scanner.parsingFinished; idx++) {
const detail = scanner.getFieldDetailByIndex(idx);
@@ -451,7 +450,6 @@ export const FormAutofillHeuristics = {
if (detail?.isLookup) {
lookupFieldsCount++;
-
continue; // Skip address lookup fields
}
@@ -499,15 +497,7 @@ export const FormAutofillHeuristics = {
}
}
- // If the address-line1 field was not found, we promote `address-line2`
- // to `address-line1`. If the address-line1 field is a lookup field, we don't
- // want to promote another field since it does exist but is not fillable.
- if (
- canUpdate &&
- !scanner.getFieldsMatching(
- field => field.fieldName == "address-line1" && field.isLookup
- )
- ) {
+ if (canUpdate) {
scanner.updateFieldName(fieldIndicies[0], "address-line1");
}
}