Bug 1792817 - Port bug 1792365: Migrate some toolkit module imports to ESM. r=mkmelin
authorRob Lemley <rob@thunderbird.net>
Fri, 30 Sep 2022 20:44:14 +1000
changeset 36844 ab339ed067360dcc0527e4b1c3a42fca51ecc68f
parent 36843 b7ccb931c2b25484a0e9c7ff254913af2b504915
child 36845 b0dfdc487c9f28a0fabd01d21733ef84b09164f6
push id20342
push usermkmelin@iki.fi
push dateFri, 30 Sep 2022 10:49:13 +0000
treeherdercomm-central@b0dfdc487c9f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1792817, 1792365
Bug 1792817 - Port bug 1792365: Migrate some toolkit module imports to ESM. r=mkmelin ../mach tb-esmify --upstream-imports calendar --prefix=toolkit/ ../mach tb-esmify --upstream-imports chat --prefix=toolkit/ ../mach tb-esmify --upstream-imports mail --prefix=toolkit/ ../mach tb-esmify --upstream-imports mailnews --prefix=toolkit/ Differential Revision: https://phabricator.services.mozilla.com/D158363
calendar/base/content/widgets/calendar-filter.js
calendar/base/src/CalDeletedItems.jsm
calendar/test/browser/invitations/browser_attachedPublishEvent.js
calendar/test/browser/invitations/browser_identityPrompt.js
calendar/test/browser/invitations/browser_imipBar.js
calendar/test/browser/invitations/browser_imipBarCancel.js
calendar/test/browser/invitations/browser_imipBarExceptionCancel.js
calendar/test/browser/invitations/browser_imipBarExceptionOnly.js
calendar/test/browser/invitations/browser_imipBarExceptions.js
calendar/test/browser/invitations/browser_imipBarRepeat.js
calendar/test/browser/invitations/browser_imipBarRepeatCancel.js
calendar/test/browser/invitations/browser_imipBarRepeatUpdates.js
calendar/test/browser/invitations/browser_imipBarUpdates.js
calendar/test/browser/invitations/browser_unsupportedFreq.js
calendar/test/browser/invitations/head.js
calendar/test/browser/providers/head.js
calendar/test/unit/head.js
calendar/test/unit/providers/head.js
chat/protocols/xmpp/xmpp-base.jsm
mail/base/content/aboutDialog-appUpdater.js
mail/base/content/messageWindow.js
mail/base/content/msgMail3PaneWindow.js
mail/base/content/nsContextMenu.js
mail/base/content/printUtils.js
mail/base/test/browser/browser_linkHandler.js
mail/base/test/unit/test_alertHook.js
mail/components/MailGlue.jsm
mail/components/about-support/content/aboutSupport.js
mail/components/addrbook/content/aboutAddressBook.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/dialogs/EdSpellCheck.js
mail/components/customizableui/CustomizableUI.jsm
mail/components/customizableui/CustomizableWidgets.jsm
mail/components/customizableui/content/panelUI.js
mail/components/enterprisepolicies/Policies.sys.mjs
mail/components/enterprisepolicies/tests/browser/browser_policy_app_auto_update.js
mail/components/enterprisepolicies/tests/browser/browser_policy_app_update.js
mail/components/enterprisepolicies/tests/browser/browser_policy_background_app_update.js
mail/components/enterprisepolicies/tests/browser/browser_policy_downloads.js
mail/components/enterprisepolicies/tests/xpcshell/test_macosparser_unflatten.js
mail/components/extensions/extensionPopup.js
mail/components/extensions/parent/ext-menus.js
mail/components/extensions/parent/ext-tabs.js
mail/components/extensions/test/xpcshell/test_ext_messages_get.js
mail/components/extensions/test/xpcshell/test_ext_messages_import.js
mail/components/im/content/chat-conversation.js
mail/components/im/content/chat-messenger.js
mail/components/im/modules/index_im.jsm
mail/components/preferences/compose.js
mail/components/preferences/downloads.js
mail/components/preferences/general.js
mail/components/preferences/passwordManager.js
mail/components/preferences/preferences.js
mail/components/preferences/privacy.js
mail/extensions/openpgp/content/modules/sqliteDb.jsm
mail/extensions/openpgp/test/unit/rnp/test_secretKeys.js
mail/modules/ExtensionsUI.jsm
mail/modules/GlobalPopupNotifications.jsm
mail/modules/SessionStoreManager.jsm
mail/modules/TagUtils.jsm
mail/test/browser/account/browser_accountTelemetry.js
mail/test/browser/openpgp/browser_collectKeys.js
mail/test/browser/openpgp/browser_editDraftTemplate.js
mail/test/browser/openpgp/browser_openPGPDrafts.js
mail/test/browser/openpgp/browser_perm_decrypt.js
mail/test/browser/openpgp/browser_viewMessage.js
mail/test/browser/openpgp/browser_viewMessageSecurity.js
mail/test/browser/openpgp/browser_viewPartialMessage.js
mail/test/browser/openpgp/composition/browser_composeEncrypted.js
mail/test/browser/openpgp/composition/browser_composeSigned.js
mail/test/browser/openpgp/composition/browser_composeSwitchIdentity.js
mail/test/browser/session-store/browser_sessionStore.js
mail/test/browser/smime/browser_multipartAlternative.js
mail/test/static/browser_parsable_css.js
mail/themes/Windows8WindowFrameColor.jsm
mailnews/addrbook/modules/LDAPDirectory.jsm
mailnews/addrbook/modules/SQLiteDirectory.jsm
mailnews/base/prefs/content/AccountManager.js
mailnews/base/prefs/content/converterDialog.js
mailnews/base/src/mailstoreConverter.jsm
mailnews/base/test/unit/test_converterDeferredAccount.js
mailnews/base/test/unit/test_junkingWhenDisabled.js
mailnews/base/test/unit/test_nsMsgDBView.js
mailnews/compose/test/unit/test_sendMessageLater2.js
mailnews/db/gloda/test/unit/test_smime_mimemsg_representation.js
mailnews/extensions/newsblog/FeedUtils.jsm
mailnews/extensions/newsblog/feed-subscriptions.js
mailnews/imap/test/unit/test_converterImap.js
mailnews/mime/test/unit/test_openpgp_decrypt.js
mailnews/mime/test/unit/test_smime_decrypt.js
mailnews/mime/test/unit/test_smime_perm_decrypt.js
mailnews/news/test/unit/test_internalUris.js
--- a/calendar/base/content/widgets/calendar-filter.js
+++ b/calendar/base/content/widgets/calendar-filter.js
@@ -1,15 +1,15 @@
 /* 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-globals-from ../calendar-views-utils.js */
 
-var { PromiseUtils } = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
+var { PromiseUtils } = ChromeUtils.importESModule("resource://gre/modules/PromiseUtils.sys.mjs");
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { CalReadableStreamFactory } = ChromeUtils.import(
   "resource:///modules/CalReadableStreamFactory.jsm"
 );
 
 /**
  * Object that contains a set of filter properties that may be used by a calFilter object
  * to filter a set of items.
--- a/calendar/base/src/CalDeletedItems.jsm
+++ b/calendar/base/src/CalDeletedItems.jsm
@@ -1,16 +1,16 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["CalDeletedItems"];
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 
 /**
  * Handles remembering deleted items.
  *
  * This is (currently) not a real trashcan. Only ids and time deleted is stored.
  * Note also that the code doesn't strictly check the calendar of the item,
  * except when a calendar id is passed to getDeletedDate.
  */
--- a/calendar/test/browser/invitations/browser_attachedPublishEvent.js
+++ b/calendar/test/browser/invitations/browser_attachedPublishEvent.js
@@ -7,17 +7,17 @@
  * These are attached VCALENDARs that have METHOD:PUBLISH.
  */
 "use strict";
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var gCalendar;
 
 /**
  * Initialize account, identity and calendar.
  */
 add_setup(async function() {
--- a/calendar/test/browser/invitations/browser_identityPrompt.js
+++ b/calendar/test/browser/invitations/browser_identityPrompt.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Tests for the calender-itip-identity dialog.
  */
 
 "use strict";
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
--- a/calendar/test/browser/invitations/browser_imipBar.js
+++ b/calendar/test/browser/invitations/browser_imipBar.js
@@ -6,17 +6,17 @@
  * Tests for receiving event invitations via the imip-bar.
  */
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { CalItipDefaultEmailTransport } = ChromeUtils.import(
   "resource:///modules/CalItipEmailTransport.jsm"
 );
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_imipBarCancel.js
+++ b/calendar/test/browser/invitations/browser_imipBarCancel.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests for processing cancellations via the imip-bar.
  */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_imipBarExceptionCancel.js
+++ b/calendar/test/browser/invitations/browser_imipBarExceptionCancel.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests for processing cancellations to recurring event exceptions.
  */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   CalEvent: "resource:///modules/CalEvent.jsm",
--- a/calendar/test/browser/invitations/browser_imipBarExceptionOnly.js
+++ b/calendar/test/browser/invitations/browser_imipBarExceptionOnly.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests for receiving an invitation exception but the original event was not
  * processed first.
  */
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_imipBarExceptions.js
+++ b/calendar/test/browser/invitations/browser_imipBarExceptions.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests for handling exceptions to recurring event invitations via the imip-bar.
  */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   CalEvent: "resource:///modules/CalEvent.jsm",
--- a/calendar/test/browser/invitations/browser_imipBarRepeat.js
+++ b/calendar/test/browser/invitations/browser_imipBarRepeat.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Tests for receiving recurring event invitations via the imip-bar.
  */
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_imipBarRepeatCancel.js
+++ b/calendar/test/browser/invitations/browser_imipBarRepeatCancel.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Tests for processing cancellations to recurring invitations via the imip-bar.
  */
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_imipBarRepeatUpdates.js
+++ b/calendar/test/browser/invitations/browser_imipBarRepeatUpdates.js
@@ -5,17 +5,17 @@
 /**
  * Tests for receiving minor and major updates to recurring event invitations
  * via the imip-bar.
  */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_imipBarUpdates.js
+++ b/calendar/test/browser/invitations/browser_imipBarUpdates.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests for receiving minor and major updates to invitations via the imip-bar.
  */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let identity;
 let calendar;
--- a/calendar/test/browser/invitations/browser_unsupportedFreq.js
+++ b/calendar/test/browser/invitations/browser_unsupportedFreq.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests for ensuring the application does not hang after processing an
  * unsupported FREQ value.
  */
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 let calendar;
 
--- a/calendar/test/browser/invitations/head.js
+++ b/calendar/test/browser/invitations/head.js
@@ -10,17 +10,17 @@
  */
 
 "use strict";
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { CalItipDefaultEmailTransport } = ChromeUtils.import(
   "resource:///modules/CalItipEmailTransport.jsm"
 );
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var { FileTestUtils } = ChromeUtils.import("resource://testing-common/FileTestUtils.jsm");
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 
 registerCleanupFunction(async () => {
--- a/calendar/test/browser/providers/head.js
+++ b/calendar/test/browser/providers/head.js
@@ -7,17 +7,17 @@ SimpleTest.requestCompleteLog();
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 var { handleDeleteOccurrencePrompt } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarUtils.jsm"
 );
 
-var { PromiseUtils } = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
+var { PromiseUtils } = ChromeUtils.importESModule("resource://gre/modules/PromiseUtils.sys.mjs");
 var { saveAndCloseItemDialog, setData } = ChromeUtils.import(
   "resource://testing-common/calendar/ItemEditingHelpers.jsm"
 );
 
 let calendarObserver = {
   QueryInterface: ChromeUtils.generateQI(["calIObserver"]),
 
   /* calIObserver */
--- a/calendar/test/unit/head.js
+++ b/calendar/test/unit/head.js
@@ -1,14 +1,14 @@
 /* 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/. */
 
 var { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
 
 var { updateAppInfo } = ChromeUtils.import("resource://testing-common/AppInfo.jsm");
 
 ChromeUtils.defineModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
 
 updateAppInfo();
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
--- a/calendar/test/unit/providers/head.js
+++ b/calendar/test/unit/providers/head.js
@@ -2,17 +2,17 @@
  * 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/. */
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { CalendarTestUtils } = ChromeUtils.import(
   "resource://testing-common/calendar/CalendarTestUtils.jsm"
 );
 var { CalEvent } = ChromeUtils.import("resource:///modules/CalEvent.jsm");
-var { PromiseUtils } = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
+var { PromiseUtils } = ChromeUtils.importESModule("resource://gre/modules/PromiseUtils.sys.mjs");
 
 var { updateAppInfo } = ChromeUtils.import("resource://testing-common/AppInfo.jsm");
 updateAppInfo();
 
 // The tests in this directory each do the same thing, with slight variations as needed for each
 // calendar provider. The core of the test lives in this file and the tests call it when ready.
 
 do_get_profile();
--- a/chat/protocols/xmpp/xmpp-base.jsm
+++ b/chat/protocols/xmpp/xmpp-base.jsm
@@ -44,21 +44,19 @@ var { XMPPSession } = ChromeUtils.import
 
 const lazy = {};
 
 ChromeUtils.defineModuleGetter(
   lazy,
   "DownloadUtils",
   "resource://gre/modules/DownloadUtils.jsm"
 );
-ChromeUtils.defineModuleGetter(
-  lazy,
-  "FileUtils",
-  "resource://gre/modules/FileUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(lazy, {
+  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
+});
 ChromeUtils.defineModuleGetter(
   lazy,
   "NetUtil",
   "resource://gre/modules/NetUtil.jsm"
 );
 XPCOMUtils.defineLazyServiceGetter(
   lazy,
   "imgTools",
--- a/mail/base/content/aboutDialog-appUpdater.js
+++ b/mail/base/content/aboutDialog-appUpdater.js
@@ -7,21 +7,19 @@
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 var { DownloadUtils } = ChromeUtils.import(
   "resource://gre/modules/DownloadUtils.jsm"
 );
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "UpdateUtils",
-  "resource://gre/modules/UpdateUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
+});
 
 const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx";
 const PREF_APP_UPDATE_ELEVATE_NEVER = "app.update.elevate.never";
 
 var gAppUpdater;
 
 function onUnload(aEvent) {
   if (gAppUpdater) {
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -23,21 +23,24 @@
 
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
+ChromeUtils.defineESModuleGetters(this, {
+  ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(this, {
   CustomizableUI: "resource:///modules/CustomizableUI.jsm",
   MailUtils: "resource:///modules/MailUtils.jsm",
   MsgHdrSyntheticView: "resource:///modules/MsgHdrSyntheticView.jsm",
-  ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
   UIDensity: "resource:///modules/UIDensity.jsm",
   UIFontSize: "resource:///modules/UIFontSize.jsm",
 });
 
 // from MailNewsTypes.h
 var nsMsgKey_None = 0xffffffff;
 var nsMsgViewIndex_None = 0xffffffff;
 
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -28,28 +28,31 @@
 ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
+ChromeUtils.defineESModuleGetters(this, {
+  Color: "resource://gre/modules/Color.sys.mjs",
+  ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(this, {
   BondOpenPGP: "chrome://openpgp/content/BondOpenPGP.jsm",
-  Color: "resource://gre/modules/Color.jsm",
   CustomizableUI: "resource:///modules/CustomizableUI.jsm",
   JSTreeSelection: "resource:///modules/JsTreeSelection.jsm",
   LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
   MailConsts: "resource:///modules/MailConsts.jsm",
   MailUtils: "resource:///modules/MailUtils.jsm",
   msgDBCacheManager: "resource:///modules/MsgDBCacheManager.jsm",
   PeriodicFilterManager: "resource:///modules/PeriodicFilterManager.jsm",
   SessionStoreManager: "resource:///modules/SessionStoreManager.jsm",
-  ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
   SummaryFrameManager: "resource:///modules/SummaryFrameManager.jsm",
   TagUtils: "resource:///modules/TagUtils.jsm",
 });
 
 // A stub for tests to avoid test failures caused by the harness expecting
 // this to exist.
 var NewTabPagePreloading = {
   removePreloadedBrowser() {},
--- a/mail/base/content/nsContextMenu.js
+++ b/mail/base/content/nsContextMenu.js
@@ -5,18 +5,18 @@
 
 /* import-globals-from folderDisplay.js */
 /* import-globals-from mailTabs.js */
 /* import-globals-from mailWindow.js */
 /* import-globals-from messageDisplay.js */
 /* import-globals-from utilityOverlay.js */
 /* global EnigmailURIs: false, gEncryptedURIService: true */
 
-var { InlineSpellChecker, SpellCheckHelper } = ChromeUtils.import(
-  "resource://gre/modules/InlineSpellChecker.jsm"
+var { InlineSpellChecker, SpellCheckHelper } = ChromeUtils.importESModule(
+  "resource://gre/modules/InlineSpellChecker.sys.mjs"
 );
 var { PlacesUtils } = ChromeUtils.importESModule(
   "resource://gre/modules/PlacesUtils.sys.mjs"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 var { XPCOMUtils } = ChromeUtils.import(
--- a/mail/base/content/printUtils.js
+++ b/mail/base/content/printUtils.js
@@ -1,19 +1,22 @@
 /* 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/. */
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
+ChromeUtils.defineESModuleGetters(this, {
+  SubDialogManager: "resource://gre/modules/SubDialog.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(this, {
   MailE10SUtils: "resource:///modules/MailE10SUtils.jsm",
-  SubDialogManager: "resource://gre/modules/SubDialog.jsm",
 });
 
 // Load PrintUtils lazily and modify it to suit.
 XPCOMUtils.defineLazyGetter(this, "PrintUtils", () => {
   let scope = {};
   Services.scriptloader.loadSubScript(
     "chrome://global/content/printUtils.js",
     scope
--- a/mail/base/test/browser/browser_linkHandler.js
+++ b/mail/base/test/browser/browser_linkHandler.js
@@ -2,18 +2,18 @@
  * 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/. */
 
 /* eslint-disable @microsoft/sdl/no-insecure-url */
 
 let { MockRegistrar } = ChromeUtils.import(
   "resource://testing-common/MockRegistrar.jsm"
 );
-let { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+let { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 const TEST_DOMAIN = "http://example.org";
 const TEST_IP = "http://127.0.0.1:8888";
 const TEST_PATH = "/browser/comm/mail/base/test/browser/files/links.html";
 
 let links = new Map([
   ["#this-hash", `${TEST_PATH}#hash`],
--- a/mail/base/test/unit/test_alertHook.js
+++ b/mail/base/test/unit/test_alertHook.js
@@ -14,18 +14,18 @@ var { MailServices } = ChromeUtils.impor
   "resource:///modules/MailServices.jsm"
 );
 var { MockRegistrar } = ChromeUtils.import(
   "resource://testing-common/MockRegistrar.jsm"
 );
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 alertHook.init();
 
 // Wait time of 1s for slow debug builds.
 const TEST_WAITTIME = 1000;
 
 var gMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"].createInstance(
--- a/mail/components/MailGlue.jsm
+++ b/mail/components/MailGlue.jsm
@@ -20,31 +20,37 @@ const lazy = {};
 // lazy module getter
 
 XPCOMUtils.defineLazyGetter(lazy, "gMailBundle", function() {
   return Services.strings.createBundle(
     "chrome://messenger/locale/messenger.properties"
   );
 });
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  LightweightThemeConsumer:
+    "resource://gre/modules/LightweightThemeConsumer.sys.mjs",
+
+  OsEnvironment: "resource://gre/modules/OsEnvironment.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   ActorManagerParent: "resource://gre/modules/ActorManagerParent.jsm",
   AddonManager: "resource://gre/modules/AddonManager.jsm",
   cal: "resource:///modules/calendar/calUtils.jsm",
   ChatCore: "resource:///modules/chatHandler.jsm",
   ExtensionSupport: "resource:///modules/ExtensionSupport.jsm",
   MailMigrator: "resource:///modules/MailMigrator.jsm",
   MailServices: "resource:///modules/MailServices.jsm",
   MailUsageTelemetry: "resource:///modules/MailUsageTelemetry.jsm",
-  LightweightThemeConsumer:
-    "resource://gre/modules/LightweightThemeConsumer.jsm",
-  OsEnvironment: "resource://gre/modules/OsEnvironment.jsm",
   PdfJs: "resource://pdf.js/PdfJs.jsm",
+
   RemoteSecuritySettings:
     "resource://gre/modules/psm/RemoteSecuritySettings.jsm",
+
   TBDistCustomizer: "resource:///modules/TBDistCustomizer.jsm",
 });
 
 const PREF_PDFJS_ISDEFAULT_CACHE_STATE = "pdfjs.enabledCache.state";
 
 let JSWINDOWACTORS = {
   ChatAction: {
     matches: ["chrome://chat/content/conv.html"],
@@ -554,18 +560,18 @@ MailGlue.prototype = {
               AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED
             );
           });
         }
       }
     }
 
     if (AppConstants.ASAN_REPORTER) {
-      var { AsanReporter } = ChromeUtils.import(
-        "resource://gre/modules/AsanReporter.jsm"
+      var { AsanReporter } = ChromeUtils.importESModule(
+        "resource://gre/modules/AsanReporter.sys.mjs"
       );
       AsanReporter.init();
     }
 
     this._scheduleStartupIdleTasks();
     this._lateTasksIdleObserver = (idleService, topic, data) => {
       if (topic == "idle") {
         idleService.removeIdleObserver(
--- a/mail/components/about-support/content/aboutSupport.js
+++ b/mail/components/about-support/content/aboutSupport.js
@@ -8,21 +8,21 @@
 /* globals AboutSupportPlatform, populateAccountsSection, sendViaEmail
     populateCalendarsSection, populateChatSection */
 
 "use strict";
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
-var { Troubleshoot } = ChromeUtils.import(
-  "resource://gre/modules/Troubleshoot.jsm"
+var { Troubleshoot } = ChromeUtils.importESModule(
+  "resource://gre/modules/Troubleshoot.sys.mjs"
 );
-var { ResetProfile } = ChromeUtils.import(
-  "resource://gre/modules/ResetProfile.jsm"
+var { ResetProfile } = ChromeUtils.importESModule(
+  "resource://gre/modules/ResetProfile.sys.mjs"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
 ChromeUtils.defineModuleGetter(
   this,
   "DownloadUtils",
@@ -31,22 +31,18 @@ ChromeUtils.defineModuleGetter(
 
 ChromeUtils.defineModuleGetter(
   this,
   "PluralForm",
   "resource://gre/modules/PluralForm.jsm"
 );
 ChromeUtils.defineESModuleGetters(this, {
   PlacesDBUtils: "resource://gre/modules/PlacesDBUtils.sys.mjs",
+  ProcessType: "resource://gre/modules/ProcessType.sys.mjs",
 });
-ChromeUtils.defineModuleGetter(
-  this,
-  "ProcessType",
-  "resource://gre/modules/ProcessType.jsm"
-);
 
 // added for TB
 /* Node classes. All of these are mutually exclusive. */
 
 // Any nodes marked with this class will be considered part of the UI only,
 // and therefore will not be copied.
 var CLASS_DATA_UIONLY = "data-uionly";
 
--- a/mail/components/addrbook/content/aboutAddressBook.js
+++ b/mail/components/addrbook/content/aboutAddressBook.js
@@ -18,34 +18,38 @@ var { XPCOMUtils } = ChromeUtils.import(
 );
 
 XPCOMUtils.defineLazyGetter(this, "ABQueryUtils", function() {
   return ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
 });
 XPCOMUtils.defineLazyGetter(this, "AddrBookUtils", function() {
   return ChromeUtils.import("resource:///modules/AddrBookUtils.jsm");
 });
+
+ChromeUtils.defineESModuleGetters(this, {
+  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(this, {
   AddrBookCard: "resource:///modules/AddrBookCard.jsm",
   AddrBookUtils: "resource:///modules/AddrBookUtils.jsm",
   cal: "resource:///modules/calendar/calUtils.jsm",
   CalAttendee: "resource:///modules/CalAttendee.jsm",
   CalMetronome: "resource:///modules/CalMetronome.jsm",
   CardDAVDirectory: "resource:///modules/CardDAVDirectory.jsm",
-  FileUtils: "resource://gre/modules/FileUtils.jsm",
   GlodaMsgSearcher: "resource:///modules/gloda/GlodaMsgSearcher.jsm",
   ICAL: "resource:///modules/calendar/Ical.jsm",
   MailE10SUtils: "resource:///modules/MailE10SUtils.jsm",
   PluralForm: "resource://gre/modules/PluralForm.jsm",
   VCardProperties: "resource:///modules/VCardUtils.jsm",
   VCardPropertyEntry: "resource:///modules/VCardUtils.jsm",
 });
 XPCOMUtils.defineLazyGetter(this, "SubDialog", function() {
-  const { SubDialogManager } = ChromeUtils.import(
-    "resource://gre/modules/SubDialog.jsm"
+  const { SubDialogManager } = ChromeUtils.importESModule(
+    "resource://gre/modules/SubDialog.sys.mjs"
   );
   return new SubDialogManager({
     dialogStack: document.getElementById("dialogStack"),
     dialogTemplate: document.getElementById("dialogTemplate"),
     dialogOptions: {
       styleSheets: [
         "chrome://messenger/skin/preferences/dialog.css",
         "chrome://messenger/skin/shared/preferences/subdialog.css",
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -40,23 +40,26 @@ var { PluralForm } = ChromeUtils.import(
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 var { ExtensionParent } = ChromeUtils.import(
   "resource://gre/modules/ExtensionParent.jsm"
 );
 
+ChromeUtils.defineESModuleGetters(this, {
+  SelectionUtils: "resource://gre/modules/SelectionUtils.sys.mjs",
+  ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(this, {
   FolderUtils: "resource:///modules/FolderUtils.jsm",
   MailUtils: "resource:///modules/MailUtils.jsm",
   EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.jsm",
   BondOpenPGP: "chrome://openpgp/content/BondOpenPGP.jsm",
-  SelectionUtils: "resource://gre/modules/SelectionUtils.jsm",
-  ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
   UIFontSize: "resource:///modules/UIFontSize.jsm",
   UIDensity: "resource:///modules/UIDensity.jsm",
 });
 
 XPCOMUtils.defineLazyGetter(
   this,
   "l10nCompose",
   () =>
--- a/mail/components/compose/content/dialogs/EdSpellCheck.js
+++ b/mail/components/compose/content/dialogs/EdSpellCheck.js
@@ -1,18 +1,18 @@
 /* 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-globals-from ../../../../base/content/utilityOverlay.js */
 /* import-globals-from ../editorUtilities.js */
 /* import-globals-from EdDialogCommon.js */
 
-var { InlineSpellChecker } = ChromeUtils.import(
-  "resource://gre/modules/InlineSpellChecker.jsm"
+var { InlineSpellChecker } = ChromeUtils.importESModule(
+  "resource://gre/modules/InlineSpellChecker.sys.mjs"
 );
 
 var gMisspelledWord;
 var gSpellChecker = null;
 var gAllowSelectWord = true;
 var gPreviousReplaceWord = "";
 var gFirstTime = true;
 var gDictCount = 0;
--- a/mail/components/customizableui/CustomizableUI.jsm
+++ b/mail/components/customizableui/CustomizableUI.jsm
@@ -9,25 +9,28 @@ const { XPCOMUtils } = ChromeUtils.impor
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
 const lazy = {};
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   AddonManager: "resource://gre/modules/AddonManager.jsm",
   AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
   SearchWidgetTracker: "resource:///modules/SearchWidgetTracker.jsm",
   CustomizableWidgets: "resource:///modules/CustomizableWidgets.jsm",
   DeferredTask: "resource://gre/modules/DeferredTask.jsm",
   PanelMultiView: "resource:///modules/PanelMultiView.jsm",
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
-  ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
 });
 
 XPCOMUtils.defineLazyGetter(lazy, "gWidgetsBundle", function() {
   const kUrl =
     "chrome://browser/locale/customizableui/customizableWidgets.properties";
   return Services.strings.createBundle(kUrl);
 });
 
--- a/mail/components/customizableui/CustomizableWidgets.jsm
+++ b/mail/components/customizableui/CustomizableWidgets.jsm
@@ -13,20 +13,24 @@ const { XPCOMUtils } = ChromeUtils.impor
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
 const lazy = {};
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   RecentlyClosedTabsAndWindowsMenuUtils:
     "resource:///modules/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm",
-  ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
+
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
 });
 
 const kPrefCustomizationDebug = "browser.uiCustomization.debug";
 
 XPCOMUtils.defineLazyGetter(lazy, "log", () => {
   var { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
   let debug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false);
--- a/mail/components/customizableui/content/panelUI.js
+++ b/mail/components/customizableui/content/panelUI.js
@@ -20,32 +20,30 @@ var { CustomizableUI } = ChromeUtils.imp
   "resource:///modules/CustomizableUI.jsm"
 );
 var { ExtensionParent } = ChromeUtils.import(
   "resource://gre/modules/ExtensionParent.jsm"
 );
 var { ExtensionSupport } = ChromeUtils.import(
   "resource:///modules/ExtensionSupport.jsm"
 );
-var { ShortcutUtils } = ChromeUtils.import(
-  "resource://gre/modules/ShortcutUtils.jsm"
+var { ShortcutUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/ShortcutUtils.sys.mjs"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 var { UIDensity } = ChromeUtils.import("resource:///modules/UIDensity.jsm");
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "AppMenuNotifications",
-  "resource://gre/modules/AppMenuNotifications.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.sys.mjs",
+});
 ChromeUtils.defineModuleGetter(
   this,
   "ExtensionsUI",
   "resource:///modules/ExtensionsUI.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "PanelMultiView",
--- a/mail/components/enterprisepolicies/Policies.sys.mjs
+++ b/mail/components/enterprisepolicies/Policies.sys.mjs
@@ -19,22 +19,22 @@ XPCOMUtils.defineLazyServiceGetters(lazy
   gHandlerService: [
     "@mozilla.org/uriloader/handler-service;1",
     "nsIHandlerService",
   ],
   gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
 });
 
 ChromeUtils.defineESModuleGetters(lazy, {
+  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
   ProxyPolicies: "resource:///modules/policies/ProxyPolicies.sys.mjs",
 });
 
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   AddonManager: "resource://gre/modules/AddonManager.jsm",
-  FileUtils: "resource://gre/modules/FileUtils.jsm",
 });
 
 const PREF_LOGLEVEL = "browser.policies.loglevel";
 const ABOUT_CONTRACT = "@mozilla.org/network/protocol/about;1?what=";
 
 let env = Cc["@mozilla.org/process/environment;1"].getService(
   Ci.nsIEnvironment
 );
--- a/mail/components/enterprisepolicies/tests/browser/browser_policy_app_auto_update.js
+++ b/mail/components/enterprisepolicies/tests/browser/browser_policy_app_auto_update.js
@@ -1,17 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
-ChromeUtils.defineModuleGetter(
-  this,
-  "UpdateUtils",
-  "resource://gre/modules/UpdateUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
+});
 
 async function test_app_update_auto(expectedEnabled, expectedLocked) {
   let actualEnabled = await UpdateUtils.getAppUpdateAutoEnabled();
   is(
     actualEnabled,
     expectedEnabled,
     `Actual auto update enabled setting should match the expected value of ${expectedEnabled}`
   );
--- a/mail/components/enterprisepolicies/tests/browser/browser_policy_app_update.js
+++ b/mail/components/enterprisepolicies/tests/browser/browser_policy_app_update.js
@@ -1,17 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
-ChromeUtils.defineModuleGetter(
-  this,
-  "UpdateUtils",
-  "resource://gre/modules/UpdateUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
+});
 var updateService = Cc["@mozilla.org/updates/update-service;1"].getService(
   Ci.nsIApplicationUpdateService
 );
 
 // This test is intended to ensure that nsIUpdateService::canCheckForUpdates
 // is true before the "DisableAppUpdate" policy is applied. Testing that
 // nsIUpdateService::canCheckForUpdates is false after the "DisableAppUpdate"
 // policy is applied needs to occur in a different test since the policy does
--- a/mail/components/enterprisepolicies/tests/browser/browser_policy_background_app_update.js
+++ b/mail/components/enterprisepolicies/tests/browser/browser_policy_background_app_update.js
@@ -1,17 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "UpdateUtils",
-  "resource://gre/modules/UpdateUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
+});
 
 const PREF_NAME = "app.update.background.enabled";
 
 async function test_background_update_pref(expectedEnabled, expectedLocked) {
   let actualEnabled = await UpdateUtils.readUpdateConfigSetting(PREF_NAME);
   is(
     actualEnabled,
     expectedEnabled,
--- a/mail/components/enterprisepolicies/tests/browser/browser_policy_downloads.js
+++ b/mail/components/enterprisepolicies/tests/browser/browser_policy_downloads.js
@@ -1,18 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "FileUtils",
-  "resource://gre/modules/FileUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
+});
 
 add_task(async function test_defaultdownload() {
   await setupPolicyEngineWithJson({
     policies: {
       DefaultDownloadDirectory: "${home}/Downloads",
       PromptForDownloadLocation: false,
     },
   });
--- a/mail/components/enterprisepolicies/tests/xpcshell/test_macosparser_unflatten.js
+++ b/mail/components/enterprisepolicies/tests/xpcshell/test_macosparser_unflatten.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-let { macOSPoliciesParser } = ChromeUtils.import(
-  "resource://gre/modules/policies/macOSPoliciesParser.jsm"
+let { macOSPoliciesParser } = ChromeUtils.importESModule(
+  "resource://gre/modules/policies/macOSPoliciesParser.sys.mjs"
 );
 
 add_task(async function test_object_unflatten() {
   // Note: these policies are just examples and they won't actually
   // run through the policy engine on this test. We're just testing
   // that the unflattening algorithm produces the correct output.
   let input = {
     DisplayBookmarksToolbar: true,
--- a/mail/components/extensions/extensionPopup.js
+++ b/mail/components/extensions/extensionPopup.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
-var { BrowserUtils } = ChromeUtils.import(
-  "resource://gre/modules/BrowserUtils.jsm"
+var { BrowserUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/BrowserUtils.sys.mjs"
 );
 var { ExtensionParent } = ChromeUtils.import(
   "resource://gre/modules/ExtensionParent.jsm"
 );
 var { MailE10SUtils } = ChromeUtils.import(
   "resource:///modules/MailE10SUtils.jsm"
 );
 
--- a/mail/components/extensions/parent/ext-menus.js
+++ b/mail/components/extensions/parent/ext-menus.js
@@ -10,18 +10,18 @@ ChromeUtils.defineModuleGetter(
   this,
   "MailServices",
   "resource:///modules/MailServices.jsm"
 );
 
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
-var { SelectionUtils } = ChromeUtils.import(
-  "resource://gre/modules/SelectionUtils.jsm"
+var { SelectionUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/SelectionUtils.sys.mjs"
 );
 
 var { DefaultMap, ExtensionError } = ExtensionUtils;
 
 var { ExtensionParent } = ChromeUtils.import(
   "resource://gre/modules/ExtensionParent.jsm"
 );
 var { IconDetails } = ExtensionParent;
--- a/mail/components/extensions/parent/ext-tabs.js
+++ b/mail/components/extensions/parent/ext-tabs.js
@@ -1,17 +1,15 @@
 /* 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/. */
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "PromiseUtils",
-  "resource://gre/modules/PromiseUtils.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
+});
 ChromeUtils.defineModuleGetter(
   this,
   "MailE10SUtils",
   "resource:///modules/MailE10SUtils.jsm"
 );
 
 var { ExtensionError } = ExtensionUtils;
 
--- a/mail/components/extensions/test/xpcshell/test_ext_messages_get.js
+++ b/mail/components/extensions/test/xpcshell/test_ext_messages_get.js
@@ -1,15 +1,17 @@
 /* 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/. */
 
 "use strict";
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { ExtensionTestUtils } = ChromeUtils.import(
   "resource://testing-common/ExtensionXPCShellUtils.jsm"
 );
 var { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
 
 const OPENPGP_TEST_DIR = do_get_file("../../../../test/browser/openpgp");
--- a/mail/components/extensions/test/xpcshell/test_ext_messages_import.js
+++ b/mail/components/extensions/test/xpcshell/test_ext_messages_import.js
@@ -2,17 +2,19 @@
  * 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/. */
 
 "use strict";
 
 var { ExtensionTestUtils } = ChromeUtils.import(
   "resource://testing-common/ExtensionXPCShellUtils.jsm"
 );
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { MailStringUtils } = ChromeUtils.import(
   "resource:///modules/MailStringUtils.jsm"
 );
 
 add_task(async function test_import() {
   let _account = createAccount();
   await createSubfolder(_account.incomingServer.rootFolder, "test1");
   await createSubfolder(_account.incomingServer.rootFolder, "test2");
--- a/mail/components/im/content/chat-conversation.js
+++ b/mail/components/im/content/chat-conversation.js
@@ -15,18 +15,18 @@
     "resource:///modules/imStatusUtils.jsm"
   );
   const { TextboxSize } = ChromeUtils.import(
     "resource:///modules/imTextboxUtils.jsm"
   );
   const { AppConstants } = ChromeUtils.import(
     "resource://gre/modules/AppConstants.jsm"
   );
-  const { InlineSpellChecker } = ChromeUtils.import(
-    "resource://gre/modules/InlineSpellChecker.jsm"
+  const { InlineSpellChecker } = ChromeUtils.importESModule(
+    "resource://gre/modules/InlineSpellChecker.sys.mjs"
   );
 
   /**
    * The MozChatConversation widget displays the entire chat conversation
    * including status notifications
    *
    * @extends {MozXULElement}
    */
--- a/mail/components/im/content/chat-messenger.js
+++ b/mail/components/im/content/chat-messenger.js
@@ -11,18 +11,18 @@
 
 var { Notifications } = ChromeUtils.import(
   "resource:///modules/chatNotifications.jsm"
 );
 var { IMServices } = ChromeUtils.import("resource:///modules/IMServices.jsm");
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
-var { InlineSpellChecker } = ChromeUtils.import(
-  "resource://gre/modules/InlineSpellChecker.jsm"
+var { InlineSpellChecker } = ChromeUtils.importESModule(
+  "resource://gre/modules/InlineSpellChecker.sys.mjs"
 );
 
 ChromeUtils.defineModuleGetter(this, "OTRUI", "resource:///modules/OTRUI.jsm");
 ChromeUtils.defineModuleGetter(
   this,
   "ChatEncryption",
   "resource:///modules/ChatEncryption.jsm"
 );
--- a/mail/components/im/modules/index_im.jsm
+++ b/mail/components/im/modules/index_im.jsm
@@ -17,18 +17,18 @@ const { GlodaConstants } = ChromeUtils.i
 );
 const { GlodaIndexer, IndexingJob } = ChromeUtils.import(
   "resource:///modules/gloda/GlodaIndexer.jsm"
 );
 const { IMServices } = ChromeUtils.import("resource:///modules/IMServices.jsm");
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { clearTimeout, setTimeout } = ChromeUtils.import(
   "resource://gre/modules/Timer.jsm"
 );
 
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -2,18 +2,18 @@
  * 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/. */
 
 "use strict";
 
 /* import-globals-from preferences.js */
 
-var { InlineSpellChecker } = ChromeUtils.import(
-  "resource://gre/modules/InlineSpellChecker.jsm"
+var { InlineSpellChecker } = ChromeUtils.importESModule(
+  "resource://gre/modules/InlineSpellChecker.sys.mjs"
 );
 
 // CloudFile account tools used by gCloudFile.
 var { cloudFileAccounts } = ChromeUtils.import(
   "resource:///modules/cloudFileAccounts.jsm"
 );
 var { E10SUtils } = ChromeUtils.import("resource://gre/modules/E10SUtils.jsm");
 var { ExtensionParent } = ChromeUtils.import(
--- a/mail/components/preferences/downloads.js
+++ b/mail/components/preferences/downloads.js
@@ -1,16 +1,18 @@
 /* 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-globals-from preferences.js */
 
 var { Downloads } = ChromeUtils.import("resource://gre/modules/Downloads.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 
 Preferences.addAll([
   { id: "browser.download.useDownloadDir", type: "bool" },
   { id: "browser.download.folderList", type: "int" },
   { id: "browser.download.downloadDir", type: "file" },
   { id: "browser.download.dir", type: "file" },
   { id: "pref.downloads.disable_button.edit_actions", type: "bool" },
 ]);
--- a/mail/components/preferences/general.js
+++ b/mail/components/preferences/general.js
@@ -16,18 +16,18 @@ var { DownloadUtils } = ChromeUtils.impo
   "resource://gre/modules/DownloadUtils.jsm"
 );
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
-var { UpdateUtils } = ChromeUtils.import(
-  "resource://gre/modules/UpdateUtils.jsm"
+var { UpdateUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/UpdateUtils.sys.mjs"
 );
 var { TagUtils } = ChromeUtils.import("resource:///modules/TagUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetters(this, {
   gHandlerService: [
     "@mozilla.org/uriloader/handler-service;1",
     "nsIHandlerService",
   ],
--- a/mail/components/preferences/passwordManager.js
+++ b/mail/components/preferences/passwordManager.js
@@ -14,23 +14,19 @@ var { XPCOMUtils } = ChromeUtils.import(
 );
 
 ChromeUtils.defineModuleGetter(
   this,
   "DeferredTask",
   "resource://gre/modules/DeferredTask.jsm"
 );
 ChromeUtils.defineESModuleGetters(this, {
+  OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
   PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
 });
-ChromeUtils.defineModuleGetter(
-  this,
-  "OSKeyStore",
-  "resource://gre/modules/OSKeyStore.jsm"
-);
 
 // Default value for signon table sorting
 let lastSignonSortColumn = "origin";
 let lastSignonSortAscending = true;
 
 let showingPasswords = false;
 
 // password-manager lists
--- a/mail/components/preferences/preferences.js
+++ b/mail/components/preferences/preferences.js
@@ -31,18 +31,18 @@ var defaultPane = "paneGeneral";
 
 ChromeUtils.defineModuleGetter(
   this,
   "AddonManager",
   "resource://gre/modules/AddonManager.jsm"
 );
 
 XPCOMUtils.defineLazyGetter(this, "gSubDialog", function() {
-  const { SubDialogManager } = ChromeUtils.import(
-    "resource://gre/modules/SubDialog.jsm"
+  const { SubDialogManager } = ChromeUtils.importESModule(
+    "resource://gre/modules/SubDialog.sys.mjs"
   );
   return new SubDialogManager({
     dialogStack: document.getElementById("dialogStack"),
     dialogTemplate: document.getElementById("dialogTemplate"),
     dialogOptions: {
       styleSheets: [
         "chrome://messenger/skin/preferences/dialog.css",
         "chrome://messenger/skin/preferences/preferences.css",
--- a/mail/components/preferences/privacy.js
+++ b/mail/components/preferences/privacy.js
@@ -11,21 +11,19 @@ var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
 ChromeUtils.defineModuleGetter(
   this,
   "LoginHelper",
   "resource://gre/modules/LoginHelper.jsm"
 );
-ChromeUtils.defineModuleGetter(
-  this,
-  "OSKeyStore",
-  "resource://gre/modules/OSKeyStore.jsm"
-);
+ChromeUtils.defineESModuleGetters(this, {
+  OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
+});
 
 const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
 
 Preferences.addAll([
   { id: "mail.spam.manualMark", type: "bool" },
   { id: "mail.spam.manualMarkMode", type: "int" },
   { id: "mail.spam.markAsReadOnSpam", type: "bool" },
   { id: "mail.spam.logging.enabled", type: "bool" },
--- a/mail/extensions/openpgp/content/modules/sqliteDb.jsm
+++ b/mail/extensions/openpgp/content/modules/sqliteDb.jsm
@@ -11,21 +11,24 @@
 const EXPORTED_SYMBOLS = ["PgpSqliteDb2"];
 
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
 const lazy = {};
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   EnigmailLog: "chrome://openpgp/content/modules/log.jsm",
   EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.jsm",
   setTimeout: "resource://gre/modules/Timer.jsm",
-  Sqlite: "resource://gre/modules/Sqlite.jsm",
 });
 
 var PgpSqliteDb2 = {
   openDatabase() {
     lazy.EnigmailLog.DEBUG("sqliteDb.jsm: PgpSqliteDb2 openDatabase()\n");
     return new Promise((resolve, reject) => {
       openDatabaseConn(
         "openpgp.sqlite",
--- a/mail/extensions/openpgp/test/unit/rnp/test_secretKeys.js
+++ b/mail/extensions/openpgp/test/unit/rnp/test_secretKeys.js
@@ -13,18 +13,18 @@ const { OpenPGPMasterpass } = ChromeUtil
   "chrome://openpgp/content/modules/masterpass.jsm"
 );
 const { EnigmailConstants } = ChromeUtils.import(
   "chrome://openpgp/content/modules/constants.jsm"
 );
 const { EnigmailKeyRing } = ChromeUtils.import(
   "chrome://openpgp/content/modules/keyRing.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
 
 const keyDir = "../../../../../test/browser/openpgp/data/keys";
 
 /**
--- a/mail/modules/ExtensionsUI.jsm
+++ b/mail/modules/ExtensionsUI.jsm
@@ -9,21 +9,24 @@ const { XPCOMUtils } = ChromeUtils.impor
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { EventEmitter } = ChromeUtils.import(
   "resource://gre/modules/EventEmitter.jsm"
 );
 
 const lazy = {};
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   AddonManager: "resource://gre/modules/AddonManager.jsm",
   AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
   AMTelemetry: "resource://gre/modules/AddonManager.jsm",
-  AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm",
   ExtensionData: "resource://gre/modules/Extension.jsm",
   ExtensionParent: "resource://gre/modules/ExtensionParent.jsm",
   PluralForm: "resource://gre/modules/PluralForm.jsm",
   setTimeout: "resource://gre/modules/Timer.jsm",
 });
 
 const ADDONS_PROPERTIES = "chrome://messenger/locale/addons.properties";
 
--- a/mail/modules/GlobalPopupNotifications.jsm
+++ b/mail/modules/GlobalPopupNotifications.jsm
@@ -1,18 +1,18 @@
 /* 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/. */
 
 /** This file is a semi-fork of PopupNotifications.jsm */
 
 var EXPORTED_SYMBOLS = ["PopupNotifications"];
 
-const { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+const { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 const NOTIFICATION_EVENT_DISMISSED = "dismissed";
 const NOTIFICATION_EVENT_REMOVED = "removed";
 const NOTIFICATION_EVENT_SHOWING = "showing";
 const NOTIFICATION_EVENT_SHOWN = "shown";
 const NOTIFICATION_EVENT_SWAPPING = "swapping";
 
--- a/mail/modules/SessionStoreManager.jsm
+++ b/mail/modules/SessionStoreManager.jsm
@@ -1,15 +1,17 @@
 /* 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/. */
 
 const EXPORTED_SYMBOLS = ["SessionStoreManager"];
 
-const { JSONFile } = ChromeUtils.import("resource://gre/modules/JSONFile.jsm");
+const { JSONFile } = ChromeUtils.importESModule(
+  "resource://gre/modules/JSONFile.sys.mjs"
+);
 
 /**
  * asuth arbitrarily chose this value to trade-off powersaving,
  * processor usage, and recency of state in the face of the impossibility of
  * our crashing; he also worded this.
  */
 var SESSION_AUTO_SAVE_DEFAULT_MS = 300000; // 5 minutes
 
--- a/mail/modules/TagUtils.jsm
+++ b/mail/modules/TagUtils.jsm
@@ -3,21 +3,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const lazy = {};
 
-ChromeUtils.defineModuleGetter(
-  lazy,
-  "Color",
-  "resource://gre/modules/Color.jsm"
-);
+ChromeUtils.defineESModuleGetters(lazy, {
+  Color: "resource://gre/modules/Color.sys.mjs",
+});
 
 var EXPORTED_SYMBOLS = ["TagUtils"];
 
 var TagUtils = {
   loadTagsIntoCSS,
   addTagToAllDocumentSheets,
   isColorContrastEnough,
 };
--- a/mail/test/browser/account/browser_accountTelemetry.js
+++ b/mail/test/browser/account/browser_accountTelemetry.js
@@ -1,17 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Test telemetry related to account.
  */
 
 let { FeedUtils } = ChromeUtils.import("resource:///modules/FeedUtils.jsm");
-let { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+let { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 let { IMServices } = ChromeUtils.import("resource:///modules/IMServices.jsm");
 let { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 let { MailTelemetryForTests } = ChromeUtils.import(
   "resource:///modules/MailGlue.jsm"
 );
 
--- a/mail/test/browser/openpgp/browser_collectKeys.js
+++ b/mail/test/browser/openpgp/browser_collectKeys.js
@@ -24,18 +24,18 @@ const {
   wait_for_notification_to_stop,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
 
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const { CollectedKeysDB } = ChromeUtils.import(
   "chrome://openpgp/content/modules/CollectedKeysDB.jsm"
 );
--- a/mail/test/browser/openpgp/browser_editDraftTemplate.js
+++ b/mail/test/browser/openpgp/browser_editDraftTemplate.js
@@ -23,17 +23,19 @@ var {
   mc,
   select_click_row,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
 );
 var { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 let aliceAcct;
 let aliceIdentity;
 let draftsFolder;
 let templatesFolder;
--- a/mail/test/browser/openpgp/browser_openPGPDrafts.js
+++ b/mail/test/browser/openpgp/browser_openPGPDrafts.js
@@ -17,18 +17,18 @@ const {
   "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
 );
 const { close_window } = ChromeUtils.import(
   "resource://testing-common/mozmill/WindowHelpers.jsm"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 function waitForComposeWindow() {
   return BrowserTestUtils.domWindowOpened(null, async win => {
     await BrowserTestUtils.waitForEvent(win, "load");
--- a/mail/test/browser/openpgp/browser_perm_decrypt.js
+++ b/mail/test/browser/openpgp/browser_perm_decrypt.js
@@ -17,18 +17,18 @@ const {
   "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
 const { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 const { EnigmailPersistentCrypto } = ChromeUtils.import(
   "chrome://openpgp/content/modules/persistentCrypto.jsm"
 );
 var { AppConstants } = ChromeUtils.import(
--- a/mail/test/browser/openpgp/browser_viewMessage.js
+++ b/mail/test/browser/openpgp/browser_viewMessage.js
@@ -27,18 +27,18 @@ const {
   wait_for_notification_to_show,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
 
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const MSG_TEXT = "Sundays are nothing without callaloo.";
 
 function getMsgBodyTxt(mc) {
--- a/mail/test/browser/openpgp/browser_viewMessageSecurity.js
+++ b/mail/test/browser/openpgp/browser_viewMessageSecurity.js
@@ -30,18 +30,18 @@ const {
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
 const { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
--- a/mail/test/browser/openpgp/browser_viewPartialMessage.js
+++ b/mail/test/browser/openpgp/browser_viewPartialMessage.js
@@ -22,18 +22,18 @@ const {
   wait_for_notification_to_show,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
 
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const MSG_TEXT = "Sundays are nothing without callaloo.";
 
 function getMsgBodyTxt(mc) {
--- a/mail/test/browser/openpgp/composition/browser_composeEncrypted.js
+++ b/mail/test/browser/openpgp/composition/browser_composeEncrypted.js
@@ -20,18 +20,18 @@ const { open_compose_new_mail, setup_msg
   "resource://testing-common/mozmill/ComposeHelpers.jsm"
 );
 const { close_window } = ChromeUtils.import(
   "resource://testing-common/mozmill/WindowHelpers.jsm"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 let bobAcct;
 let bobIdentity;
 let gOutbox;
--- a/mail/test/browser/openpgp/composition/browser_composeSigned.js
+++ b/mail/test/browser/openpgp/composition/browser_composeSigned.js
@@ -17,18 +17,18 @@ const {
   "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
 );
 const { open_compose_new_mail, setup_msg_contents } = ChromeUtils.import(
   "resource://testing-common/mozmill/ComposeHelpers.jsm"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 let bobAcct;
 let bobIdentity;
 let initialKeyIdPref = "";
--- a/mail/test/browser/openpgp/composition/browser_composeSwitchIdentity.js
+++ b/mail/test/browser/openpgp/composition/browser_composeSwitchIdentity.js
@@ -20,18 +20,18 @@ const { open_compose_new_mail, setup_msg
   "resource://testing-common/mozmill/ComposeHelpers.jsm"
 );
 const { close_window } = ChromeUtils.import(
   "resource://testing-common/mozmill/WindowHelpers.jsm"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 let bobAcct;
 let bobIdentity;
 let plainIdentity;
--- a/mail/test/browser/session-store/browser_sessionStore.js
+++ b/mail/test/browser/session-store/browser_sessionStore.js
@@ -40,17 +40,19 @@ var {
 var {
   close_window,
   plan_for_new_window,
   plan_for_window_close,
   wait_for_new_window,
   wait_for_window_close,
 } = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { SessionStoreManager } = ChromeUtils.import(
   "resource:///modules/SessionStoreManager.jsm"
 );
 
 var folderA, folderB;
 
 // Default JSONFile save delay with saveSoon().
 var kSaveDelayMs = 1500;
--- a/mail/test/browser/smime/browser_multipartAlternative.js
+++ b/mail/test/browser/smime/browser_multipartAlternative.js
@@ -26,17 +26,19 @@ var {
   smimeUtils_loadPEMCertificate,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
 );
 var { close_window } = ChromeUtils.import(
   "resource://testing-common/mozmill/WindowHelpers.jsm"
 );
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var gDrafts;
 
 add_setup(async function() {
   gDrafts = await get_special_folder(Ci.nsMsgFolderFlags.Drafts, true);
--- a/mail/test/static/browser_parsable_css.js
+++ b/mail/test/static/browser_parsable_css.js
@@ -401,18 +401,18 @@ add_task(async function checkAllTheCSS()
   // This asynchronously produces a list of URLs (sadly, mostly sync on our
   // test infrastructure because it runs against jarfiles there, and
   // our zipreader APIs are all sync)
   let uris = await generateURIsFromDirTree(appDir, [".css", ".manifest"]);
 
   // Create a clean iframe to load all the files into. This needs to live at a
   // chrome URI so that it's allowed to load and parse any styles.
   let testFile = getRootDirectory(gTestPath) + "dummy_page.html";
-  let { HiddenFrame } = ChromeUtils.import(
-    "resource://gre/modules/HiddenFrame.jsm"
+  let { HiddenFrame } = ChromeUtils.importESModule(
+    "resource://gre/modules/HiddenFrame.sys.mjs"
   );
   let hiddenFrame = new HiddenFrame();
   let win = await hiddenFrame.get();
   let iframe = win.document.createElementNS(
     "http://www.w3.org/1999/xhtml",
     "html:iframe"
   );
   win.document.documentElement.appendChild(iframe);
--- a/mail/themes/Windows8WindowFrameColor.jsm
+++ b/mail/themes/Windows8WindowFrameColor.jsm
@@ -1,18 +1,18 @@
 /* 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/. */
 
 "use strict";
 
 const EXPORTED_SYMBOLS = ["Windows8WindowFrameColor"];
 
-const { WindowsRegistry } = ChromeUtils.import(
-  "resource://gre/modules/WindowsRegistry.jsm"
+const { WindowsRegistry } = ChromeUtils.importESModule(
+  "resource://gre/modules/WindowsRegistry.sys.mjs"
 );
 
 var Windows8WindowFrameColor = {
   _windowFrameColor: null,
 
   get() {
     if (this._windowFrameColor) {
       return this._windowFrameColor;
--- a/mailnews/addrbook/modules/LDAPDirectory.jsm
+++ b/mailnews/addrbook/modules/LDAPDirectory.jsm
@@ -11,18 +11,21 @@ const { XPCOMUtils } = ChromeUtils.impor
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const lazy = {};
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
-  FileUtils: "resource://gre/modules/FileUtils.jsm",
   QueryStringToExpression: "resource:///modules/QueryStringToExpression.jsm",
 });
 
 /**
  * @implements {nsIAbLDAPDirectory}
  * @implements {nsIAbDirectory}
  */
 
--- a/mailnews/addrbook/modules/SQLiteDirectory.jsm
+++ b/mailnews/addrbook/modules/SQLiteDirectory.jsm
@@ -12,18 +12,21 @@ const { XPCOMUtils } = ChromeUtils.impor
 );
 
 const lazy = {};
 
 const { AsyncShutdown } = ChromeUtils.import(
   "resource://gre/modules/AsyncShutdown.jsm"
 );
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
-  FileUtils: "resource://gre/modules/FileUtils.jsm",
   newUID: "resource:///modules/AddrBookUtils.jsm",
 });
 
 var log = console.createInstance({
   prefix: "mail.addr_book",
   maxLogLevel: "Warn",
   maxLogLevelPref: "mail.addr_book.loglevel",
 });
--- a/mailnews/base/prefs/content/AccountManager.js
+++ b/mailnews/base/prefs/content/AccountManager.js
@@ -46,18 +46,18 @@ ChromeUtils.defineModuleGetter(
   "resource:///modules/FolderUtils.jsm"
 );
 var { cleanUpHostName, isLegalHostNameOrIP } = ChromeUtils.import(
   "resource:///modules/hostnameUtils.jsm"
 );
 var { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "gSubDialog", function() {
-  const { SubDialogManager } = ChromeUtils.import(
-    "resource://gre/modules/SubDialog.jsm"
+  const { SubDialogManager } = ChromeUtils.importESModule(
+    "resource://gre/modules/SubDialog.sys.mjs"
   );
   return new SubDialogManager({
     dialogStack: document.getElementById("dialogStack"),
     dialogTemplate: document.getElementById("dialogTemplate"),
     dialogOptions: {
       styleSheets: [
         "chrome://messenger/skin/preferences/dialog.css",
         "chrome://messenger/skin/preferences/preferences.css",
--- a/mailnews/base/prefs/content/converterDialog.js
+++ b/mailnews/base/prefs/content/converterDialog.js
@@ -3,17 +3,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This file contains functionality for the front-end part of the mail store
  * type conversion.
  */
 
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 ChromeUtils.defineModuleGetter(
   this,
   "FolderUtils",
   "resource:///modules/FolderUtils.jsm"
 );
 var MailstoreConverter = ChromeUtils.import(
   "resource:///modules/mailstoreConverter.jsm"
 );
--- a/mailnews/base/src/mailstoreConverter.jsm
+++ b/mailnews/base/src/mailstoreConverter.jsm
@@ -1,16 +1,16 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["convertMailStoreTo", "terminateWorkers"];
 
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 
 let log = console.createInstance({
   prefix: "mail.mailstoreconverter",
   maxLogLevel: "Warn",
   maxLogLevelPref: "mail.mailstoreconverter.loglevel",
 });
 
--- a/mailnews/base/test/unit/test_converterDeferredAccount.js
+++ b/mailnews/base/test/unit/test_converterDeferredAccount.js
@@ -1,14 +1,14 @@
 /* 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/. */
 
-const { FileUtils } = ChromeUtils.import(
-  "resource://gre/modules/FileUtils.jsm"
+const { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
 );
 const { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
 var { convertMailStoreTo } = ChromeUtils.import(
   "resource:///modules/mailstoreConverter.jsm"
 );
 const { FolderUtils } = ChromeUtils.import(
--- a/mailnews/base/test/unit/test_junkingWhenDisabled.js
+++ b/mailnews/base/test/unit/test_junkingWhenDisabled.js
@@ -15,18 +15,18 @@ var { MailServices } = ChromeUtils.impor
   "resource:///modules/MailServices.jsm"
 );
 var { MessageGenerator, SyntheticMessageSet } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageGenerator.jsm"
 );
 var { MessageInjection } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageInjection.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 var nsIMFNService = Ci.nsIMsgFolderNotificationService;
 
 // fake objects needed to get nsMsgDBView to operate on selected messages.
 // Warning: these are partial implementations. If someone adds additional
 // calls to these objects in nsMsgDBView and friends, it will also
 // be necessary to add fake versions of those calls here.
--- a/mailnews/base/test/unit/test_nsMsgDBView.js
+++ b/mailnews/base/test/unit/test_nsMsgDBView.js
@@ -21,18 +21,18 @@ var {
   "resource://testing-common/mailnews/MessageGenerator.jsm"
 );
 const { JSTreeSelection } = ChromeUtils.import(
   "resource:///modules/JsTreeSelection.jsm"
 );
 var { MessageInjection } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageInjection.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 // Items used to add messages to the folder
 var gMessageGenerator = new MessageGenerator();
 var gScenarioFactory = new MessageScenarioFactory(gMessageGenerator);
 var messageInjection = new MessageInjection({ mode: "local" });
 
 var gTestFolder;
--- a/mailnews/compose/test/unit/test_sendMessageLater2.js
+++ b/mailnews/compose/test/unit/test_sendMessageLater2.js
@@ -16,18 +16,18 @@
  */
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 var server = null;
 var smtpServer;
 var gSentFolder;
 var identity = null;
 var gMsgFile = [
   do_get_file("data/message1.eml"),
--- a/mailnews/db/gloda/test/unit/test_smime_mimemsg_representation.js
+++ b/mailnews/db/gloda/test/unit/test_smime_mimemsg_representation.js
@@ -2,17 +2,19 @@
  * 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/. */
 
 /*
  * Test that S/MIME messages are properly displayed and that the MimeMessage
  * representation is correct.
  */
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { MessageGenerator, SyntheticMessageSet } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageGenerator.jsm"
 );
 var { MessageInjection } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageInjection.jsm"
 );
 var { MsgHdrToMimeMessage } = ChromeUtils.import(
   "resource:///modules/gloda/MimeMessage.jsm"
--- a/mailnews/extensions/newsblog/FeedUtils.jsm
+++ b/mailnews/extensions/newsblog/FeedUtils.jsm
@@ -9,20 +9,23 @@ const { XPCOMUtils } = ChromeUtils.impor
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 const lazy = {};
 
+ChromeUtils.defineESModuleGetters(lazy, {
+  JSONFile: "resource://gre/modules/JSONFile.sys.mjs",
+});
+
 XPCOMUtils.defineLazyModuleGetters(lazy, {
   Feed: "resource:///modules/Feed.jsm",
   jsmime: "resource:///modules/jsmime.jsm",
-  JSONFile: "resource://gre/modules/JSONFile.jsm",
   MailUtils: "resource:///modules/MailUtils.jsm",
 });
 
 var FeedUtils = {
   MOZ_PARSERERROR_NS: "http://www.mozilla.org/newlayout/xml/parsererror.xml",
 
   RDF_SYNTAX_NS: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
   RDF_SYNTAX_TYPE: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
--- a/mailnews/extensions/newsblog/feed-subscriptions.js
+++ b/mailnews/extensions/newsblog/feed-subscriptions.js
@@ -11,17 +11,19 @@
 var { Feed } = ChromeUtils.import("resource:///modules/Feed.jsm");
 var { FeedUtils } = ChromeUtils.import("resource:///modules/FeedUtils.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { PluralForm } = ChromeUtils.import(
   "resource://gre/modules/PluralForm.jsm"
 );
 
 var FeedSubscriptions = {
   get mMainWin() {
     return Services.wm.getMostRecentWindow("mail:3pane");
   },
--- a/mailnews/imap/test/unit/test_converterImap.js
+++ b/mailnews/imap/test/unit/test_converterImap.js
@@ -6,17 +6,19 @@ var { convertMailStoreTo } = ChromeUtils
   "resource:///modules/mailstoreConverter.jsm"
 );
 
 Services.prefs.setCharPref(
   "mail.serverDefaultStoreContractID",
   "@mozilla.org/msgstore/berkeleystore;1"
 );
 
-var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+var { FileUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/FileUtils.sys.mjs"
+);
 var { MessageGenerator } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageGenerator.jsm"
 );
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
 
 // Globals
--- a/mailnews/mime/test/unit/test_openpgp_decrypt.js
+++ b/mailnews/mime/test/unit/test_openpgp_decrypt.js
@@ -2,18 +2,18 @@
  * 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/. */
 
 /**
  * Tests to ensure signed and/or encrypted OpenPGP messages are
  * processed correctly by mime.
  */
 
-const { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+const { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 const { OpenPGPTestUtils } = ChromeUtils.import(
   "resource://testing-common/mozmill/OpenPGPTestUtils.jsm"
 );
 const { EnigmailSingletons } = ChromeUtils.import(
   "chrome://openpgp/content/modules/singletons.jsm"
 );
 const { EnigmailVerify } = ChromeUtils.import(
--- a/mailnews/mime/test/unit/test_smime_decrypt.js
+++ b/mailnews/mime/test/unit/test_smime_decrypt.js
@@ -9,18 +9,18 @@
  */
 
 var { MessageInjection } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageInjection.jsm"
 );
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 var { SmimeUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/smimeUtils.jsm"
 );
 
 let gCertValidityResult = 0;
 
 /**
--- a/mailnews/mime/test/unit/test_smime_perm_decrypt.js
+++ b/mailnews/mime/test/unit/test_smime_perm_decrypt.js
@@ -9,18 +9,18 @@
  */
 
 var { MessageInjection } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageInjection.jsm"
 );
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 var { SmimeUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/smimeUtils.jsm"
 );
 const { EnigmailPersistentCrypto } = ChromeUtils.import(
   "chrome://openpgp/content/modules/persistentCrypto.jsm"
 );
 var { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
--- a/mailnews/news/test/unit/test_internalUris.js
+++ b/mailnews/news/test/unit/test_internalUris.js
@@ -12,18 +12,18 @@ Cu.importGlobalProperties(["crypto"]);
 load("../../../resources/alertTestUtils.js");
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { PromiseTestUtils } = ChromeUtils.import(
   "resource://testing-common/mailnews/PromiseTestUtils.jsm"
 );
-var { PromiseUtils } = ChromeUtils.import(
-  "resource://gre/modules/PromiseUtils.jsm"
+var { PromiseUtils } = ChromeUtils.importESModule(
+  "resource://gre/modules/PromiseUtils.sys.mjs"
 );
 
 var daemon, localserver, server;
 
 var kCancelArticle =
   "From: fake@acme.invalid\n" +
   "Newsgroups: test.filter\n" +
   "Subject: cancel <4@regular.invalid>\n" +