Bug 696433 - Improve link rel scanning for favicons [r=mbrubeck]

This commit is contained in:
Mark Finkle 2011-12-08 08:56:43 -05:00
parent 77aefa4612
commit 20cda4349a
2 changed files with 13 additions and 2 deletions

View File

@ -1130,7 +1130,7 @@ abstract public class GeckoApp
}
void handleLinkAdded(final int tabId, String rel, final String href) {
if (rel.indexOf("icon") != -1) {
if (rel.indexOf("[icon]") != -1) {
final Tab tab = Tabs.getInstance().getTab(tabId);
if (tab != null) {
tab.updateFaviconURL(href);

View File

@ -1235,13 +1235,24 @@ Tab.prototype = {
if (target.ownerDocument.defaultView != this.browser.contentWindow)
return;
// sanitize the rel string
let list = [];
if (target.rel) {
list = target.rel.toLowerCase().split(/\s+/);
let hash = {};
list.forEach(function(value) { hash[value] = true; });
list = [];
for (let rel in hash)
list.push("[" + rel + "]");
}
let json = {
type: "DOMLinkAdded",
tabID: this.id,
href: resolveGeckoURI(target.href),
charset: target.ownerDocument.characterSet,
title: target.title,
rel: target.rel
rel: list.join(" ")
};
// rel=icon can also have a sizes attribute