Bug 1245956 - Don't distinguish preliminary signing for add-ons. r=mossop, a=lizzard
authorAndrew Swan <aswan@mozilla.com>
Thu, 18 Feb 2016 16:17:09 -0800
changeset 461552 a488abb7ec3fc99c32365e224f2a810911457ded
parent 461551 f1be5b6a974e496bc51c4486734dc2f159ad46ab
child 461553 9c9c4da067feb2227cfd0743786011949a7e725e
push id41669
push userbmo:mtabara@mozilla.com
push dateMon, 16 Jan 2017 18:05:57 +0000
reviewersmossop, lizzard
bugs1245956
milestone45.0.2esrpre
Bug 1245956 - Don't distinguish preliminary signing for add-ons. r=mossop, a=lizzard MozReview-Commit-ID: DfbncH8YnAe
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/test/browser/browser_details.js
toolkit/mozapps/extensions/test/browser/browser_list.js
toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -208,18 +208,16 @@ function loadView(aViewId) {
 }
 
 function isCorrectlySigned(aAddon) {
   // temporary add-ons do not require signing
   if (aAddon.scope == AddonManager.SCOPE_TEMPORARY)
       return true;
   if (aAddon.signedState <= AddonManager.SIGNEDSTATE_MISSING)
     return false;
-  if (aAddon.foreignInstall && aAddon.signedState < AddonManager.SIGNEDSTATE_SIGNED)
-    return false;
   return true;
 }
 
 function isDiscoverEnabled() {
   if (Services.prefs.getPrefType(PREF_DISCOVERURL) == Services.prefs.PREF_INVALID)
     return false;
 
   try {
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -682,18 +682,16 @@ function isUsableAddon(aAddon) {
     return false;
   }
   // temporary and system add-ons do not require signing
   if ((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.foreignInstall && aAddon.signedState < AddonManager.SIGNEDSTATE_SIGNED)
-      return false;
   }
 
   if (aAddon.blocklistState == Blocklist.STATE_BLOCKED)
     return false;
 
   // Experiments are installed through an external mechanism that
   // limits target audience to compatible clients. We trust it knows what
   // it's doing and skip compatibility checks.
--- a/toolkit/mozapps/extensions/test/browser/browser_details.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_details.js
@@ -863,23 +863,21 @@ add_test(function() {
       open_details("addon11@tests.mozilla.org", "extension", function() {
         is(get("detail-name").textContent, "Test add-on 11", "Name should be correct");
 
         is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
         is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
         is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
         is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
 
-        is_element_hidden(get("detail-warning"), "Warning message should be hidden");
+        is_element_visible(get("detail-warning"), "Warning message should be visible");
+        is(get("detail-warning").textContent, "Test add-on 11 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
         is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
-        is_element_visible(get("detail-error"), "Error message should be visible");
-        is(get("detail-error").textContent, "Test add-on 11 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
-        is_element_visible(get("detail-error-link"), "Error link should be visible");
-        is(get("detail-error-link").value, "More Information", "Error link text should be correct");
-        is(get("detail-error-link").href, infoURL, "Error link should be correct");
+        is_element_hidden(get("detail-error"), "Error message should be hidden");
+        is_element_hidden(get("detail-error-link"), "Error link should be hidden");
 
         close_manager(gManagerWindow, function() {
           Services.prefs.setBoolPref("xpinstall.signatures.required", false);
           open_manager(null, function(aWindow) {
             gManagerWindow = aWindow;
             gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
             run_next_test();
--- a/toolkit/mozapps/extensions/test/browser/browser_list.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_list.js
@@ -105,18 +105,16 @@ add_task(function*() {
     signedState: AddonManager.SIGNEDSTATE_MISSING,
     isActive: false,
     isCompatible: false,
     appDisabled: true,
   }, {
     id: "addon12@tests.mozilla.org",
     name: "Test add-on 12",
     signedState: AddonManager.SIGNEDSTATE_PRELIMINARY,
-    isActive: false,
-    appDisabled: true,
     foreignInstall: true,
   }, {
     id: "addon13@tests.mozilla.org",
     name: "Test add-on 13",
     signedState: AddonManager.SIGNEDSTATE_SIGNED,
     foreignInstall: true,
   }, {
     id: "addon15@tests.mozilla.org",
@@ -887,26 +885,23 @@ add_task(function*() {
   addon = items["Test add-on 12"];
   addon.parentNode.ensureElementIsVisible(addon);
   ({ name, version } = yield get_tooltip_info(addon))
   is(get_node(addon, "name").value, "Test add-on 12", "Name should be correct");
   is(name, "Test add-on 12", "Tooltip name should be correct");
 
   is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
   is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
-  is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
+  is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
   is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
 
   is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
   is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
-  is_element_visible(get_node(addon, "error"), "Error message should be visible");
-  is(get_node(addon, "error").textContent, "Test add-on 12 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
-  is_element_visible(get_node(addon, "error-link"), "Error link should be visible");
-  is(get_node(addon, "error-link").value, "More Information", "Error link text should be correct");
-  is(get_node(addon, "error-link").href, infoURL, "Error link should be correct");
+  is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
+  is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
 
   info("Addon 13");
   addon = items["Test add-on 13"];
   addon.parentNode.ensureElementIsVisible(addon);
   ({ name, version } = yield get_tooltip_info(addon));
   is(get_node(addon, "name").value, "Test add-on 13", "Name should be correct");
   is(name, "Test add-on 13", "Tooltip name should be correct");
 
@@ -931,20 +926,19 @@ add_task(function*() {
 
   yield new Promise(resolve => wait_for_view_load(gManagerWindow, resolve));
 
   is_element_hidden(filterButton, "Button for showing disabled unsigned extensions should be hidden");
   is_element_visible(showAllButton, "Button for showing all extensions should be visible");
   is_element_visible(signingInfoUI, "Signing info UI should be visible");
 
   items = get_test_items();
-  is(Object.keys(items).length, 3, "Two add-ons should be shown");
+  is(Object.keys(items).length, 2, "Two add-ons should be shown");
   is(Object.keys(items)[0], "Test add-on 10", "The disabled unsigned extension should be shown");
   is(Object.keys(items)[1], "Test add-on 11", "The disabled unsigned extension should be shown");
-  is(Object.keys(items)[2], "Test add-on 12", "The disabled foreign installed extension should be shown");
 
   showAllButton.click();
 
   yield new Promise(resolve => wait_for_view_load(gManagerWindow, resolve));
 
   items = get_test_items();
   is(Object.keys(items).length, EXPECTED_ADDONS, "All add-ons should be shown again");
   is_element_visible(filterButton, "Button for showing disabled unsigned extensions should be visible again");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_inject.js
@@ -331,29 +331,29 @@ add_task(function*() {
 
   do_check_false(file.exists());
   clearCache(file);
 
   yield promiseShutdownManager();
   resetPrefs();
 });
 
-// Only fully-signed sideloaded add-ons should work
+// Preliminarily-signed sideloaded add-ons should work
 add_task(function*() {
   let file = manuallyInstall(do_get_file(DATA + ADDONS.bootstrap.preliminary), profileDir, ID);
 
   startupManager();
 
   // Currently we leave the sideloaded add-on there but just don't run it
   let addon = yield promiseAddonByID(ID);
   do_check_neq(addon, null);
-  do_check_true(addon.appDisabled);
-  do_check_false(addon.isActive);
+  do_check_false(addon.appDisabled);
+  do_check_true(addon.isActive);
   do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_PRELIMINARY);
-  do_check_eq(getActiveVersion(), -1);
+  do_check_eq(getActiveVersion(), 2);
 
   addon.uninstall();
   yield promiseShutdownManager();
   resetPrefs();
 
   do_check_false(file.exists());
   clearCache(file);
 });