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
Родитель 384b178ad2
Коммит 4f76153bcc
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -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);

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

@ -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