[tbb-commits] [tor-browser/tor-browser-38.3.0esr-5.0-2] fixup! Bug #13670.1: Isolate favicon requests by first party

gk at torproject.org gk at torproject.org
Fri Sep 18 08:36:13 UTC 2015


commit c15e86cd0f082d63d37fddff1efc35a428cb8eca
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Wed Sep 9 06:06:43 2015 -0700

    fixup! Bug #13670.1: Isolate favicon requests by first party
---
 browser/base/content/tabbrowser.xml |    3 ++-
 dom/base/ThirdPartyUtil.cpp         |   26 ++++++++++++++++----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml
index 49d4207..6033b71 100644
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -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"
@@ -5292,6 +5292,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");
           }
diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp
index 5cffc71..618d55b 100644
--- a/dom/base/ThirdPartyUtil.cpp
+++ b/dom/base/ThirdPartyUtil.cpp
@@ -594,16 +594,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;
+          }
+        }
       }
     }
   }



More information about the tbb-commits mailing list