Bug 573101: Should not build PluginProvider.jsm when plugins are disabled. r=robstrong
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 12 Jul 2010 14:20:49 -0700
changeset 47339 052a128ce613744e8271306a8e0a3ebcb4b17206
parent 47338 83f04a97bf67e558a69dcb351bedcb3722ae6d4d
child 47340 869c27d951895e3dce118c051a617cd6f52ba638
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobstrong
bugs573101
milestone2.0b2pre
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 573101: Should not build PluginProvider.jsm when plugins are disabled. r=robstrong
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/Makefile.in
toolkit/mozapps/extensions/extensions.manifest
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -42,20 +42,21 @@ const Ci = Components.interfaces;
 const Cr = Components.results;
 
 const PREF_EM_UPDATE_ENABLED = "extensions.update.enabled";
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 var EXPORTED_SYMBOLS = [ "AddonManager", "AddonManagerPrivate" ];
 
+const CATEGORY_PROVIDER_MODULE = "addon-provider-module";
+
 // A list of providers to load by default
-const PROVIDERS = [
+const DEFAULT_PROVIDERS = [
   "resource://gre/modules/XPIProvider.jsm",
-  "resource://gre/modules/PluginProvider.jsm",
   "resource://gre/modules/LightweightThemeManager.jsm"
 ];
 
 ["LOG", "WARN", "ERROR"].forEach(function(aName) {
   this.__defineGetter__(aName, function() {
     Components.utils.import("resource://gre/modules/AddonLogging.jsm");
 
     LogManager.getLogger("addons.manager", this);
@@ -186,25 +187,42 @@ var AddonManagerInternal = {
 
     if (appChanged) {
       LOG("Application has been upgraded");
       Services.prefs.setCharPref("extensions.lastAppVersion",
                                  Services.appinfo.version);
     }
 
     // Ensure all default providers have had a chance to register themselves
-    PROVIDERS.forEach(function(url) {
+    DEFAULT_PROVIDERS.forEach(function(url) {
       try {
         Components.utils.import(url, {});
       }
       catch (e) {
-        ERROR("Exception loading provider \"" + url + "\": " + e);
+        ERROR("Exception loading default provider \"" + url + "\": " + e);
       }
     });
 
+    // Load any providers registered in the category manager
+    let catman = Cc["@mozilla.org/categorymanager;1"].
+                 getService(Ci.nsICategoryManager);
+    let entries = catman.enumerateCategory(CATEGORY_PROVIDER_MODULE);
+    while (entries.hasMoreElements()) {
+      let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
+      let url = catman.getCategoryEntry(CATEGORY_PROVIDER_MODULE, entry);
+
+      try {
+        Components.utils.import(url, {});
+      }
+      catch (e) {
+        ERROR("Exception loading provider " + entry + " from category \"" +
+              url + "\": " + e);
+      }
+    }
+
     let needsRestart = false;
     this.providers.forEach(function(provider) {
       callProvider(provider, "startup");
       if (callProvider(provider, "checkForChanges", false, appChanged))
         needsRestart = true;
     });
     this.started = true;
 
--- a/toolkit/mozapps/extensions/Makefile.in
+++ b/toolkit/mozapps/extensions/Makefile.in
@@ -67,21 +67,25 @@ EXTRA_PP_COMPONENTS = \
   amContentHandler.js \
   amWebInstallListener.js \
   $(NULL)
 
 EXTRA_PP_JS_MODULES = \
   AddonManager.jsm \
   AddonRepository.jsm \
   XPIProvider.jsm \
-  PluginProvider.jsm \
   AddonUpdateChecker.jsm \
   AddonLogging.jsm \
   $(NULL)
 
+ifdef MOZ_PLUGINS
+  EXTRA_PP_JS_MODULES += PluginProvider.jsm
+  DEFINES += -DMOZ_PLUGINS
+endif
+
 EXTRA_JS_MODULES = \
   LightweightThemeManager.jsm \
   $(NULL)
 
 ifdef ENABLE_TESTS
 DIRS += test
 endif
 
--- a/toolkit/mozapps/extensions/extensions.manifest
+++ b/toolkit/mozapps/extensions/extensions.manifest
@@ -3,8 +3,11 @@ contract @mozilla.org/extensions/blockli
 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}
 category update-timer addonManager @mozilla.org/addons/integration;1,getService,addon-background-update-timer,extensions.update.interval,86400
 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 {0f38e086-89a3-40a5-8ffc-9b694de1d04a} amWebInstallListener.js
 contract @mozilla.org/addons/web-install-listener;1 {0f38e086-89a3-40a5-8ffc-9b694de1d04a}
+#ifdef MOZ_PLUGINS
+category addon-provider-module PluginProvider resource://gre/modules/PluginProvider.jsm
+#endif