Skip to content

Commit

Permalink
fixup! Bug #13670.1: Isolate favicon requests by first party
Browse files Browse the repository at this point in the history
  • Loading branch information
arthuredelstein committed Sep 17, 2015
1 parent 45666d6 commit 1f39237
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 2 additions & 1 deletion browser/base/content/tabbrowser.xml
Expand Up @@ -5042,7 +5042,7 @@
class="tab-throbber"
role="presentation"
layer="true" />
<xul:image xbl:inherits="src=image,fadein,pinned,selected,busy,crashed,firstparty"
<xul:image xbl:inherits="src=image,fadein,pinned,selected,busy,crashed"
anonid="tab-icon-image"
class="tab-icon-image"
validate="never"
Expand Down Expand Up @@ -5286,6 +5286,7 @@
aMenuitem.setAttribute("busy", aTab.getAttribute("busy"));
aMenuitem.removeAttribute("image");
} else {
aMenuitem.setAttribute("firstparty", aTab.getAttribute("firstparty"));
aMenuitem.setAttribute("image", aTab.getAttribute("image"));
aMenuitem.removeAttribute("busy");
}
Expand Down
26 changes: 16 additions & 10 deletions dom/base/ThirdPartyUtil.cpp
Expand Up @@ -593,16 +593,22 @@ ThirdPartyUtil::GetFirstPartyURIInternal(nsIChannel *aChannel,
// to a particular web site should be assigned that site's first party.
if (aNode && aNode->IsElement() && aNode->OwnerDoc() &&
nsContentUtils::IsChromeDoc(aNode->OwnerDoc())) {
nsString firstparty;
aNode->AsElement()->GetAttribute(NS_LITERAL_STRING("firstparty"), firstparty);
if (!firstparty.IsEmpty()) {
nsCOMPtr<nsIURI> tempURI;
rv = NS_NewURI(getter_AddRefs(tempURI), firstparty);
if (rv != NS_OK) {
return rv;
} else {
NS_ADDREF(*aOutput = tempURI);
return NS_OK;
nsTArray<nsINode*> nodeAncestors;
nsContentUtils::GetAncestors(aNode, nodeAncestors);
for (nsINode* nodeAncestor : nodeAncestors) {
if (nodeAncestor->IsElement()) {
nsString firstparty;
nodeAncestor->AsElement()->GetAttribute(NS_LITERAL_STRING("firstparty"), firstparty);
if (!firstparty.IsEmpty()) {
nsCOMPtr<nsIURI> tempURI;
rv = NS_NewURI(getter_AddRefs(tempURI), firstparty);
if (rv != NS_OK) {
return rv;
} else {
NS_ADDREF(*aOutput = tempURI);
return NS_OK;
}
}
}
}
}
Expand Down

0 comments on commit 1f39237

Please sign in to comment.