Bug 674794 - favicons of app tabs aren't updated on Panorama r=tim

This commit is contained in:
Raymond Lee 2011-08-23 22:48:53 +08:00
parent a7333a73b1
commit c40f44a19d
2 changed files with 20 additions and 6 deletions

View File

@ -1623,11 +1623,15 @@ let UI = {
getFavIconUrlForTab: function UI_getFavIconUrlForTab(tab) {
let url;
// use the tab image if it doesn't start with http e.g. data:image/png, chrome://
if (tab.image && !(/^https?:/.test(tab.image)))
url = tab.image;
else
if (tab.image) {
// if starts with http/https, fetch icon from favicon service via the moz-anno protocal
if (/^https?:/.test(tab.image))
url = gFavIconService.getFaviconLinkForIcon(gWindow.makeURI(tab.image)).spec;
else
url = tab.image;
} else {
url = gFavIconService.getFaviconImageForPage(tab.linkedBrowser.currentURI).spec;
}
return url;
},

View File

@ -40,8 +40,18 @@ function onTabViewWindowLoaded() {
// fired, a delay is used here to avoid the test code run before the browser
// code.
executeSoon(function() {
is($icon.attr("src"), fi.defaultFavicon.spec,
"The icon is showing the default fav icon");
let iconSrc = $icon.attr("src");
let hasData = true;
try {
fi.getFaviconDataAsDataURL(iconSrc);
} catch(e) {
hasData = false;
}
ok(!hasData, "The icon src doesn't return any data");
// with moz-anno:favicon automatically redirects to the default favIcon
// if the given url is invalid
ok(/^moz-anno:favicon:/.test(iconSrc),
"The icon url starts with moz-anno:favicon so the default fav icon would be displayed");
// clean up
gBrowser.removeTab(newTab);