Bug 1171146 - Display a learn more link when refusing to install an unsigned add-on. r=dtownsend. a=sledru
authorDão Gottwald <dao@mozilla.com>
Fri, 05 Jun 2015 13:10:53 +0200
changeset 274996 3b3b9a96c8a361c6746c733883e9b124b617b772
parent 274995 23a9b4381ad9508d3b7c4253ef8264731f41f808
child 274997 ddcd9376f635660ebe131a53fc93806d0bf98139
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdtownsend, sledru
bugs1171146
milestone40.0a2
Bug 1171146 - Display a learn more link when refusing to install an unsigned add-on. r=dtownsend. a=sledru
browser/base/content/browser-addons.js
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -166,25 +166,34 @@ const gXPInstallObserver = {
         let error = (host || install.error == 0) ? "addonError" : "addonLocalError";
         if (install.error != 0)
           error += install.error;
         else if (install.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
           error += "Blocklisted";
         else
           error += "Incompatible";
 
+        // Add Learn More link when refusing to install an unsigned add-on
+        if (install.error == AddonManager.ERROR_SIGNEDSTATE_REQUIRED) {
+          options.learnMoreURL =
+            Services.prefs.getCharPref("xpinstall.signatures.infoURL");
+        }
+
         messageString = gNavigatorBundle.getString(error);
         messageString = messageString.replace("#1", install.name);
         if (host)
           messageString = messageString.replace("#2", host);
         messageString = messageString.replace("#3", brandShortName);
         messageString = messageString.replace("#4", Services.appinfo.version);
 
         PopupNotifications.show(browser, notificationID, messageString, anchorID,
                                 action, null, options);
+
+        // Can't have multiple notifications with the same ID, so stop here.
+        break;
       }
       this._removeProgressNotification(browser);
       break; }
     case "addon-install-confirmation": {
       let unsigned = installInfo.installs.filter(i => i.addon.signedState <= AddonManager.SIGNEDSTATE_MISSING);
       let someUnsigned = unsigned.length > 0 && unsigned.length < installInfo.installs.length;
 
       options.eventCallback = (aEvent) => {