summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-05-07 15:42:27 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-05-07 15:42:27 -0500
commita7c286677036445e571c914e3b94e16747904835 (patch)
tree068467c0a831c41d70e96bdbbb8f58a567be28c3
parentfa416e2a2d3829f7bffda9eb6a33410fa97923f8 (diff)
downloadaura-central-a7c286677036445e571c914e3b94e16747904835.tar.gz
Issue #20 - Globally disable plugins by default
-rw-r--r--apps/mail/app/profile/application.js3
-rw-r--r--apps/navigator/app/defaults/pref/gre-prefs.inc.js1
-rw-r--r--components/addons/src/PluginProvider.jsm28
-rw-r--r--system/platform-prefs.js3
4 files changed, 26 insertions, 9 deletions
diff --git a/apps/mail/app/profile/application.js b/apps/mail/app/profile/application.js
index e0d2c9739..12d0cc839 100644
--- a/apps/mail/app/profile/application.js
+++ b/apps/mail/app/profile/application.js
@@ -636,8 +636,7 @@ pref("plugins.crash.supportUrl", "https://live.mozillamessaging.com/%APP%/plugin
// The default plugin state should be changed to "ask to activate" when this
// has been done.
pref("plugins.click_to_play", false);
-// Disable by default.
-pref("plugin.disable", true);
+
pref("plugin.default.state", 0);
// Plugins bundled in XPIs are enabled by default.
diff --git a/apps/navigator/app/defaults/pref/gre-prefs.inc.js b/apps/navigator/app/defaults/pref/gre-prefs.inc.js
index d4c0c98ac..fb5106abb 100644
--- a/apps/navigator/app/defaults/pref/gre-prefs.inc.js
+++ b/apps/navigator/app/defaults/pref/gre-prefs.inc.js
@@ -55,7 +55,6 @@ pref("plugins.hide_infobar_for_outdated_plugin", false);
pref("plugins.hide_infobar_for_carbon_failure_plugin", false);
pref("plugins.hide_infobar_for_missing_plugin", false);
pref("plugins.click_to_play", true);
-pref("plugin.disable", false);
// Enable general plugin loading.
pref("plugin.load_flash_only", false);
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)
+ ]);
+}
diff --git a/system/platform-prefs.js b/system/platform-prefs.js
index 934796ee6..327ef332b 100644
--- a/system/platform-prefs.js
+++ b/system/platform-prefs.js
@@ -3201,6 +3201,9 @@ pref("layout.word_select.eat_space_to_next_word", true);
// scrollbar snapping region
pref("slider.snapMultiplier", 6);
+// Globally disable plugins
+pref("plugin.disable", true);
+
// print_extra_margin enables platforms to specify an extra gap or margin
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)