Skip to content

Commit 9f0146e

Browse files
committed
Bug 1956282, when fathom matches a credit card name, also check if the field matches an address name, r=dimi,credential-management-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D267546 UltraBlame original commit: 8fdfac9a2c68e158c5e79a68817cf0392c7ca1e5
1 parent 1ae276e commit 9f0146e

File tree

2 files changed

+247
-3
lines changed

2 files changed

+247
-3
lines changed

browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,197 @@ level2
18901890
}
18911891
]
18921892
}
1893+
{
1894+
description
1895+
:
1896+
Form
1897+
field
1898+
where
1899+
fathom
1900+
detects
1901+
credit
1902+
card
1903+
name
1904+
fixtureData
1905+
:
1906+
<
1907+
html
1908+
>
1909+
<
1910+
body
1911+
>
1912+
<
1913+
label
1914+
>
1915+
Nom
1916+
<
1917+
input
1918+
/
1919+
>
1920+
<
1921+
/
1922+
label
1923+
>
1924+
<
1925+
label
1926+
>
1927+
Pr
1928+
nom
1929+
<
1930+
input
1931+
/
1932+
>
1933+
<
1934+
/
1935+
label
1936+
>
1937+
<
1938+
label
1939+
>
1940+
Saisir
1941+
une
1942+
adresse
1943+
avec
1944+
un
1945+
num
1946+
ro
1947+
de
1948+
maison
1949+
<
1950+
input
1951+
/
1952+
>
1953+
<
1954+
/
1955+
label
1956+
>
1957+
<
1958+
label
1959+
>
1960+
Ligne
1961+
d
1962+
'
1963+
adresse
1964+
2
1965+
<
1966+
input
1967+
/
1968+
>
1969+
<
1970+
/
1971+
label
1972+
>
1973+
<
1974+
label
1975+
>
1976+
Code
1977+
postal
1978+
<
1979+
input
1980+
/
1981+
>
1982+
<
1983+
/
1984+
label
1985+
>
1986+
<
1987+
/
1988+
body
1989+
>
1990+
<
1991+
/
1992+
html
1993+
>
1994+
expectedResult
1995+
:
1996+
[
1997+
{
1998+
default
1999+
:
2000+
{
2001+
reason
2002+
:
2003+
"
2004+
regex
2005+
-
2006+
heuristic
2007+
"
2008+
}
2009+
fields
2010+
:
2011+
[
2012+
{
2013+
fieldName
2014+
:
2015+
"
2016+
family
2017+
-
2018+
name
2019+
"
2020+
reason
2021+
:
2022+
"
2023+
update
2024+
-
2025+
heuristic
2026+
"
2027+
}
2028+
{
2029+
fieldName
2030+
:
2031+
"
2032+
given
2033+
-
2034+
name
2035+
"
2036+
}
2037+
{
2038+
fieldName
2039+
:
2040+
"
2041+
address
2042+
-
2043+
line1
2044+
"
2045+
reason
2046+
:
2047+
"
2048+
update
2049+
-
2050+
heuristic
2051+
-
2052+
alternate
2053+
"
2054+
}
2055+
{
2056+
fieldName
2057+
:
2058+
"
2059+
address
2060+
-
2061+
line2
2062+
"
2063+
reason
2064+
:
2065+
"
2066+
update
2067+
-
2068+
heuristic
2069+
"
2070+
}
2071+
{
2072+
fieldName
2073+
:
2074+
"
2075+
postal
2076+
-
2077+
code
2078+
"
2079+
}
2080+
]
2081+
}
2082+
]
2083+
}
18932084
]
18942085
)
18952086
;

toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7002,6 +7002,9 @@ inferredInfo
70027002
]
70037003
;
70047004
}
7005+
let
7006+
fathomFoundType
7007+
;
70057008
if
70067009
(
70077010
lazy
@@ -7098,13 +7101,61 @@ if
70987101
matchedFieldName
70997102
)
71007103
{
7104+
/
7105+
/
7106+
If
7107+
the
7108+
name
7109+
was
7110+
matched
7111+
fall
7112+
through
7113+
and
7114+
try
7115+
to
7116+
detect
7117+
if
7118+
the
7119+
/
7120+
/
7121+
field
7122+
also
7123+
matches
7124+
an
7125+
address
7126+
type
7127+
which
7128+
may
7129+
be
7130+
a
7131+
better
7132+
match
7133+
.
7134+
if
7135+
(
7136+
matchedFieldName
7137+
!
7138+
=
7139+
"
7140+
cc
7141+
-
7142+
name
7143+
"
7144+
)
7145+
{
71017146
return
71027147
[
71037148
matchedFieldName
71047149
inferredInfo
71057150
]
71067151
;
71077152
}
7153+
fathomFoundType
7154+
=
7155+
=
7156+
CC_TYPE
7157+
;
7158+
}
71087159
/
71097160
/
71107161
Continue
@@ -7506,6 +7557,7 @@ _findMatchedFieldNames
75067557
(
75077558
element
75087559
fields
7560+
fathomFoundType
75097561
)
75107562
;
75117563
return
@@ -8854,6 +8906,10 @@ _findMatchedFieldNames
88548906
(
88558907
element
88568908
fieldNames
8909+
foundType
8910+
=
8911+
"
8912+
"
88578913
)
88588914
{
88598915
if
@@ -8914,9 +8970,6 @@ ADDR_TYPE
89148970
)
89158971
;
89168972
let
8917-
foundType
8918-
;
8919-
let
89208973
attribute
89218974
=
89228975
true

0 commit comments

Comments
 (0)