Bug 1698158 - part 2 - Remove unnecessary jsm imports in existing WebExtensions API modules. r=mixedpuppy
authorLuca Greco <lgreco@mozilla.com>
Tue, 16 Mar 2021 18:15:40 +0000
changeset 571458 72d6d9258332f451ba3c65dc923085bb4dbd49cc
parent 571457 7793d8d8a817a836615b8774fc75aa7224d7639a
child 571459 05ef06f4180d9f03928776979c5061d16bfa8059
push id38293
push usermalexandru@mozilla.com
push dateWed, 17 Mar 2021 09:53:31 +0000
treeherdermozilla-central@9ad67cd4d216 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1698158
milestone88.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1698158 - part 2 - Remove unnecessary jsm imports in existing WebExtensions API modules. r=mixedpuppy Depends on D108226 Differential Revision: https://phabricator.services.mozilla.com/D108227
browser/components/extensions/parent/ext-history.js
browser/components/extensions/parent/ext-menus.js
browser/components/extensions/parent/ext-search.js
browser/components/extensions/parent/ext-tabs.js
toolkit/components/extensions/child/ext-storage.js
toolkit/components/extensions/parent/ext-browserSettings.js
toolkit/components/extensions/parent/ext-browsingData.js
toolkit/components/extensions/parent/ext-cookies.js
toolkit/components/extensions/parent/ext-downloads.js
toolkit/components/extensions/parent/ext-geckoProfiler.js
toolkit/components/extensions/parent/ext-identity.js
toolkit/components/extensions/parent/ext-permissions.js
toolkit/components/extensions/parent/ext-privacy.js
toolkit/components/extensions/parent/ext-runtime.js
toolkit/components/extensions/parent/ext-tabs-base.js
toolkit/components/extensions/parent/ext-telemetry.js
toolkit/components/extensions/parent/ext-theme.js
--- a/browser/components/extensions/parent/ext-history.js
+++ b/browser/components/extensions/parent/ext-history.js
@@ -1,23 +1,18 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* 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 { XPCOMUtils } = ChromeUtils.import(
-  "resource://gre/modules/XPCOMUtils.jsm"
-);
-
 XPCOMUtils.defineLazyModuleGetters(this, {
   PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
-  Services: "resource://gre/modules/Services.jsm",
 });
 
 var { normalizeTime } = ExtensionCommon;
 
 let nsINavHistoryService = Ci.nsINavHistoryService;
 const TRANSITION_TO_TRANSITION_TYPES_MAP = new Map([
   ["link", nsINavHistoryService.TRANSITION_LINK],
   ["typed", nsINavHistoryService.TRANSITION_TYPED],
--- a/browser/components/extensions/parent/ext-menus.js
+++ b/browser/components/extensions/parent/ext-menus.js
@@ -1,17 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* 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 { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(
   this,
   "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm"
 );
 
 ChromeUtils.defineModuleGetter(
   this,
--- a/browser/components/extensions/parent/ext-search.js
+++ b/browser/components/extensions/parent/ext-search.js
@@ -2,22 +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/. */
 
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 
 "use strict";
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-
 var { ExtensionError } = ExtensionUtils;
 
 this.search = class extends ExtensionAPI {
   getAPI(context) {
     return {
       search: {
         async get() {
           await searchInitialized;
--- a/browser/components/extensions/parent/ext-tabs.js
+++ b/browser/components/extensions/parent/ext-tabs.js
@@ -28,21 +28,16 @@ ChromeUtils.defineModuleGetter(
 );
 ChromeUtils.defineModuleGetter(
   this,
   "PromiseUtils",
   "resource://gre/modules/PromiseUtils.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-ChromeUtils.defineModuleGetter(
-  this,
   "SessionStore",
   "resource:///modules/sessionstore/SessionStore.jsm"
 );
 
 XPCOMUtils.defineLazyGetter(this, "strBundle", function() {
   return Services.strings.createBundle(
     "chrome://global/locale/extensions.properties"
   );
--- a/toolkit/components/extensions/child/ext-storage.js
+++ b/toolkit/components/extensions/child/ext-storage.js
@@ -14,21 +14,16 @@ ChromeUtils.defineModuleGetter(
   "ExtensionStorageIDB",
   "resource://gre/modules/ExtensionStorageIDB.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "ExtensionTelemetry",
   "resource://gre/modules/ExtensionTelemetry.jsm"
 );
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
 
 // Wrap a storage operation in a TelemetryStopWatch.
 async function measureOp(telemetryMetric, extension, fn) {
   const stopwatchKey = {};
   telemetryMetric.stopwatchStart(extension, stopwatchKey);
   try {
     let result = await fn();
     telemetryMetric.stopwatchFinish(extension, stopwatchKey);
--- a/toolkit/components/extensions/parent/ext-browserSettings.js
+++ b/toolkit/components/extensions/parent/ext-browserSettings.js
@@ -3,26 +3,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/. */
 
 "use strict";
 
 ChromeUtils.defineModuleGetter(
   this,
-  "AppConstants",
-  "resource://gre/modules/AppConstants.jsm"
-);
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-ChromeUtils.defineModuleGetter(
-  this,
   "AboutNewTab",
   "resource:///modules/AboutNewTab.jsm"
 );
 
 var { ExtensionPreferencesManager } = ChromeUtils.import(
   "resource://gre/modules/ExtensionPreferencesManager.jsm"
 );
 
--- a/toolkit/components/extensions/parent/ext-browsingData.js
+++ b/toolkit/components/extensions/parent/ext-browsingData.js
@@ -1,21 +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/. */
 
 "use strict";
 
-var { XPCOMUtils } = ChromeUtils.import(
-  "resource://gre/modules/XPCOMUtils.jsm"
-);
-
 XPCOMUtils.defineLazyModuleGetters(this, {
   LoginHelper: "resource://gre/modules/LoginHelper.jsm",
-  Services: "resource://gre/modules/Services.jsm",
   setTimeout: "resource://gre/modules/Timer.jsm",
   ServiceWorkerCleanUp: "resource://gre/modules/ServiceWorkerCleanUp.jsm",
   // This helper contains the platform-specific bits of browsingData.
   BrowsingDataDelegate: "resource:///modules/ExtensionBrowsingData.jsm",
 });
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
--- a/toolkit/components/extensions/parent/ext-cookies.js
+++ b/toolkit/components/extensions/parent/ext-cookies.js
@@ -1,20 +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/. */
 
 "use strict";
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-
 /* globals DEFAULT_STORE, PRIVATE_STORE */
 
 var { ExtensionError } = ExtensionUtils;
 
 const SAME_SITE_STATUSES = [
   "no_restriction", // Index 0 = Ci.nsICookie.SAMESITE_NONE
   "lax", // Index 1 = Ci.nsICookie.SAMESITE_LAX
   "strict", // Index 2 = Ci.nsICookie.SAMESITE_STRICT
--- a/toolkit/components/extensions/parent/ext-downloads.js
+++ b/toolkit/components/extensions/parent/ext-downloads.js
@@ -1,21 +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/. */
 
 "use strict";
 
 ChromeUtils.defineModuleGetter(
   this,
-  "AppConstants",
-  "resource://gre/modules/AppConstants.jsm"
-);
-ChromeUtils.defineModuleGetter(
-  this,
   "Downloads",
   "resource://gre/modules/Downloads.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "DownloadPaths",
   "resource://gre/modules/DownloadPaths.jsm"
 );
--- a/toolkit/components/extensions/parent/ext-geckoProfiler.js
+++ b/toolkit/components/extensions/parent/ext-geckoProfiler.js
@@ -1,18 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* 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 { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
 ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 ChromeUtils.defineModuleGetter(
   this,
   "ProfilerGetSymbols",
   "resource://gre/modules/ProfilerGetSymbols.jsm"
 );
 
 const PREF_ASYNC_STACK = "javascript.options.asyncstack";
--- a/toolkit/components/extensions/parent/ext-identity.js
+++ b/toolkit/components/extensions/parent/ext-identity.js
@@ -1,22 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* 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";
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-
 XPCOMUtils.defineLazyGlobalGetters(this, ["XMLHttpRequest", "ChannelWrapper"]);
 
 var { promiseDocumentLoaded } = ExtensionUtils;
 
 const checkRedirected = (url, redirectURI) => {
   return new Promise((resolve, reject) => {
     let xhr = new XMLHttpRequest();
     xhr.open("GET", url);
--- a/toolkit/components/extensions/parent/ext-permissions.js
+++ b/toolkit/components/extensions/parent/ext-permissions.js
@@ -1,17 +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/. */
 
 "use strict";
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   ExtensionPermissions: "resource://gre/modules/ExtensionPermissions.jsm",
-  Services: "resource://gre/modules/Services.jsm",
 });
 
 var { ExtensionError } = ExtensionUtils;
 
 XPCOMUtils.defineLazyPreferenceGetter(
   this,
   "promptsEnabled",
   "extensions.webextOptionalPermissionPrompts"
--- a/toolkit/components/extensions/parent/ext-privacy.js
+++ b/toolkit/components/extensions/parent/ext-privacy.js
@@ -1,22 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* 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";
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-
 var { ExtensionPreferencesManager } = ChromeUtils.import(
   "resource://gre/modules/ExtensionPreferencesManager.jsm"
 );
 
 var { ExtensionError } = ExtensionUtils;
 var { getSettingsAPI } = ExtensionPreferencesManager;
 
 const cookieSvc = Ci.nsICookieService;
--- a/toolkit/components/extensions/parent/ext-runtime.js
+++ b/toolkit/components/extensions/parent/ext-runtime.js
@@ -15,21 +15,16 @@ ChromeUtils.defineModuleGetter(
 );
 ChromeUtils.defineModuleGetter(
   this,
   "AddonManagerPrivate",
   "resource://gre/modules/AddonManager.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-ChromeUtils.defineModuleGetter(
-  this,
   "DevToolsShim",
   "chrome://devtools-startup/content/DevToolsShim.jsm"
 );
 
 this.runtime = class extends ExtensionAPI {
   getAPI(context) {
     let { extension } = context;
     return {
--- a/toolkit/components/extensions/parent/ext-tabs-base.js
+++ b/toolkit/components/extensions/parent/ext-tabs-base.js
@@ -4,17 +4,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/. */
 "use strict";
 
 /* globals EventEmitter */
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
-  Services: "resource://gre/modules/Services.jsm",
 });
 
 XPCOMUtils.defineLazyPreferenceGetter(
   this,
   "containersEnabled",
   "privacy.userContext.enabled"
 );
 
--- a/toolkit/components/extensions/parent/ext-telemetry.js
+++ b/toolkit/components/extensions/parent/ext-telemetry.js
@@ -9,26 +9,16 @@ ChromeUtils.defineModuleGetter(
   "TelemetryController",
   "resource://gre/modules/TelemetryController.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "TelemetryUtils",
   "resource://gre/modules/TelemetryUtils.jsm"
 );
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-ChromeUtils.defineModuleGetter(
-  this,
-  "ExtensionUtils",
-  "resource://gre/modules/ExtensionUtils.jsm"
-);
 
 const SCALAR_TYPES = {
   count: Ci.nsITelemetry.SCALAR_TYPE_COUNT,
   string: Ci.nsITelemetry.SCALAR_TYPE_STRING,
   boolean: Ci.nsITelemetry.SCALAR_TYPE_BOOLEAN,
 };
 
 // Currently unsupported on Android: blocked on 1220177.
--- a/toolkit/components/extensions/parent/ext-theme.js
+++ b/toolkit/components/extensions/parent/ext-theme.js
@@ -3,18 +3,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 /* global windowTracker, EventManager, EventEmitter */
 
 /* eslint-disable complexity */
 
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
 ChromeUtils.defineModuleGetter(
   this,
   "LightweightThemeManager",
   "resource://gre/modules/LightweightThemeManager.jsm"
 );
 
 const onUpdatedEmitter = new EventEmitter();