Bug 1832325 - P2. Move FormAutofillSection to shared folder r=credential-management-reviewers,issammani

Differential Revision: https://phabricator.services.mozilla.com/D177658
This commit is contained in:
Dimi 2023-05-18 13:50:42 +00:00
Родитель 2bf4cf0720
Коммит f76cb406d5
8 изменённых файлов: 17 добавлений и 23 удалений

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { FormAutofillUtils } from "resource://gre/modules/shared/FormAutofillUtils.sys.mjs";
import { FormAutofillCreditCardSection } from "resource://autofill/FormAutofillSection.sys.mjs";
import { FormAutofillCreditCardSection } from "resource://gre/modules/shared/FormAutofillSection.sys.mjs";
const { FIELD_STATES } = FormAutofillUtils;

Просмотреть файл

@ -27,6 +27,7 @@ const IOS_DEFAULT_PREFERENCES = {
"extensions.formautofill.addresses.ignoreAutocompleteOff": true,
"extensions.formautofill.heuristics.enabled": true,
"extensions.formautofill.section.enabled": true,
"extensions.formautofill.focusOnAutofill": false,
};
// Used Mimic the behavior of .getAutocompleteInfo()

Просмотреть файл

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { FormAutofillSection } from "resource://autofill/FormAutofillSection.sys.mjs";
// Since we are listening on focus events to ping swift,
// focusing inputs before filling will cause an infinite loop
FormAutofillSection.SHOULD_FOCUS_ON_AUTOFILL = false;
export { FormAutofillSection };
export * from "resource://autofill/FormAutofillSection.sys.mjs";

Просмотреть файл

@ -13,7 +13,6 @@ const ModuleOverrides = {
"Region.sys.mjs": "Helpers.ios.mjs",
"OSKeyStore.sys.mjs": "Helpers.ios.mjs",
"FormAutofill.sys.mjs": "FormAutofill.ios.sys.mjs",
"FormAutofillSection.sys.mjs": "FormAutofillSection.ios.sys.mjs",
"EntryFile.sys.mjs": "FormAutofillChild.ios.sys.mjs",
};

Просмотреть файл

@ -17,6 +17,7 @@ EXTRA_JS_MODULES.shared += [
"shared/FormAutofillHandler.sys.mjs",
"shared/FormAutofillHeuristics.sys.mjs",
"shared/FormAutofillNameUtils.sys.mjs",
"shared/FormAutofillSection.sys.mjs",
"shared/FormAutofillUtils.sys.mjs",
"shared/FormStateManager.sys.mjs",
"shared/HeuristicsRegExp.sys.mjs",

Просмотреть файл

@ -8,11 +8,12 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
FormAutofillAddressSection:
"resource://gre/modules/shared/FormAutofillSection.sys.mjs",
FormAutofillCreditCardSection:
"resource://gre/modules/shared/FormAutofillSection.sys.mjs",
FormAutofillHeuristics:
"resource://gre/modules/shared/FormAutofillHeuristics.sys.mjs",
FormAutofillAddressSection: "resource://autofill/FormAutofillSection.sys.mjs",
FormAutofillCreditCardSection:
"resource://autofill/FormAutofillSection.sys.mjs",
FormLikeFactory: "resource://gre/modules/FormLikeFactory.sys.mjs",
FormSection: "resource://gre/modules/shared/FieldScanner.sys.mjs",
});

Просмотреть файл

@ -300,12 +300,8 @@ export class FormAutofillSection {
}
}
fillFieldValue(
element,
value,
shouldFocus = FormAutofillSection.SHOULD_FOCUS_ON_AUTOFILL
) {
if (shouldFocus) {
fillFieldValue(element, value) {
if (FormAutofillUtils.focusOnAutofill) {
element.focus({ preventScroll: true });
}
if (HTMLInputElement.isInstance(element)) {

Просмотреть файл

@ -1248,3 +1248,11 @@ XPCOMUtils.defineLazyPreferenceGetter(
null,
pref => parseFloat(pref)
);
// This is only used in iOS
XPCOMUtils.defineLazyPreferenceGetter(
FormAutofillUtils,
"focusOnAutofill",
"extensions.formautofill.focusOnAutofill",
true
);