Bug 1255590 - Allow unsigned addons in /usr/{lib,share}/mozilla/extensions. r=mossop
authorMike Hommey <mh@glandium.org>
Sat, 05 Dec 2015 18:23:58 +0900
changeset 290998 cdb91f4483be1538ca4f1f1acad352aff8a5690b
parent 290997 735da799e3bbb98c087339f21599571c48ce484f
child 290999 e534484bb762eae6c8242322ae3b79be18759d6e
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1255590
milestone48.0a1
Bug 1255590 - Allow unsigned addons in /usr/{lib,share}/mozilla/extensions. r=mossop
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/internal/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -195,19 +195,25 @@ function loadView(aViewId) {
 
     gViewController.loadInitialView(aViewId);
   } else {
     gViewController.loadView(aViewId);
   }
 }
 
 function isCorrectlySigned(aAddon) {
-  // temporary add-ons do not require signing
+  // Temporary add-ons do not require signing.
   if (aAddon.scope == AddonManager.SCOPE_TEMPORARY)
       return true;
+  // On UNIX platforms except OSX, an additional location for system add-ons
+  // exists in /usr/{lib,share}/mozilla/extensions. Add-ons installed there
+  // do not require signing either.
+  if (aAddon.scope == AddonManager.SCOPE_SYSTEM &&
+      Services.appinfo.OS != "Darwin")
+    return true;
   if (aAddon.signedState <= AddonManager.SIGNEDSTATE_MISSING)
     return false;
   return true;
 }
 
 function isDiscoverEnabled() {
   if (Services.prefs.getPrefType(PREF_DISCOVERURL) == Services.prefs.PREF_INVALID)
     return false;
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -682,18 +682,23 @@ function isUsableAddon(aAddon) {
   // Hack to ensure the default theme is always usable
   if (aAddon.type == "theme" && aAddon.internalName == XPIProvider.defaultSkin)
     return true;
 
   if (aAddon._installLocation.name == KEY_APP_SYSTEM_ADDONS &&
       aAddon.signedState != AddonManager.SIGNEDSTATE_SYSTEM) {
     return false;
   }
-  // temporary and system add-ons do not require signing
-  if ((aAddon._installLocation.name != KEY_APP_SYSTEM_DEFAULTS &&
+  // Temporary and system add-ons do not require signing.
+  // On UNIX platforms except OSX, an additional location for system add-ons
+  // exists in /usr/{lib,share}/mozilla/extensions. Add-ons installed there
+  // do not require signing either.
+  if (((aAddon._installLocation.scope != AddonManager.SCOPE_SYSTEM ||
+        Services.appinfo.OS == "Darwin") &&
+       aAddon._installLocation.name != KEY_APP_SYSTEM_DEFAULTS &&
        aAddon._installLocation.name != KEY_APP_TEMPORARY) &&
        mustSign(aAddon.type)) {
     if (aAddon.signedState <= AddonManager.SIGNEDSTATE_MISSING)
       return false;
   }
 
   if (aAddon.blocklistState == Blocklist.STATE_BLOCKED)
     return false;