Bug 1824473 - Update consumers of toolkit/components/formautofill to import ES modules directly. r=Standard8,geckoview-reviewers,credential-management-reviewers,sgalich,m_kato

Differential Revision: https://phabricator.services.mozilla.com/D173587
This commit is contained in:
Stephanie Cunnane 2023-03-30 17:29:18 +00:00
parent 4ca2bd8458
commit 660bd43791
69 changed files with 202 additions and 295 deletions

View File

@ -8,22 +8,10 @@
const CACHED_STYLESHEETS = new WeakMap();
ChromeUtils.defineModuleGetter(
this,
"FormAutofill",
"resource://autofill/FormAutofill.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"FormAutofillStatus",
"resource://autofill/FormAutofillParent.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"FormAutofillParent",
"resource://autofill/FormAutofillParent.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
FormAutofill: "resource://autofill/FormAutofill.sys.mjs",
FormAutofillParent: "resource://autofill/FormAutofillParent.sys.mjs",
FormAutofillStatus: "resource://autofill/FormAutofillParent.sys.mjs",
AutoCompleteParent: "resource://gre/actors/AutoCompleteParent.sys.mjs",
});
@ -185,10 +173,10 @@ this.formautofill = class extends ExtensionAPI {
ChromeUtils.registerWindowActor("FormAutofill", {
parent: {
moduleURI: "resource://autofill/FormAutofillParent.jsm",
esModuleURI: "resource://autofill/FormAutofillParent.sys.mjs",
},
child: {
moduleURI: "resource://autofill/FormAutofillChild.jsm",
esModuleURI: "resource://autofill/FormAutofillChild.sys.mjs",
events: {
focusin: {},
DOMFormBeforeSubmit: {},

View File

@ -7,11 +7,11 @@
"use strict";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
const { FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
);
class EditAutofillForm {

View File

@ -261,8 +261,8 @@
_onCollapse() {
if (this.showWarningText) {
let { FormAutofillParent } = ChromeUtils.import(
"resource://autofill/FormAutofillParent.jsm"
let { FormAutofillParent } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillParent.sys.mjs"
);
FormAutofillParent.removeMessageObserver(this);
}
@ -298,8 +298,8 @@
this.showWarningText = this._allFieldCategories && this._focusedCategory;
if (this.showWarningText) {
let { FormAutofillParent } = ChromeUtils.import(
"resource://autofill/FormAutofillParent.jsm"
let { FormAutofillParent } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillParent.sys.mjs"
);
FormAutofillParent.addMessageObserver(this);
this.updateWarningNote();

View File

@ -7,11 +7,9 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"formAutofillStorage",
"resource://autofill/FormAutofillStorage.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
formAutofillStorage: "resource://autofill/FormAutofillStorage.sys.mjs",
});
ChromeUtils.defineModuleGetter(
this,
"AutofillTelemetry",

View File

@ -16,8 +16,8 @@ const { AppConstants } = ChromeUtils.importESModule(
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
const { AutofillTelemetry } = ChromeUtils.import(
"resource://autofill/AutofillTelemetry.jsm"
@ -25,18 +25,10 @@ const { AutofillTelemetry } = ChromeUtils.import(
ChromeUtils.defineESModuleGetters(this, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
formAutofillStorage: "resource://autofill/FormAutofillStorage.sys.mjs",
});
ChromeUtils.defineModuleGetter(
this,
"formAutofillStorage",
"resource://autofill/FormAutofillStorage.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"FormAutofillUtils",
"resource://autofill/FormAutofillUtils.jsm"
);
const lazy = {};
XPCOMUtils.defineLazyGetter(

View File

@ -1,7 +1,7 @@
"use strict";
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
const { FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
);
ChromeUtils.defineESModuleGetters(this, {

View File

@ -62,11 +62,11 @@ async function run_test(path, dirs) {
browser,
[{ eligibleElementSelector, file }],
obj => {
const { FieldScanner } = ChromeUtils.import(
"resource://autofill/FormAutofillHeuristics.jsm"
const { FieldScanner } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHeuristics.sys.mjs"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
const { FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
);
let eligibleFields = [];

View File

@ -13,8 +13,8 @@ const SELECTORS = {
reauthCheckbox: "#creditCardReauthenticate checkbox",
};
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
// Visibility of form autofill group should be hidden when opening

View File

@ -1,8 +1,8 @@
"use strict";
add_setup(async function() {
let { formAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
let { formAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
);
await formAutofillStorage.initialize();
});
@ -280,8 +280,8 @@ add_task(async function test_editInvalidCreditCardNumber() {
// Directly use FormAutofillStorage so we can set
// sourceSync: true, since saveCreditCard uses FormAutofillParent
// which doesn't expose this option.
let { formAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
let { formAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
);
await formAutofillStorage.initialize();
// Use `sourceSync: true` to bypass field normalization which will

View File

@ -7,8 +7,8 @@ const { OSKeyStoreTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/OSKeyStoreTestUtils.sys.mjs"
);
const { FormAutofillParent } = ChromeUtils.import(
"resource://autofill/FormAutofillParent.jsm"
const { FormAutofillParent } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillParent.sys.mjs"
);
const MANAGE_ADDRESSES_DIALOG_URL =

View File

@ -10,8 +10,8 @@ let defaultTextColor;
let defaultDisabledTextColor;
let expectingPopup = null;
const { FormAutofillUtils } = SpecialPowers.ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
const { FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
);
async function sleep(ms = 500, reason = "Intentionally wait for UI ready") {
@ -221,7 +221,7 @@ async function triggerAutofillAndCheckProfile(profile) {
);
}
ok(
event instanceof InputEvent,
InputEvent.isInstance(event),
`"input" event should be dispatched with InputEvent interface on ${element.tagName}`
);
is(
@ -242,7 +242,7 @@ async function triggerAutofillAndCheckProfile(profile) {
`"beforeinput" event shouldn't be fired on ${element.tagName}`
);
ok(
event instanceof Event && !(event instanceof UIEvent),
Event.isInstance(event) && !UIEvent.isInstance(event),
`"input" event should be dispatched with Event interface on ${element.tagName}`
);
}

View File

@ -2,18 +2,18 @@
"use strict";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
const { FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
);
const { OSKeyStoreTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/OSKeyStoreTestUtils.sys.mjs"
);
let { formAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
let { formAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
);
const {

View File

@ -149,8 +149,8 @@ async function initProfileStorage(
records,
collectionName = "addresses"
) {
let { FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
let { FormAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
);
let path = getTempFile(fileName).path;
let profileStorage = new FormAutofillStorage(path);
@ -216,11 +216,15 @@ var AddressDataLoader, FormAutofillUtils;
async function runHeuristicsTest(patterns, fixturePathPrefix) {
add_setup(async () => {
({ FormAutofillHeuristics } = ChromeUtils.import(
"resource://autofill/FormAutofillHeuristics.jsm"
({ FormAutofillHeuristics } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHeuristics.sys.mjs"
));
({ AddressDataLoader, FormAutofillUtils, LabelUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({
AddressDataLoader,
FormAutofillUtils,
LabelUtils,
} = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -128,8 +128,8 @@ const KNOWN_NAMES = {
};
add_setup(async () => {
({ FormAutofillHeuristics } = ChromeUtils.import(
"resource://autofill/FormAutofillHeuristics.jsm"
({ FormAutofillHeuristics } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHeuristics.sys.mjs"
));
});

View File

@ -7,8 +7,8 @@
let FormAutofillStatus;
add_setup(async () => {
({ FormAutofillStatus } = ChromeUtils.import(
"resource://autofill/FormAutofillParent.jsm"
({ FormAutofillStatus } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillParent.sys.mjs"
));
});

View File

@ -17,8 +17,8 @@ const SUPPORT_COUNTRIES_TESTCASES = [
var AddressDataLoader, FormAutofillUtils;
add_setup(async () => {
({ AddressDataLoader, FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ AddressDataLoader, FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -11,8 +11,8 @@ const { setTimeout, clearTimeout } = ChromeUtils.importESModule(
var FormAutofillHandler, OSKeyStore;
add_setup(async () => {
({ FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
({ FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
));
({ OSKeyStore } = ChromeUtils.importESModule(
"resource://gre/modules/OSKeyStore.sys.mjs"

View File

@ -82,8 +82,8 @@ const TESTCASES = [
];
add_task(async function do_test() {
let { FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
let { FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
);
for (let test of TESTCASES) {
info("Test case: " + test.description);

View File

@ -6,8 +6,8 @@
var FormAutofillHandler;
add_setup(async () => {
({ FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
({ FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
));
});

View File

@ -6,8 +6,8 @@
var FormAutofillHandler;
add_task(async function seutp() {
({ FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
({ FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
));
});

View File

@ -14,11 +14,11 @@ const { CreditCard } = ChromeUtils.importESModule(
let FormAutofillStorage;
let CREDIT_CARD_SCHEMA_VERSION;
add_setup(async () => {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
({ FormAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
));
({ CREDIT_CARD_SCHEMA_VERSION } = ChromeUtils.import(
"resource://autofill/FormAutofillStorageBase.jsm"
({ CREDIT_CARD_SCHEMA_VERSION } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorageBase.sys.mjs"
));
});

View File

@ -2,8 +2,8 @@
var LabelUtils;
add_task(async function() {
({ LabelUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ LabelUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -2,8 +2,8 @@
var LabelUtils;
add_task(async function() {
({ LabelUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ LabelUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -6,8 +6,8 @@
var FormAutofillHandler;
add_task(async function() {
({ FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
({ FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
));
});

View File

@ -10,8 +10,8 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
let FormAutofillHandler;
add_task(async function() {
({ FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
({ FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
));
});

View File

@ -2,8 +2,8 @@
var FormAutofillUtils;
add_task(async function() {
({ FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -2,8 +2,8 @@
var FormAutofillContent;
add_task(async function() {
({ FormAutofillContent } = ChromeUtils.import(
"resource://autofill/FormAutofillContent.jsm"
({ FormAutofillContent } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillContent.sys.mjs"
));
});

View File

@ -1,18 +1,18 @@
"use strict";
const { FieldScanner } = ChromeUtils.import(
"resource://autofill/FormAutofillHeuristics.jsm"
const { FieldScanner } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHeuristics.sys.mjs"
);
var FormAutofillHeuristics, LabelUtils, FormAutofill;
add_task(async function() {
({ FormAutofillHeuristics } = ChromeUtils.import(
"resource://autofill/FormAutofillHeuristics.jsm"
({ FormAutofillHeuristics } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHeuristics.sys.mjs"
));
({ LabelUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ LabelUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
({ FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
({ FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
));
});

View File

@ -11,8 +11,8 @@ const { CreditCard } = ChromeUtils.importESModule(
let FormAutofillParent, FormAutofillStatus;
let OSKeyStore;
add_setup(async () => {
({ FormAutofillParent, FormAutofillStatus } = ChromeUtils.import(
"resource://autofill/FormAutofillParent.jsm"
({ FormAutofillParent, FormAutofillStatus } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillParent.sys.mjs"
));
({ OSKeyStore } = ChromeUtils.importESModule(
"resource://gre/modules/OSKeyStore.sys.mjs"

View File

@ -7,8 +7,8 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
add_task(async function test_defaultTestEnvironment() {

View File

@ -6,8 +6,8 @@
var FormAutofillNameUtils;
add_setup(async () => {
({ FormAutofillNameUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillNameUtils.jsm"
({ FormAutofillNameUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillNameUtils.sys.mjs"
));
});

View File

@ -4,8 +4,8 @@
"use strict";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
add_task(async function test_defaultTestEnvironment() {

View File

@ -2,8 +2,8 @@
var FormAutofillUtils;
add_setup(async () => {
({ FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -162,8 +162,8 @@ let markedFieldId = [];
var FormAutofillContent;
add_setup(async () => {
({ FormAutofillContent } = ChromeUtils.import(
"resource://autofill/FormAutofillContent.jsm"
({ FormAutofillContent } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillContent.sys.mjs"
));
FormAutofillContent._markAsAutofillField = function(field) {

View File

@ -6,18 +6,18 @@
let FormAutofillStorage;
add_setup(async () => {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
({ FormAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
));
});
const TEST_STORE_FILE_NAME = "test-profile.json";
const { ADDRESS_SCHEMA_VERSION } = ChromeUtils.import(
"resource://autofill/FormAutofillStorageBase.jsm"
const { ADDRESS_SCHEMA_VERSION } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorageBase.sys.mjs"
);
const { CREDIT_CARD_SCHEMA_VERSION } = ChromeUtils.import(
"resource://autofill/FormAutofillStorageBase.jsm"
const { CREDIT_CARD_SCHEMA_VERSION } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorageBase.sys.mjs"
);
const ADDRESS_TESTCASES = [

View File

@ -6,8 +6,8 @@
var FormAutofillNameUtils;
add_task(async function() {
({ FormAutofillNameUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillNameUtils.jsm"
({ FormAutofillNameUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillNameUtils.sys.mjs"
));
});

View File

@ -2,8 +2,8 @@
var FormAutofillContent;
add_setup(async () => {
({ FormAutofillContent } = ChromeUtils.import(
"resource://autofill/FormAutofillContent.jsm"
({ FormAutofillContent } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillContent.sys.mjs"
));
});

View File

@ -2,8 +2,8 @@
var FormAutofillUtils;
add_setup(async () => {
({ FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -6,11 +6,11 @@
var PhoneNumber, PhoneNumberNormalizer;
add_setup(async () => {
({ PhoneNumber } = ChromeUtils.import(
"resource://autofill/phonenumberutils/PhoneNumber.jsm"
({ PhoneNumber } = ChromeUtils.importESModule(
"resource://autofill/phonenumberutils/PhoneNumber.sys.mjs"
));
({ PhoneNumberNormalizer } = ChromeUtils.import(
"resource://autofill/phonenumberutils/PhoneNumberNormalizer.jsm"
({ PhoneNumberNormalizer } = ChromeUtils.importESModule(
"resource://autofill/phonenumberutils/PhoneNumberNormalizer.sys.mjs"
));
});

View File

@ -3,14 +3,14 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { FormAutofillHandler } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
const { FormAutofillHandler } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillHandler.sys.mjs"
);
// Bug 1762063 - we need to fix this pattern of having to wrap destructuring calls in parentheses.
// We can't do a standard destructuring call because FormAutofillUtils is already declared as a var in head.js
({ FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
const { FIELD_STATES } = FormAutofillUtils;
const PREVIEW = FIELD_STATES.PREVIEW;

View File

@ -2,8 +2,8 @@
var AddressResult, CreditCardResult;
add_setup(async () => {
({ AddressResult, CreditCardResult } = ChromeUtils.import(
"resource://autofill/ProfileAutoCompleteResult.jsm"
({ AddressResult, CreditCardResult } = ChromeUtils.importESModule(
"resource://autofill/ProfileAutoCompleteResult.sys.mjs"
));
});

View File

@ -1,8 +1,8 @@
"use strict";
const TEST_STORE_FILE_NAME = "test-profile.json";
const { CREDIT_CARD_SCHEMA_VERSION } = ChromeUtils.import(
"resource://autofill/FormAutofillStorageBase.jsm"
const { CREDIT_CARD_SCHEMA_VERSION } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorageBase.sys.mjs"
);
// NOTE: a guide to reading these test-cases:

View File

@ -7,8 +7,8 @@
let FormAutofillStatus;
add_setup(async () => {
({ FormAutofillStatus } = ChromeUtils.import(
"resource://autofill/FormAutofillParent.jsm"
({ FormAutofillStatus } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillParent.sys.mjs"
));
});

View File

@ -6,8 +6,8 @@
let FormAutofillStorage;
add_setup(async () => {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
({ FormAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
));
});

View File

@ -6,8 +6,8 @@
let FormAutofillStorage;
add_setup(async () => {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
({ FormAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
));
});

View File

@ -20,7 +20,7 @@ const {
sanitizeStorageObject,
AutofillRecord,
AddressesEngine,
} = ChromeUtils.import("resource://autofill/FormAutofillSync.jsm");
} = ChromeUtils.importESModule("resource://autofill/FormAutofillSync.sys.mjs");
Services.prefs.setCharPref("extensions.formautofill.loglevel", "Trace");
initTestLogging("Trace");

View File

@ -13,8 +13,8 @@ const { Service } = ChromeUtils.importESModule(
"resource://services-sync/service.sys.mjs"
);
const { CreditCardsEngine } = ChromeUtils.import(
"resource://autofill/FormAutofillSync.jsm"
const { CreditCardsEngine } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillSync.sys.mjs"
);
Services.prefs.setCharPref("extensions.formautofill.loglevel", "Trace");

View File

@ -2,8 +2,8 @@
var FormAutofillUtils;
add_setup(async () => {
({ FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
({ FormAutofillUtils } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillUtils.sys.mjs"
));
});

View File

@ -6,8 +6,8 @@
let FormAutofillStorage;
add_setup(async () => {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
({ FormAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
));
});

View File

@ -788,10 +788,10 @@ function startup() {
actors: {
FormAutofill: {
parent: {
moduleURI: "resource://autofill/FormAutofillParent.jsm",
esModuleURI: "resource://autofill/FormAutofillParent.sys.mjs",
},
child: {
moduleURI: "resource://autofill/FormAutofillChild.jsm",
esModuleURI: "resource://autofill/FormAutofillChild.sys.mjs",
events: {
focusin: {},
DOMFormBeforeSubmit: {},

View File

@ -11,14 +11,9 @@ import { Logger } from "resource://tps/logger.sys.mjs";
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"formAutofillStorage",
"resource://autofill/FormAutofillStorage.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
formAutofillStorage: "resource://autofill/FormAutofillStorage.sys.mjs",
});
class FormAutofillBase {

View File

@ -2,17 +2,13 @@
* 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/. */
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
PhoneNumber: "resource://autofill/phonenumberutils/PhoneNumber.jsm",
ChromeUtils.defineESModuleGetters(lazy, {
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
PhoneNumber: "resource://autofill/phonenumberutils/PhoneNumber.sys.mjs",
});
class AddressField {

View File

@ -2,12 +2,8 @@
* 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/. */
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
);
const { FormAutofillCreditCardSection } = ChromeUtils.import(
"resource://autofill/FormAutofillHandler.jsm"
);
import { FormAutofillCreditCardSection } from "resource://autofill/FormAutofillHandler.sys.mjs";
import { FormAutofillUtils } from "resource://autofill/FormAutofillUtils.sys.mjs";
const { FIELD_STATES } = FormAutofillUtils;

View File

@ -37,15 +37,9 @@ import {
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
FormLikeFactory: "resource://gre/modules/FormLikeFactory.sys.mjs",
});
ChromeUtils.defineModuleGetter(
lazy,
"FormAutofillUtils",
"resource://autofill/FormAutofillUtils.jsm"
);
XPCOMUtils.defineLazyModuleGetters(lazy, {
LabelUtils: "resource://autofill/FormAutofillUtils.jsm",
LabelUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
});
/**

View File

@ -2,21 +2,16 @@
* 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 { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AutoCompleteChild: "resource://gre/actors/AutoCompleteChild.sys.mjs",
FormAutofill: "resource://autofill/FormAutofill.sys.mjs",
FormAutofillContent: "resource://autofill/FormAutofillContent.sys.mjs",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
FormAutofill: "resource://autofill/FormAutofill.jsm",
FormAutofillContent: "resource://autofill/FormAutofillContent.jsm",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
});
/**
* Handles content's interactions for the frame.
*/

View File

@ -16,18 +16,18 @@ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AddressResult: "resource://autofill/ProfileAutoCompleteResult.sys.mjs",
CreditCardResult: "resource://autofill/ProfileAutoCompleteResult.sys.mjs",
FormAutofill: "resource://autofill/FormAutofill.sys.mjs",
FormAutofillHandler: "resource://autofill/FormAutofillHandler.sys.mjs",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
FormLikeFactory: "resource://gre/modules/FormLikeFactory.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddressResult: "resource://autofill/ProfileAutoCompleteResult.jsm",
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
CreditCardResult: "resource://autofill/ProfileAutoCompleteResult.jsm",
AutofillTelemetry: "resource://autofill/AutofillTelemetry.jsm",
FormAutofill: "resource://autofill/FormAutofill.jsm",
FormAutofillHandler: "resource://autofill/FormAutofillHandler.jsm",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
InsecurePasswordUtils: "resource://gre/modules/InsecurePasswordUtils.jsm",
});

View File

@ -7,26 +7,20 @@
*/
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { FormAutofillUtils } from "resource://autofill/FormAutofillUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
FormAutofillHeuristics: "resource://autofill/FormAutofillHeuristics.sys.mjs",
FormLikeFactory: "resource://gre/modules/FormLikeFactory.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AutofillTelemetry: "resource://autofill/AutofillTelemetry.jsm",
FormAutofillHeuristics: "resource://autofill/FormAutofillHeuristics.jsm",
});
const formFillController = Cc[

View File

@ -7,22 +7,16 @@
*/
export let FormAutofillHeuristics;
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
creditCardRulesets: "resource://autofill/CreditCardRuleset.jsm",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
LabelUtils: "resource://autofill/FormAutofillUtils.jsm",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
LabelUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
creditCardRulesets: "resource://autofill/CreditCardRuleset.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "log", () =>

View File

@ -27,27 +27,23 @@
// We expose a singleton from this module. Some tests may import the
// constructor via a backstage pass.
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { FormAutofillUtils } from "resource://autofill/FormAutofillUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AddressComparison: "resource://autofill/AddressComponent.sys.mjs",
AddressComponent: "resource://autofill/AddressComponent.sys.mjs",
FormAutofillPreferences:
"resource://autofill/FormAutofillPreferences.sys.mjs",
FormAutofillPrompter: "resource://autofill/FormAutofillPrompter.sys.mjs",
OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddressComparison: "resource://autofill/AddressComponent.jsm",
AddressComponent: "resource://autofill/AddressComponent.jsm",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
FormAutofillPreferences: "resource://autofill/FormAutofillPreferences.jsm",
FormAutofillPrompter: "resource://autofill/FormAutofillPrompter.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "log", () =>
@ -273,8 +269,8 @@ export let FormAutofillStatus = {
// Lazily load the storage JSM to avoid disk I/O until absolutely needed.
// Once storage is loaded we need to update saved field names and inform content processes.
XPCOMUtils.defineLazyGetter(lazy, "gFormAutofillStorage", () => {
let { formAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm"
let { formAutofillStorage } = ChromeUtils.importESModule(
"resource://autofill/FormAutofillStorage.sys.mjs"
);
lazy.log.debug("Loading formAutofillStorage");

View File

@ -14,12 +14,8 @@ const MANAGE_ADDRESSES_URL =
const MANAGE_CREDITCARDS_URL =
"chrome://formautofill/content/manageCreditCards.xhtml";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
);
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { FormAutofillUtils } from "resource://autofill/FormAutofillUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};

View File

@ -122,24 +122,21 @@
* this new field.
*/
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
FormAutofillNameUtils: "resource://autofill/FormAutofillNameUtils.sys.mjs",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
PhoneNumber: "resource://autofill/phonenumberutils/PhoneNumber.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AutofillTelemetry: "resource://autofill/AutofillTelemetry.jsm",
FormAutofillNameUtils: "resource://autofill/FormAutofillNameUtils.jsm",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
PhoneNumber: "resource://autofill/phonenumberutils/PhoneNumber.jsm",
});
const CryptoHash = Components.Constructor(

View File

@ -14,16 +14,12 @@ import { Utils } from "resource://services-sync/util.sys.mjs";
const { SCORE_INCREMENT_XLARGE } = ChromeUtils.import(
"resource://services-sync/constants.js"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Log: "resource://gre/modules/Log.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
formAutofillStorage: "resource://autofill/FormAutofillStorage.jsm",
formAutofillStorage: "resource://autofill/FormAutofillStorage.sys.mjs",
});
// A helper to sanitize address and creditcard records suitable for logging.

View File

@ -56,22 +56,17 @@ const ELIGIBLE_INPUT_TYPES = ["text", "email", "tel", "number", "month"];
// attacks that fill the user's hard drive(s).
const MAX_FIELD_VALUE_LENGTH = 200;
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
FormAutofillNameUtils: "resource://autofill/FormAutofillNameUtils.sys.mjs",
OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
FormAutofillNameUtils: "resource://autofill/FormAutofillNameUtils.jsm",
});
export let AddressDataLoader = {
// Status of address data loading. We'll load all the countries with basic level 1
// information while requesting conutry information, and set country to true.

View File

@ -8,10 +8,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(

View File

@ -10,11 +10,11 @@
// constructor via a backstage pass.
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const {
import {
FormAutofillStorageBase,
CreditCardsBase,
AddressesBase,
} = ChromeUtils.import("resource://autofill/FormAutofillStorageBase.jsm");
} from "resource://autofill/FormAutofillStorageBase.sys.mjs";
import { JSONFile } from "resource://gre/modules/JSONFile.sys.mjs";
const lazy = {};

View File

@ -8,17 +8,13 @@
*/
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
import { FormAutofillUtils } from "resource://autofill/FormAutofillUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { AutofillTelemetry } = ChromeUtils.import(
"resource://autofill/AutofillTelemetry.jsm"
);
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};

View File

@ -8,30 +8,22 @@
// We expose a singleton from this module. Some tests may import the
// constructor via a backstage pass.
const { FormAutofill } = ChromeUtils.import(
"resource://autofill/FormAutofill.jsm"
);
const {
FormAutofillStorageBase,
CreditCardsBase,
import {
AddressesBase,
} = ChromeUtils.import("resource://autofill/FormAutofillStorageBase.jsm");
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
CreditCardsBase,
FormAutofillStorageBase,
} from "resource://autofill/FormAutofillStorageBase.sys.mjs";
import { FormAutofill } from "resource://autofill/FormAutofill.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CreditCard: "resource://gre/modules/CreditCard.sys.mjs",
FormAutofillUtils: "resource://autofill/FormAutofillUtils.sys.mjs",
JSONFile: "resource://gre/modules/JSONFile.sys.mjs",
OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
});
const PROFILE_JSON_FILE_NAME = "autofill-profiles.json";
class Addresses extends AddressesBase {

View File

@ -4,8 +4,8 @@
toolkit.jar:
% resource autofill %res/autofill/
res/autofill/ (./*.jsm)
res/autofill/phonenumberutils/ (./phonenumberutils/*.jsm)
res/autofill/ (./*.sys.mjs)
res/autofill/phonenumberutils/ (./phonenumberutils/*.sys.mjs)
res/autofill/addressmetadata/ (./addressmetadata/*)
res/autofill/content/ (./content/*)
#ifdef ANDROID

View File

@ -5,17 +5,13 @@
// This library came from https://github.com/andreasgal/PhoneNumber.js but will
// be further maintained by our own in Form Autofill codebase.
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { PHONE_NUMBER_META_DATA } = ChromeUtils.import(
"resource://autofill/phonenumberutils/PhoneNumberMetaData.jsm"
);
import { PHONE_NUMBER_META_DATA } from "resource://autofill/phonenumberutils/PhoneNumberMetaData.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
ChromeUtils.defineESModuleGetters(lazy, {
PhoneNumberNormalizer:
"resource://autofill/phonenumberutils/PhoneNumberNormalizer.jsm",
"resource://autofill/phonenumberutils/PhoneNumberNormalizer.sys.mjs",
});
export var PhoneNumber = (function(dataBase) {