mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1916927 - P3. Make iOS compatible with the architecture change r=issammani
Differential Revision: https://phabricator.services.mozilla.com/D221706
This commit is contained in:
parent
1f04e1ad40
commit
8b1b75c739
@ -96,6 +96,36 @@ const TEST_CASES = [
|
||||
tel: "",
|
||||
},
|
||||
|
||||
expectedSubmit: null,
|
||||
},
|
||||
{
|
||||
description: `Test correct street-address to address-line1`,
|
||||
document: `<form>
|
||||
<input id="email" autocomplete="email">
|
||||
<input id="tel" autocomplete="tel">
|
||||
<input id="street-address" >
|
||||
<input id="address-line2">
|
||||
<form>`,
|
||||
fillPayload: {
|
||||
"street-address": "2 Harrison St\nline2",
|
||||
email: "foo@mozilla.com",
|
||||
tel: "1234567",
|
||||
},
|
||||
|
||||
expectedFill: {
|
||||
"#street-address": "2 Harrison St",
|
||||
"#address-line2": "line2",
|
||||
"#email": "foo@mozilla.com",
|
||||
"#tel": "1234567",
|
||||
},
|
||||
|
||||
expectedDetectedFields: {
|
||||
email: "",
|
||||
tel: "",
|
||||
"address-line1": "",
|
||||
"address-line2": "",
|
||||
},
|
||||
|
||||
expectedSubmit: null,
|
||||
},
|
||||
];
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
/* eslint-disable no-undef,mozilla/balanced-listeners */
|
||||
import { AddressRecord } from "resource://gre/modules/shared/AddressRecord.sys.mjs";
|
||||
import { FormAutofillHandler } from "resource://gre/modules/shared/FormAutofillHandler.sys.mjs";
|
||||
import { FormAutofillHeuristics } from "resource://gre/modules/shared/FormAutofillHeuristics.sys.mjs";
|
||||
import { FormAutofillUtils } from "resource://gre/modules/shared/FormAutofillUtils.sys.mjs";
|
||||
import { FormStateManager } from "resource://gre/modules/shared/FormStateManager.sys.mjs";
|
||||
import { CreditCardRecord } from "resource://gre/modules/shared/CreditCardRecord.sys.mjs";
|
||||
@ -54,7 +56,7 @@ export class FormAutofillChild {
|
||||
);
|
||||
}
|
||||
|
||||
_doIdentifyAutofillFields(element) {
|
||||
identifyFieldsWhenFocused(element) {
|
||||
if (this.#focusedElement == element) {
|
||||
return;
|
||||
}
|
||||
@ -65,11 +67,17 @@ export class FormAutofillChild {
|
||||
}
|
||||
|
||||
// Find the autofill handler for this form and identify all the fields.
|
||||
const { handler, newFieldsIdentified } =
|
||||
this.fieldDetailsManager.identifyAutofillFields(element);
|
||||
const handler = this.fieldDetailsManager.getOrCreateFormHandler(element);
|
||||
|
||||
if (!handler.hasIdentifiedFields() || handler.updateFormIfNeeded(element)) {
|
||||
// If we found newly identified fields, run section classification heuristic
|
||||
const detectedFields = FormAutofillHandler.collectFormFields(
|
||||
handler.form
|
||||
);
|
||||
|
||||
FormAutofillHeuristics.parseAndUpdateFieldNamesParent(detectedFields);
|
||||
handler.setIdentifiedFieldDetails(detectedFields);
|
||||
|
||||
// If we found newly identified fields, run section classification heuristic
|
||||
if (newFieldsIdentified) {
|
||||
this.#sections = FormAutofillSection.classifySections(
|
||||
handler.fieldDetails
|
||||
);
|
||||
@ -103,7 +111,7 @@ export class FormAutofillChild {
|
||||
onFocusIn(evt) {
|
||||
const element = evt.target;
|
||||
|
||||
this._doIdentifyAutofillFields(element);
|
||||
this.identifyFieldsWhenFocused(element);
|
||||
|
||||
// Only ping swift if current field is either a cc or address field
|
||||
if (!this.activeFieldDetail) {
|
||||
|
Loading…
Reference in New Issue
Block a user