Skip to content
Browse files

Remove nsIFaviconService indiscriminate favicon size handling.

  • Loading branch information...
1 parent fc731f1 commit 1a1a157715e9eb17577a6c9b89364f455290b2e4 @chromakode chromakode committed Jun 21, 2012
Showing with 18 additions and 40 deletions.
  1. +3 −0 NEWS
  2. +1 −1 src/install.rdf
  3. +1 −1 src/modules/site.jsm
  4. +13 −38 src/modules/utils/faviconWatch.jsm
View
3 NEWS
@@ -1,3 +1,6 @@
+== Version 1.5.1 ==
+* Fix favicon handling with alternate icon <link>s.
+
== Version 1.5 ==
* Update authentication scraping for compatibility with the new reddit layout.
* Prevent the built in reddit tool bar from activating.
View
2 src/install.rdf
@@ -9,7 +9,7 @@
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="socialite@chromakode"
em:name="Socialite"
- em:version="1.5"
+ em:version="1.5.1"
em:type="2"
em:iconURL="chrome://socialite/skin/socialite.png"
em:optionsURL="chrome://socialite/content/socialitePreferences.xul">
View
2 src/modules/site.jsm
@@ -33,7 +33,7 @@ SocialiteSite.prototype = {
getIconURI: function() {
// We'll assume that favicon.ico exists for now.
- return this.siteURL+"/favicon.ico";
+ return this.siteURI.prePath+"/favicon.ico";
},
onLoad: function() {
View
51 src/modules/utils/faviconWatch.jsm
@@ -12,32 +12,30 @@ var historyService = Components.classes["@mozilla.org/browser/nav-history-servic
var EXPORTED_SYMBOLS = ["setFavicon", "getFaviconURL", "addFaviconWatch", "useFaviconAsAttribute"];
var watchables = {};
+var favicons = {}
-function setFavicon(siteURL, faviconURL, skipLoad) {
- let siteURI = IOService.newURI(siteURL, null, null);
- let faviconURI = IOService.newURI(faviconURL, null, null);
-
- if (!skipLoad) {
- faviconService.setAndLoadFaviconForPage(siteURI, faviconURI, false);
+function setFavicon(siteURL, faviconURL) {
+ favicons[siteURL] = faviconURL;
+
+ let watchable = watchables[siteURL];
+ if (watchable) {
+ watchable.send(faviconURL);
}
- return faviconService.getFaviconImageForPage(siteURI).spec;
+
+ return faviconURL;
}
function getFaviconURL(siteURL) {
- let siteURI = IOService.newURI(siteURL, null, null);
- return faviconService.getFaviconImageForPage(siteURI).spec;
+ return favicons[siteURL]
}
function addFaviconWatch(siteURL, changedCallback) {
- let siteURI = IOService.newURI(siteURL, null, null);
- let siteURISpec = siteURI.spec;
-
// Add the watch
- if (!watchables[siteURISpec]) {
- watchables[siteURISpec] = new Watchable();
+ if (!watchables[siteURL]) {
+ watchables[siteURL] = new Watchable();
}
- return watchables[siteURISpec].watch(changedCallback);
+ return watchables[siteURL].watch(changedCallback);
}
function useFaviconWatch(siteURL, changedCallback) {
@@ -57,26 +55,3 @@ function useFaviconAsProperty(element, propertyName, siteURL) {
element[propertyName] = faviconURL;
});
}
-
-historyObserver = {
- onPageChanged: function(URI, what, value) {
- if (what == Components.interfaces.nsINavHistoryObserver.ATTRIBUTE_FAVICON) {
- // Notify all watchables that the favicon has changed, passing the new URI
- let watchable = watchables[URI.spec];
- if (watchable) {
- watchable.send(value);
- }
- }
- },
-
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function() {},
- onTitleChanged: function() {},
- onDeleteURI: function() {},
- onClearHistory: function() {},
- onPageExpired: function() {},
-}
-
-// This module persists for the lifetime of the app, so don't worry about removing the observer.
-historyService.addObserver(historyObserver, false);

0 comments on commit 1a1a157

Please sign in to comment.
Something went wrong with that request. Please try again.