Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2046593003: Fix Document::firstPartyForCookies() for OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the top frame in the remote case and add a test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 3d3620f7bc72a1466493b2fb8f27dd059f611505..f4e9881b24b31cc19a4b0f04c5fe6f714e1c18f4 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4178,17 +4178,18 @@ const KURL Document::firstPartyForCookies() const
{
// TODO(mkwst): This doesn't correctly handle sandboxed documents; we want to look at their URL,
// but we can't because we don't know what it is.
- KURL topDocumentURL = frame()->tree().top()->isLocalFrame()
- ? topDocument().url()
- : KURL(KURL(), frame()->securityContext()->getSecurityOrigin()->toString());
+ Frame* top = frame()->tree().top();
+ KURL topDocumentURL = top->isLocalFrame()
+ ? toLocalFrame(top)->document()->url()
+ : KURL(KURL(), top->securityContext()->getSecurityOrigin()->toString());
if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocumentURL.protocol()))
return topDocumentURL;
// We're intentionally using the URL of each document rather than the document's SecurityOrigin.
// Sandboxing a document into a unique origin shouldn't effect first-/third-party status for
// cookies and site data.
- const OriginAccessEntry& accessEntry = frame()->tree().top()->isLocalFrame()
- ? topDocument().accessEntryFromURL()
+ const OriginAccessEntry& accessEntry = top->isLocalFrame()
+ ? toLocalFrame(top)->document()->accessEntryFromURL()
: OriginAccessEntry(topDocumentURL.protocol(), topDocumentURL.host(), OriginAccessEntry::AllowRegisterableDomains);
const Frame* currentFrame = frame();
while (currentFrame) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698