[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 0a287d3bcce4d9e75d1f77af355c19b9292a23c0
Author: Arthur Edelstein <arthuredelstein@xxxxxxxxx>
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;
+          }
+        }
       }
     }
   }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits