Bug 611793 - Addon restart system notification does not go away on restart [r=mfinkle]
authorWesley Johnston <wjohnston@mozilla.com>
Mon, 15 Nov 2010 16:12:00 -0500
changeset 67025 e85a6291460492190c3fddbf426671b0ab293058
parent 67024 96133ebf10525d0088664e994207717b06896b20
child 67026 210c09f41895ed78894f98e5829c4e90317a1956
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs611793
Bug 611793 - Addon restart system notification does not go away on restart [r=mfinkle]
mobile/chrome/content/extensions.js
--- a/mobile/chrome/content/extensions.js
+++ b/mobile/chrome/content/extensions.js
@@ -151,16 +151,17 @@ var ExtensionsView = {
   showRestart: function ev_showRestart(aMode) {
     // Increment the count in case the view is not completely initialized
     this._restartCount++;
 
     // Pick the right message key from the properties file
     aMode = aMode || "normal";
 
     if (this._msg) {
+      this.hideAlerts();
       let strings = Elements.browserBundle;
       let message = "notificationRestart." + aMode;
       this.showMessage(strings.getString(message), "restart-app",
                        strings.getString("notificationRestart.button"), false, "addons-restart-app");
     }
   },
 
   hideRestart: function ev_hideRestart() {
@@ -723,17 +724,25 @@ var ExtensionsView = {
         if (aTopic == "alertclickcallback")
           BrowserUI.showPanel("addons-container");
       }
     };
 
     let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
     alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, strings.getString("alertAddons"),
                                  aMessage, true, "", observer, "addons");
-  }
+  },
+
+  hideAlerts: function ev_hideAlerts() {
+#ifdef ANDROID
+    let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
+    let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
+    progressListener.onCancel("addons");
+#endif
+  },
 };
 
 
 function searchFailed() {
   ExtensionsView.clearSection("repo");
 
   let strings = Elements.browserBundle;
   let brand = document.getElementById("bundle_brand");
@@ -875,18 +884,20 @@ AddonInstallListener.prototype = {
 
     let error = (host || aInstall.error == 0) ? "addonError" : "addonLocalError";
     if (aInstall.error != 0)
       error += aInstall.error;
     else if (aInstall.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
       error += "Blocklisted";
     else if (!aInstall.addon.isCompatible || !aInstall.addon.isPlatformCompatible)
       error += "Incompatible";
-    else
+    else {
+      ExtensionsView.hideAlerts();
       return; // no need to show anything in this case
+    }
 
     let messageString = strings.getString(error);
     messageString = messageString.replace("#1", aInstall.name);
     if (host)
       messageString = messageString.replace("#2", host);
     messageString = messageString.replace("#3", brandShortName);
     messageString = messageString.replace("#4", Services.appinfo.version);