summaryrefslogtreecommitdiff
path: root/components/addons/src/PluginProvider.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'components/addons/src/PluginProvider.jsm')
-rw-r--r--components/addons/src/PluginProvider.jsm28
1 files changed, 22 insertions, 6 deletions
diff --git a/components/addons/src/PluginProvider.jsm b/components/addons/src/PluginProvider.jsm
index cb07dcb12..2dcf56033 100644
--- a/components/addons/src/PluginProvider.jsm
+++ b/components/addons/src/PluginProvider.jsm
@@ -13,6 +13,7 @@ this.EXPORTED_SYMBOLS = [];
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Services.jsm");
+const PREF_PLUGINS_DISABLED = "plugin.disable";
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
const STRING_TYPE_NAME = "type.%ID%.name";
const LIST_UPDATED_TOPIC = "plugins-list-updated";
@@ -587,9 +588,24 @@ PluginWrapper.prototype = {
}
};
-AddonManagerPrivate.registerProvider(PluginProvider, [
- new AddonManagerPrivate.AddonType("plugin", URI_EXTENSION_STRINGS,
- STRING_TYPE_NAME,
- AddonManager.VIEW_TYPE_LIST, 6000,
- AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE)
-]);
+// XXXTobin: Figure out if globally disabled plugins can be re-enabled at runtime
+// and if so find a dynamic solution for registering and deregistering providers.
+if (Services.prefs.getBoolPref(PREF_PLUGINS_DISABLED, true)) {
+ // For now just register a fake provider on startup and then
+ // unregister it when plugins are globally disabled.
+ var DisabledPluginProvider = {
+ get name() "PluginProvider",
+ startup: function PL_startup() { },
+ shutdown: function PL_shutdown() { }
+ };
+
+ AddonManagerPrivate.registerProvider(DisabledPluginProvider);
+ AddonManagerPrivate.unregisterProvider(DisabledPluginProvider);
+} else {
+ AddonManagerPrivate.registerProvider(PluginProvider, [
+ new AddonManagerPrivate.AddonType("plugin", URI_EXTENSION_STRINGS,
+ STRING_TYPE_NAME,
+ AddonManager.VIEW_TYPE_LIST, 6000,
+ AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE)
+ ]);
+}