Bug 1245956 - Don't distinguish preliminary signing for add-ons. r=mossop
authorAndrew Swan <aswan@mozilla.com>
Thu, 18 Feb 2016 16:17:09 -0800
changeset 321649 d86655d3c54c7b1ac9ac824b9e2c1948620b6446
parent 321648 f3dcf982a76f82ead9dcf2e0a116e2dda2d8aed7
child 321650 6d8c09f110ee89530087abcd55d9f44691248f59
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1245956
milestone47.0a1
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 1245956 - Don't distinguish preliminary signing for add-ons. r=mossop
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
@@ -200,18 +200,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
@@ -688,18 +688,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);
 });