Bug 609072 - Default favicon does not appear on about: pages [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 18 Jan 2011 13:49:20 -0800
changeset 67272 466585d9bd45b51fb11b8384df69d2eb1a4d6352
parent 67271 a133273c6f9e6aabe90e9c78095eecaca56b9df3
child 67273 30dc032402ebc8fb949893124171f06f8639a4f7
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
bugs609072
Bug 609072 - Default favicon does not appear on about: pages [r=mfinkle]
mobile/chrome/content/bindings/browser.xml
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -94,24 +94,24 @@
             switch (aMessage.name) {
               case "DOMPopupBlocked":
                 self.onPopupBlocked(aMessage);
                 break;
 
               case "pageshow":
                 self.onPageShow(aMessage);
 
-                if (self.mIconURL == "" && self._documentURI) {
-                  // newURI call is throwing for chrome URI
-                  try {
-                    // Use documentURIObject in the favicon construction so that we
+                if (!self.mIconURL && self._documentURI) {
+                  let iconURL = null;
+                  if (self.shouldLoadFavicon()) {
+                    // Use documentURI in the favicon construction so that we
                     // do the right thing with about:-style error pages.  Bug 515188
-                    self.loadFavicon(self.documentURI.prePath + "/favicon.ico", null);
+                    iconURL = self.documentURI.prePath + "/favicon.ico";
                   }
-                  catch(e) {}
+                  self.loadFavicon(iconURL, null);
                 }
                 break;
 
               case "pagehide":
                 self.onPageHide(aMessage);
                 break;
 
               case "DOMTitleChanged":
@@ -147,33 +147,34 @@
           }
         })
       ]]></field>
 
       <method name="loadFavicon">
         <parameter name="aURL"/>
         <parameter name="aCharset"/>
         <body><![CDATA[
-            let iconURI = Services.io.newURI(aURL, aCharset, null);
-            if (this.shouldLoadFavicon(iconURI)) {
+            try { // newURI call is throwing for chrome URI
+              let iconURI = Services.io.newURI(aURL, aCharset, null);
+              if (gFaviconService.isFailedFavicon(iconURI))
+                return;
+
               gFaviconService.setAndLoadFaviconForPage(this.currentURI, iconURI, true);
               this.mIconURL = iconURI.spec;
-            }
-            else {
-               this.mIconURL = "";
+            } catch (e) {
+              this.mIconURL = null;
             }
         ]]></body>
       </method>
 
       <method name="shouldLoadFavicon">
-        <parameter name="aURI"/>
         <body><![CDATA[
-          let docURI = this.currentURI;
-          return (!gFaviconService.isFailedFavicon(aURI) && docURI && ("schemeIs" in docURI) &&
-                  (docURI.schemeIs("http") || docURI.schemeIs("https") || docURI.schemeIs("about") || docURI.schemeIs("chrome")));
+          let docURI = this.documentURI;
+          return (docURI && ("schemeIs" in docURI) &&
+                  (docURI.schemeIs("http") || docURI.schemeIs("https")));
         ]]></body>
       </method>
 
       <method name="_getLinkType">
         <parameter name="aLink" />
         <body><![CDATA[
           let type = "";
           if (/\bicon\b/i(aLink.rel)) {