Bug 806127 - ThirdPartyUtil should not consider in-process <iframe mozbrowser/mozapp> to be third-party. r=bz
☠☠ backed out by 1e04d8f5e601 ☠ ☠
authorJustin Lebar <justin.lebar@gmail.com>
Tue, 30 Oct 2012 15:55:05 -0400
changeset 111936 7fa2f2eff658e41e55b3c6a35231afbfad571b7d
parent 111935 9b533d393792bd49228908c614619b8a6f115968
child 111937 a844765fb5d9ea82f44d90690a71bb6cb05e556d
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersbz
bugs806127
milestone19.0a1
Bug 806127 - ThirdPartyUtil should not consider in-process <iframe mozbrowser/mozapp> to be third-party. r=bz
content/base/src/ThirdPartyUtil.cpp
--- a/content/base/src/ThirdPartyUtil.cpp
+++ b/content/base/src/ThirdPartyUtil.cpp
@@ -110,17 +110,19 @@ ThirdPartyUtil::IsThirdPartyWindow(nsIDO
       *aResult = true;
       return NS_OK;
     }
   }
 
   nsCOMPtr<nsIDOMWindow> current = aWindow, parent;
   nsCOMPtr<nsIURI> parentURI;
   do {
-    rv = current->GetParent(getter_AddRefs(parent));
+    // We use GetScriptableParent rather than GetParent because we consider
+    // <iframe mozbrowser/mozapp> to be a top-level frame.
+    rv = current->GetScriptableParent(getter_AddRefs(parent));
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (SameCOMIdentity(parent, current)) {
       // We're at the topmost content window. We already know the answer.
       *aResult = false;
       return NS_OK;
     }
 
@@ -205,17 +207,19 @@ ThirdPartyUtil::IsThirdPartyChannel(nsIC
   // If there is no window, the consumer kicking off the load didn't provide one
   // to the channel. This is limited to loads of certain types of resources. If
   // those loads require cookies, the forceAllowThirdPartyCookie property should
   // be set on the channel.
   nsCOMPtr<nsIDOMWindow> ourWin, parentWin;
   ctx->GetAssociatedWindow(getter_AddRefs(ourWin));
   if (!ourWin) return NS_ERROR_INVALID_ARG;
 
-  ourWin->GetParent(getter_AddRefs(parentWin));
+  // We use GetScriptableParent rather than GetParent because we consider
+  // <iframe mozbrowser/mozapp> to be a top-level frame.
+  ourWin->GetScriptableParent(getter_AddRefs(parentWin));
   NS_ENSURE_TRUE(parentWin, NS_ERROR_INVALID_ARG);
 
   // Check whether this is the document channel for this window (representing a
   // load of a new page). In that situation we want to avoid comparing
   // channelURI to ourWin, since what's in ourWin right now will be replaced as
   // the channel loads.  This covers the case of a freshly kicked-off load
   // (e.g. the user typing something in the location bar, or clicking on a
   // bookmark), where the window's URI hasn't yet been set, and will be bogus.