Skip to content

Commit

Permalink
Bug 430792 - Site's favicon is replaced if browser error page is show…
Browse files Browse the repository at this point in the history
…n (for ehsan.akhgari@gmail.com, r=dietrich, a=beltzner)
  • Loading branch information
Unknown committed May 8, 2008
1 parent 1415de4 commit 81d9c4d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docshell/resources/content/netError.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<head>
<title>&loadError.label;</title>
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
<!-- If the location of the favicon is changed here, the FAVICON_ERRORPAGE_URL symbol in
toolkit/components/places/src/nsFaviconService.h should be updated. -->
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png"/>

<script type="application/x-javascript"><![CDATA[
Expand Down
15 changes: 9 additions & 6 deletions toolkit/components/places/src/nsFaviconService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* Contributor(s):
* Brett Wilson <brettw@gmail.com> (original author)
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
Expand Down Expand Up @@ -480,13 +481,15 @@ nsFaviconService::DoSetAndLoadFaviconForPage(nsIURI* aPageURI,
if (pageEqualsFavicon)
return NS_OK;

// ignore data URL favicons. The main case here is the error page, which uses
// a data URL as the favicon. The result is that we get the data URL in the
// favicon table associated with the decoded version of the data URL.
PRBool isDataURL;
rv = aFaviconURI->SchemeIs("data", &isDataURL);
// ignore error page favicons.
nsCOMPtr<nsIURI> errorPageFavicon;
rv = NS_NewURI(getter_AddRefs(errorPageFavicon),
NS_LITERAL_CSTRING(FAVICON_ERRORPAGE_URL));
NS_ENSURE_SUCCESS(rv, rv);
if (isDataURL)
PRBool isErrorPage;
rv = aFaviconURI->Equals(errorPageFavicon, &isErrorPage);
NS_ENSURE_SUCCESS(rv, rv);
if (isErrorPage)
return NS_OK;

// See if we have data and get the expiration time for this favicon. It might
Expand Down
1 change: 1 addition & 0 deletions toolkit/components/places/src/nsFaviconService.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,5 @@ class nsFaviconService : public nsIFaviconService
};

#define FAVICON_DEFAULT_URL "chrome://mozapps/skin/places/defaultFavicon.png"
#define FAVICON_ERRORPAGE_URL "chrome://global/skin/icons/warning-16.png"
#define FAVICON_ANNOTATION_NAME "favicon"

0 comments on commit 81d9c4d

Please sign in to comment.