Bug 1127337 - Show article favicon in the browser tab in reader mode. r=jaws

This commit is contained in:
Abhinav Koppula 2015-03-18 16:22:00 -04:00
Родитель 87e3e24f7d
Коммит 7a8fca2a06
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -13,6 +13,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils","resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReadingList", "resource:///modules/readinglist/ReadingList.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ReadingList", "resource:///modules/readinglist/ReadingList.jsm");
@ -56,7 +57,18 @@ let ReaderParent = {
break; break;
case "Reader:FaviconRequest": { case "Reader:FaviconRequest": {
// XXX: To implement. if (message.target.messageManager) {
let faviconUrl = PlacesUtils.promiseFaviconLinkUrl(message.data.url);
faviconUrl.then(function onResolution(favicon) {
message.target.messageManager.sendAsyncMessage("Reader:FaviconReturn", {
url: message.data.url,
faviconUrl: favicon.path.replace(/^favicon:/, "")
})
},
function onRejection(reason) {
Cu.reportError("Error requesting favicon URL for about:reader content: " + reason);
}).catch(Cu.reportError);
}
break; break;
} }
case "Reader:ListStatusRequest": case "Reader:ListStatusRequest":

Просмотреть файл

@ -1562,7 +1562,7 @@ this.PlacesUtils = {
uri = PlacesUtils.favicons.getFaviconLinkForIcon(uri); uri = PlacesUtils.favicons.getFaviconLinkForIcon(uri);
deferred.resolve(uri); deferred.resolve(uri);
} else { } else {
deferred.reject(); deferred.reject("favicon not found for uri");
} }
}); });
return deferred.promise; return deferred.promise;