Bug 1524688: Part 9 - Convert AddonManager components to static registration. r=aswan
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 29 Jan 2019 18:58:05 -0800
changeset 458982 4fb0f0a59fe2
parent 458981 fdc6c4ed241a
child 458983 25f982fd53bd
push id111909
push usermaglione.k@gmail.com
push dateThu, 14 Feb 2019 02:30:40 +0000
treeherdermozilla-inbound@81dc12cc9257 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1524688
milestone67.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 1524688: Part 9 - Convert AddonManager components to static registration. r=aswan
browser/installer/package-manifest.in
mobile/android/installer/package-manifest.in
toolkit/mozapps/extensions/addonManager.js
toolkit/mozapps/extensions/amContentHandler.js
toolkit/mozapps/extensions/amContentHandler.jsm
toolkit/mozapps/extensions/amInstallTrigger.js
toolkit/mozapps/extensions/amInstallTrigger.jsm
toolkit/mozapps/extensions/amWebAPI.js
toolkit/mozapps/extensions/amWebAPI.jsm
toolkit/mozapps/extensions/components.conf
toolkit/mozapps/extensions/extensions.manifest
toolkit/mozapps/extensions/moz.build
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -214,20 +214,16 @@
 @RESPATH@/components/TooltipTextProvider.manifest
 @RESPATH@/components/WebVTT.manifest
 @RESPATH@/components/WebVTTParserWrapper.js
 @RESPATH@/components/nsHelperAppDlg.manifest
 @RESPATH@/components/nsHelperAppDlg.js
 @RESPATH@/components/NetworkGeolocationProvider.manifest
 @RESPATH@/components/NetworkGeolocationProvider.js
 @RESPATH@/components/extensions.manifest
-@RESPATH@/components/addonManager.js
-@RESPATH@/components/amContentHandler.js
-@RESPATH@/components/amInstallTrigger.js
-@RESPATH@/components/amWebAPI.js
 #ifdef MOZ_UPDATER
 @RESPATH@/components/nsUpdateService.manifest
 #endif
 @RESPATH@/components/nsUpdateTimerManager.manifest
 @RESPATH@/components/nsUpdateTimerManager.js
 @RESPATH@/components/utils.manifest
 @RESPATH@/components/simpleServices.js
 @RESPATH@/components/ProcessSingleton.manifest
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -132,17 +132,16 @@
 @BINPATH@/components/storage-mozStorage.js
 @BINPATH@/components/crypto-SDR.js
 @BINPATH@/components/TooltipTextProvider.js
 @BINPATH@/components/TooltipTextProvider.manifest
 @BINPATH@/components/NetworkGeolocationProvider.manifest
 @BINPATH@/components/NetworkGeolocationProvider.js
 
 @BINPATH@/components/extensions.manifest
-@BINPATH@/components/addonManager.js
 
 #ifndef MOZ_GECKOVIEW_JAR
 @BINPATH@/components/utils.manifest
 @BINPATH@/components/simpleServices.js
 @BINPATH@/components/amContentHandler.js
 @BINPATH@/components/amWebAPI.js
 @BINPATH@/components/amInstallTrigger.js
 #ifndef RELEASE_OR_BETA
--- a/toolkit/mozapps/extensions/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -29,17 +29,16 @@ const MSG_PROMISE_REQUEST  = "WebAPIProm
 const MSG_PROMISE_RESULT   = "WebAPIPromiseResult";
 const MSG_INSTALL_EVENT    = "WebAPIInstallEvent";
 const MSG_INSTALL_CLEANUP  = "WebAPICleanup";
 const MSG_ADDON_EVENT_REQ  = "WebAPIAddonEventRequest";
 const MSG_ADDON_EVENT      = "WebAPIAddonEvent";
 
 const CHILD_SCRIPT = "resource://gre/modules/addons/Content.js";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gSingleton = null;
 
 var AddonManager, AddonManagerPrivate;
 function amManager() {
   ({AddonManager, AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm"));
 
@@ -327,9 +326,10 @@ BlocklistService.prototype = {
   },
 
   classID: Components.ID("{66354bc9-7ed1-4692-ae1d-8da97d6b205e}"),
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver,
                                           Ci.nsIBlocklistService,
                                           Ci.nsITimerCallback]),
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([amManager, BlocklistService]);
+// eslint-disable-next-line no-unused-vars
+var EXPORTED_SYMBOLS = ["amManager", "BlocklistService"];
rename from toolkit/mozapps/extensions/amContentHandler.js
rename to toolkit/mozapps/extensions/amContentHandler.jsm
--- a/toolkit/mozapps/extensions/amContentHandler.js
+++ b/toolkit/mozapps/extensions/amContentHandler.jsm
@@ -2,17 +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/. */
 
 "use strict";
 
 const XPI_CONTENT_TYPE = "application/x-xpinstall";
 const MSG_INSTALL_ADDON = "WebInstallerInstallAddonFromWebpage";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function amContentHandler() {
 }
 
 amContentHandler.prototype = {
   /**
    * Handles a new request for an application/x-xpinstall file.
@@ -96,9 +95,9 @@ amContentHandler.prototype = {
 
   log(aMsg) {
     let msg = "amContentHandler.js: " + (aMsg.join ? aMsg.join("") : aMsg);
     Services.console.logStringMessage(msg);
     dump(msg + "\n");
   },
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([amContentHandler]);
+var EXPORTED_SYMBOLS = ["amContentHandler"];
rename from toolkit/mozapps/extensions/amInstallTrigger.js
rename to toolkit/mozapps/extensions/amInstallTrigger.jsm
--- a/toolkit/mozapps/extensions/amInstallTrigger.js
+++ b/toolkit/mozapps/extensions/amInstallTrigger.jsm
@@ -1,15 +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";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
 
 const XPINSTALL_MIMETYPE   = "application/x-xpinstall";
 
 const MSG_INSTALL_ENABLED  = "WebInstallerIsInstallEnabled";
 const MSG_INSTALL_ADDON    = "WebInstallerInstallAddonFromWebpage";
@@ -145,17 +144,17 @@ InstallTrigger.prototype = {
     }
 
     let item = installs[keys[0]];
 
     if (typeof item === "string") {
       item = { URL: item };
     }
     if (!item.URL) {
-      throw new this._window.Error("Missing URL property for '" + name + "'");
+      throw new this._window.Error("Missing URL property for '" + keys[0] + "'");
     }
 
     let url = this._resolveURL(item.URL);
     if (!this._checkLoadURIFromScript(url)) {
       throw new this._window.Error("Insufficient permissions to install: " + url.spec);
     }
 
     let iconUrl = null;
@@ -216,11 +215,9 @@ InstallTrigger.prototype = {
     }
   },
 
   classID: Components.ID("{9df8ef2b-94da-45c9-ab9f-132eb55fddf1}"),
   contractID: "@mozilla.org/addons/installtrigger;1",
   QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]),
 };
 
-
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([InstallTrigger]);
+var EXPORTED_SYMBOLS = ["InstallTrigger"];
rename from toolkit/mozapps/extensions/amWebAPI.js
rename to toolkit/mozapps/extensions/amWebAPI.jsm
--- a/toolkit/mozapps/extensions/amWebAPI.js
+++ b/toolkit/mozapps/extensions/amWebAPI.jsm
@@ -265,9 +265,9 @@ class WebAPI extends APIObject {
     this.listenerCount--;
     if (this.listenerCount == 0) {
       this.broker.setAddonListener(null);
     }
   }
 }
 WebAPI.prototype.QueryInterface = ChromeUtils.generateQI(["nsIDOMGlobalPropertyInitializer"]);
 WebAPI.prototype.classID = Components.ID("{8866d8e3-4ea5-48b7-a891-13ba0ac15235}");
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WebAPI]);
+var EXPORTED_SYMBOLS = ["WebAPI"];
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/components.conf
@@ -0,0 +1,42 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{66354bc9-7ed1-4692-ae1d-8da97d6b205e}',
+        'contract_ids': ['@mozilla.org/extensions/blocklist;1'],
+        'jsm': 'resource://gre/modules/addonManager.js',
+        'constructor': 'BlocklistService',
+        'processes': ProcessSelector.MAIN_PROCESS_ONLY,
+        'categories': ({'profile-after-change': 'nsBlocklistService'}
+                       if buildconfig.substs['MOZ_BUILD_APP'] == 'browser'
+                       else {}),
+    },
+    {
+        'cid': '{4399533d-08d1-458c-a87a-235f74451cfa}',
+        'contract_ids': ['@mozilla.org/addons/integration;1'],
+        'jsm': 'resource://gre/modules/addonManager.js',
+        'constructor': 'amManager',
+    },
+    {
+        'cid': '{7beb3ba8-6ec3-41b4-b67c-da89b8518922}',
+        'contract_ids': ['@mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall'],
+        'jsm': 'resource://gre/modules/amContentHandler.jsm',
+        'constructor': 'amContentHandler',
+    },
+    {
+        'cid': '{9df8ef2b-94da-45c9-ab9f-132eb55fddf1}',
+        'contract_ids': ['@mozilla.org/addons/installtrigger;1'],
+        'jsm': 'resource://gre/modules/amInstallTrigger.jsm',
+        'constructor': 'InstallTrigger',
+    },
+    {
+        'cid': '{8866d8e3-4ea5-48b7-a891-13ba0ac15235}',
+        'contract_ids': ['@mozilla.org/addon-web-api/manager;1'],
+        'jsm': 'resource://gre/modules/amWebAPI.jsm',
+        'constructor': 'WebAPI',
+    },
+]
--- a/toolkit/mozapps/extensions/extensions.manifest
+++ b/toolkit/mozapps/extensions/extensions.manifest
@@ -1,22 +1,8 @@
-component {66354bc9-7ed1-4692-ae1d-8da97d6b205e} addonManager.js process=main
-contract @mozilla.org/extensions/blocklist;1 {66354bc9-7ed1-4692-ae1d-8da97d6b205e} process=main
-#ifndef MOZ_BUILD_APP_IS_BROWSER
-category profile-after-change nsBlocklistService @mozilla.org/extensions/blocklist;1 process=main
-#endif
-
 category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400
-component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js
-contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa}
 #ifndef MOZ_WIDGET_ANDROID
 category update-timer addonManager @mozilla.org/addons/integration;1,getService,addon-background-update-timer,extensions.update.interval,86400
 #endif
-component {7beb3ba8-6ec3-41b4-b67c-da89b8518922} amContentHandler.js
-contract @mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall {7beb3ba8-6ec3-41b4-b67c-da89b8518922}
-component {9df8ef2b-94da-45c9-ab9f-132eb55fddf1} amInstallTrigger.js
-contract @mozilla.org/addons/installtrigger;1 {9df8ef2b-94da-45c9-ab9f-132eb55fddf1}
 #ifndef MOZ_WIDGET_ANDROID
 category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm
 #endif
 category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm
-component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js
-contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235}
--- a/toolkit/mozapps/extensions/moz.build
+++ b/toolkit/mozapps/extensions/moz.build
@@ -38,29 +38,26 @@ if CONFIG['MOZ_BUILD_APP'] == 'browser':
     ]
 elif CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
     manifest.flags = ['--features=features']
 
     FINAL_TARGET_FILES.chrome.chrome.content += [
         '!%s' % built_in_addons,
     ]
 
-EXTRA_COMPONENTS += [
-    'addonManager.js',
-    'amContentHandler.js',
-    'amInstallTrigger.js',
-    'amWebAPI.js',
-]
-
 EXTRA_PP_COMPONENTS += [
     'extensions.manifest',
 ]
 
 EXTRA_JS_MODULES += [
+    'addonManager.js',
     'AddonManager.jsm',
+    'amContentHandler.jsm',
+    'amInstallTrigger.jsm',
+    'amWebAPI.jsm',
     'Blocklist.jsm',
     'LightweightThemeManager.jsm',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
 EXPORTS.mozilla += [
     'AddonContentPolicy.h',
@@ -69,16 +66,20 @@ EXPORTS.mozilla += [
 ]
 
 UNIFIED_SOURCES += [
     'AddonContentPolicy.cpp',
     'AddonManagerStartup.cpp',
     'AddonManagerWebAPI.cpp',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 LOCAL_INCLUDES += [
     '/chrome',
     '/dom/base',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 with Files('**'):