Bug 1147823 - Properly show the add-on install confirmation UI when there was no prior addon-progress notification (i.e. for local installs). r=dtownsend
authorDão Gottwald <dao@mozilla.com>
Thu, 26 Mar 2015 20:32:37 +0100
changeset 266173 250512664b2130146b0ec4319996e3a968749232
parent 266172 a83feceee78bdee65a321a741dcc7da291ef40e2
child 266174 c3f447e3cf58ea08a0730a51c9f300e0c6f32ed6
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdtownsend
bugs1147823
milestone39.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 1147823 - Properly show the add-on install confirmation UI when there was no prior addon-progress notification (i.e. for local installs). r=dtownsend
browser/base/content/browser-addons.js
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -214,20 +214,16 @@ const gXPInstallObserver = {
       cancelButton.label = gNavigatorBundle.getString("addonInstall.cancelButton.label");
       cancelButton.accessKey = gNavigatorBundle.getString("addonInstall.cancelButton.accesskey");
 
       let acceptButton = document.getElementById("addon-install-confirmation-accept");
       acceptButton.label = gNavigatorBundle.getString("addonInstall.acceptButton.label");
       acceptButton.accessKey = gNavigatorBundle.getString("addonInstall.acceptButton.accesskey");
 
       let showNotification = () => {
-        // The download may have been cancelled during the security delay
-        if (!PopupNotifications.getNotification("addon-progress", browser))
-          return;
-
         let tab = gBrowser.getTabForBrowser(browser);
         if (tab)
           gBrowser.selectedTab = tab;
 
         if (PopupNotifications.isPanelOpen) {
           let rect = document.getElementById("addon-progress-notification").getBoundingClientRect();
           let notification = document.getElementById("addon-install-confirmation-notification");
           notification.style.minHeight = rect.height + "px";
@@ -238,25 +234,30 @@ const gXPInstallObserver = {
 
         this._removeProgressNotification(browser);
 
         Services.telemetry
                 .getHistogramById("SECURITY_UI")
                 .add(Ci.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL);
       };
 
-      let downloadDuration = 0;
       let progressNotification = PopupNotifications.getNotification("addon-progress", browser);
-      if (progressNotification)
-        downloadDuration = Date.now() - progressNotification._startTime;
-      let securityDelay = Services.prefs.getIntPref("security.dialog_enable_delay") - downloadDuration;
-      if (securityDelay > 0)
-        setTimeout(showNotification, securityDelay);
-      else
-        showNotification();
+      if (progressNotification) {
+        let downloadDuration = Date.now() - progressNotification._startTime;
+        let securityDelay = Services.prefs.getIntPref("security.dialog_enable_delay") - downloadDuration;
+        if (securityDelay > 0) {
+          setTimeout(() => {
+            // The download may have been cancelled during the security delay
+            if (PopupNotifications.getNotification("addon-progress", browser))
+              showNotification();
+          }, securityDelay);
+          break;
+        }
+      }
+      showNotification();
       break; }
     case "addon-install-complete": {
       let needsRestart = installInfo.installs.some(function(i) {
         return i.addon.pendingOperations != AddonManager.PENDING_NONE;
       });
 
       if (needsRestart) {
         messageString = gNavigatorBundle.getString("addonsInstalledNeedsRestart");