tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 62e523ce64f5a2fd04523e2217667393a5faaa0b
parent 9facb17058555906d21c74efef7fbb338dd96d5a
Author: Dimi <dlee@mozilla.com>
Date:   Tue, 21 Oct 2025 17:14:34 +0000

Bug 1935980 - if a field is not identified but has type='tel', assume it is a tel field r=NeilDeakin,credential-management-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D266807

Diffstat:
Mbrowser/extensions/formautofill/test/browser/heuristics/browser_parse_tel_fields.js | 26++++++++++++++++++++++++++
Mtoolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs | 6++++++
2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parse_tel_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_tel_fields.js @@ -34,4 +34,30 @@ add_heuristic_tests([ }, ], }, + { + description: + "Address form where type='tel' must be checked to identify telephone field", + fixtureData: ` + <form> + <input type="text" id="name" autocomplete="name"/> + <input type="text" id="country" autocomplete="country"/> + <input type="text" id="street-address" autocomplete="street-address"/> + <input type="text" id="address-line1" autocomplete="address-line1"/> + <input type="tel"/> + </form>`, + expectedResult: [ + { + default: { + reason: "autocomplete", + }, + fields: [ + { fieldName: "name" }, + { fieldName: "country" }, + { fieldName: "street-address" }, + { fieldName: "address-line1" }, + { fieldName: "tel", reason: "regex-heuristic" }, + ], + }, + ], + }, ]); diff --git a/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs b/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs @@ -1111,6 +1111,12 @@ export const FormAutofillHeuristics = { fathomFoundType ); + // 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. + if (!matchedFieldNames.length && element.type == "tel") { + return ["tel", inferredInfo]; + } + return [matchedFieldNames, inferredInfo]; },