Bug 1221330 - Show the app icon in the XUL upgraded notifications alert. r=MattN, a=ritu
authorKit Cambridge <kcambridge@mozilla.com>
Fri, 06 Nov 2015 10:30:25 -0800
changeset 291491 0e9c6096f7e9d4deb0c7f98f88b5e032987bc2bd
parent 291490 73a1ad6ba6ed1e3f558daf0aa38dc67cacf7549f
child 291492 191682e257822bba91c240d5aa8fe13d5c9f3e36
push id8711
push usercbook@mozilla.com
push dateThu, 12 Nov 2015 10:43:53 +0000
treeherdermozilla-aurora@0e9c6096f7e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, ritu
bugs1221330
milestone44.0a2
Bug 1221330 - Show the app icon in the XUL upgraded notifications alert. r=MattN, a=ritu
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -2276,25 +2276,36 @@ BrowserGlue.prototype = {
     }
     yield this._firstWindowReady;
     function clickCallback(subject, topic, data) {
       if (topic != "alertclickcallback")
         return;
       let win = RecentWindow.getMostRecentBrowserWindow();
       win.openUILinkIn(data, "tab");
     }
-    let imageURL = "chrome://browser/skin/web-notifications-icon.svg";
+    // Show the application icon for XUL notifications. We assume system-level
+    // notifications will include their own icon.
+    let imageURL = this._hasSystemAlertsService() ? "" :
+                   "chrome://branding/content/about-logo.png";
     let title = gBrowserBundle.GetStringFromName("webNotifications.upgradeTitle");
     let text = gBrowserBundle.GetStringFromName("webNotifications.upgradeBody");
     let url = Services.urlFormatter.formatURLPref("browser.push.warning.migrationURL");
 
     AlertsService.showAlertNotification(imageURL, title, text,
                                         true, url, clickCallback);
   }),
 
+  _hasSystemAlertsService: function() {
+    try {
+      return !!Cc["@mozilla.org/system-alerts-service;1"].getService(
+        Ci.nsIAlertsService);
+    } catch (e) {}
+    return false;
+  },
+
   // ------------------------------
   // public nsIBrowserGlue members
   // ------------------------------
 
   sanitize: function BG_sanitize(aParentWindow) {
     this._sanitizer.sanitize(aParentWindow);
   },