Bug 1698158 - part 3.1 - Remove unnecessary imports from builtin addons experimental API. r=mixedpuppy,webcompat-reviewers,denschub
authorLuca Greco <lgreco@mozilla.com>
Tue, 16 Mar 2021 18:15:41 +0000
changeset 571475 05ef06f4180d9f03928776979c5061d16bfa8059
parent 571474 72d6d9258332f451ba3c65dc923085bb4dbd49cc
child 571476 8a98d844e248731c157be30df87ad240ae41967e
push id138690
push userluca.greco@alcacoop.it
push dateTue, 16 Mar 2021 19:55:19 +0000
treeherderautoland@8ea36600327c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, webcompat-reviewers, denschub
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 3.1 - Remove unnecessary imports from builtin addons experimental API. r=mixedpuppy,webcompat-reviewers,denschub Depends on D108227 Differential Revision: https://phabricator.services.mozilla.com/D108228
browser/extensions/formautofill/api.js
browser/extensions/pictureinpicture/experiment-apis/aboutConfigPipPrefs.js
browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js
browser/extensions/report-site-issue/experimentalAPIs/browserInfo.js
browser/extensions/report-site-issue/experimentalAPIs/helpMenu.js
browser/extensions/report-site-issue/experimentalAPIs/l10n.js
browser/extensions/report-site-issue/experimentalAPIs/tabExtras.js
browser/extensions/screenshots/experiments/screenshots/api.js
browser/extensions/webcompat/experiment-apis/aboutConfigPrefs.js
browser/extensions/webcompat/experiment-apis/appConstants.js
browser/extensions/webcompat/experiment-apis/systemManufacturer.js
browser/extensions/webcompat/experiment-apis/trackingProtection.js
--- a/browser/extensions/formautofill/api.js
+++ b/browser/extensions/formautofill/api.js
@@ -1,23 +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";
 
-/* globals ExtensionAPI */
+/* globals ExtensionAPI, Services, XPCOMUtils */
 
 const CACHED_STYLESHEETS = new WeakMap();
 
-const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const { XPCOMUtils } = ChromeUtils.import(
-  "resource://gre/modules/XPCOMUtils.jsm"
-);
-
 ChromeUtils.defineModuleGetter(
   this,
   "FormAutofill",
   "resource://formautofill/FormAutofill.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "FormAutofillStatus",
--- a/browser/extensions/pictureinpicture/experiment-apis/aboutConfigPipPrefs.js
+++ b/browser/extensions/pictureinpicture/experiment-apis/aboutConfigPipPrefs.js
@@ -1,20 +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";
 
 /* global ExtensionAPI, ExtensionCommon, Services, XPCOMUtils */
 
-XPCOMUtils.defineLazyModuleGetters(this, {
-  Services: "resource://gre/modules/Services.jsm",
-});
-
 this.aboutConfigPipPrefs = class extends ExtensionAPI {
   getAPI(context) {
     const EventManager = ExtensionCommon.EventManager;
     const extensionIDBase = context.extension.id.split("@")[0];
     const extensionPrefNameBase = `extensions.${extensionIDBase}.`;
 
     return {
       aboutConfigPipPrefs: {
--- a/browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js
+++ b/browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js
@@ -1,39 +1,28 @@
 /* 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";
 
-/* global ChromeUtils, ExtensionAPI, Services */
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
+/* global AppConstants, ChromeUtils, ExtensionAPI, Services */
 
 ChromeUtils.defineModuleGetter(
   this,
   "KEYBOARD_CONTROLS",
   "resource://gre/modules/PictureInPictureControls.jsm"
 );
 
 ChromeUtils.defineModuleGetter(
   this,
   "TOGGLE_POLICIES",
   "resource://gre/modules/PictureInPictureControls.jsm"
 );
 
-ChromeUtils.defineModuleGetter(
-  this,
-  "AppConstants",
-  "resource://gre/modules/AppConstants.jsm"
-);
-
 const TOGGLE_ENABLED_PREF =
   "media.videocontrols.picture-in-picture.video-toggle.enabled";
 
 /**
  * This API is expected to be running in the parent process.
  */
 this.pictureInPictureParent = class extends ExtensionAPI {
   getAPI(context) {
--- a/browser/extensions/report-site-issue/experimentalAPIs/browserInfo.js
+++ b/browser/extensions/report-site-issue/experimentalAPIs/browserInfo.js
@@ -1,20 +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/. */
 
 "use strict";
 
-/* global ExtensionAPI */
-
-var { AppConstants } = ChromeUtils.import(
-  "resource://gre/modules/AppConstants.jsm"
-);
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+/* global AppConstants, ExtensionAPI, Services */
 
 function isTelemetryEnabled() {
   return Services.prefs.getBoolPref(
     "datareporting.healthreport.uploadEnabled",
     false
   );
 }
 
--- a/browser/extensions/report-site-issue/experimentalAPIs/helpMenu.js
+++ b/browser/extensions/report-site-issue/experimentalAPIs/helpMenu.js
@@ -1,27 +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/. */
 
 "use strict";
 
-/* global ExtensionAPI */
-
-ChromeUtils.defineModuleGetter(
-  this,
-  "Services",
-  "resource://gre/modules/Services.jsm"
-);
-
-ChromeUtils.defineModuleGetter(
-  this,
-  "ExtensionCommon",
-  "resource://gre/modules/ExtensionCommon.jsm"
-);
+/* global ExtensionAPI, ExtensionCommon, Services */
 
 const TOPIC = "report-site-issue";
 
 this.helpMenu = class extends ExtensionAPI {
   getAPI(context) {
     const { tabManager } = context.extension;
     let EventManager = ExtensionCommon.EventManager;
 
--- a/browser/extensions/report-site-issue/experimentalAPIs/l10n.js
+++ b/browser/extensions/report-site-issue/experimentalAPIs/l10n.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/. */
 
 "use strict";
 
-/* global ExtensionAPI, XPCOMUtils */
-
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+/* global ExtensionAPI, Services, XPCOMUtils */
 
 XPCOMUtils.defineLazyGetter(this, "l10nStrings", function() {
   return Services.strings.createBundle(
     "chrome://report-site-issue/locale/webcompat.properties"
   );
 });
 
 let l10nManifest;
--- a/browser/extensions/report-site-issue/experimentalAPIs/tabExtras.js
+++ b/browser/extensions/report-site-issue/experimentalAPIs/tabExtras.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/. */
 
 "use strict";
 
-/* global ExtensionAPI, XPCOMUtils */
-
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+/* global ExtensionAPI, XPCOMUtils, Services */
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "resProto",
   "@mozilla.org/network/protocol;1?name=resource",
   "nsISubstitutingProtocolHandler"
 );
 
--- a/browser/extensions/screenshots/experiments/screenshots/api.js
+++ b/browser/extensions/screenshots/experiments/screenshots/api.js
@@ -1,26 +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/. */
 
-/* globals browser, AppConstants, Services, ExtensionAPI */
+/* globals browser, AppConstants, Services, ExtensionAPI, ExtensionCommon */
 
 "use strict";
 
-ChromeUtils.defineModuleGetter(this, "AppConstants",
-                               "resource://gre/modules/AppConstants.jsm");
-ChromeUtils.defineModuleGetter(this, "Services",
-                               "resource://gre/modules/Services.jsm");
-ChromeUtils.defineModuleGetter(
-  this,
-  "ExtensionCommon",
-  "resource://gre/modules/ExtensionCommon.jsm"
-);
-
 const TOPIC = "contextmenu-screenshot";
 
 this.screenshots = class extends ExtensionAPI {
   getAPI(context) {
     const { extension } = context;
     const { tabManager } = extension;
     let EventManager = ExtensionCommon.EventManager;
 
--- a/browser/extensions/webcompat/experiment-apis/aboutConfigPrefs.js
+++ b/browser/extensions/webcompat/experiment-apis/aboutConfigPrefs.js
@@ -1,20 +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";
 
 /* global ExtensionAPI, ExtensionCommon, Services, XPCOMUtils */
 
-XPCOMUtils.defineLazyModuleGetters(this, {
-  Services: "resource://gre/modules/Services.jsm",
-});
-
 this.aboutConfigPrefs = class extends ExtensionAPI {
   getAPI(context) {
     const EventManager = ExtensionCommon.EventManager;
     const extensionIDBase = context.extension.id.split("@")[0];
     const extensionPrefNameBase = `extensions.${extensionIDBase}.`;
 
     return {
       aboutConfigPrefs: {
--- a/browser/extensions/webcompat/experiment-apis/appConstants.js
+++ b/browser/extensions/webcompat/experiment-apis/appConstants.js
@@ -1,19 +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/. */
 
 "use strict";
 
-/* global ExtensionAPI, XPCOMUtils */
-
-XPCOMUtils.defineLazyModuleGetters(this, {
-  AppConstants: "resource://gre/modules/AppConstants.jsm",
-});
+/* global AppConstants, ExtensionAPI, XPCOMUtils */
 
 this.appConstants = class extends ExtensionAPI {
   getAPI(context) {
     return {
       appConstants: {
         getReleaseBranch: () => {
           if (AppConstants.NIGHTLY_BUILD) {
             return "nightly";
--- a/browser/extensions/webcompat/experiment-apis/systemManufacturer.js
+++ b/browser/extensions/webcompat/experiment-apis/systemManufacturer.js
@@ -1,20 +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";
 
 /* global ExtensionAPI, Services, XPCOMUtils */
 
-XPCOMUtils.defineLazyModuleGetters(this, {
-  Services: "resource://gre/modules/Services.jsm",
-});
-
 this.systemManufacturer = class extends ExtensionAPI {
   getAPI(context) {
     return {
       systemManufacturer: {
         getManufacturer() {
           try {
             return Services.sysinfo.getProperty("manufacturer");
           } catch (_) {
--- a/browser/extensions/webcompat/experiment-apis/trackingProtection.js
+++ b/browser/extensions/webcompat/experiment-apis/trackingProtection.js
@@ -1,20 +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";
 
 /* global ExtensionAPI, ExtensionCommon, ExtensionParent, Services, XPCOMUtils */
 
-XPCOMUtils.defineLazyModuleGetters(this, {
-  Services: "resource://gre/modules/Services.jsm",
-});
-
 XPCOMUtils.defineLazyGlobalGetters(this, ["URL", "ChannelWrapper"]);
 
 class Manager {
   constructor() {
     this._allowLists = new Map();
   }
 
   _ensureStarted() {