Bug 572992 - Wrong favicon displayed for a page opened in a new tab [r=mfinkle]
--- a/mobile/chrome/content/bindings/browser.js
+++ b/mobile/chrome/content/bindings/browser.js
@@ -271,17 +271,17 @@ let DOMEvents = {
break;
case "DOMLinkAdded":
let target = aEvent.originalTarget;
if (!target.href || target.disabled)
return;
let json = {
- location: document.documentURIObject.spec,
+ windowId: target.ownerDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID,
href: target.href,
charset: document.characterSet,
title: target.title,
rel: target.rel,
type: target.type
};
sendSyncMessage("DOMLinkAdded", json);
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -111,17 +111,18 @@
break;
case "DOMTitleChanged":
this._contentTitle = aMessage.json.title;
break;
case "DOMLinkAdded":
let link = aMessage.json;
- if (link.location != this._documentURI)
+ // ignore results from subdocuments
+ if (link.windowId != this.contentWindowId)
return {};
let linkType = this._getLinkType(link);
switch(linkType) {
case "icon":
let iconURI = gIOService.newURI(link.href, link.charset, null);
if (!iconURI.schemeIs("javascript") && !gFaviconService.isFailedFavicon(iconURI)) {
gFaviconService.setAndLoadFaviconForPage(this.currentURI, iconURI, true);