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

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

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update testRunner calls to setBlockThirdPartyCookies() Created 4 years, 5 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
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 a49ef639f5d79ea62091a133211aff1bd8104ad3..b8fc83bbd3571c6af7b570e128d899f68e29eaa9 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4170,10 +4170,15 @@ String Document::lastModified() const
const KURL Document::firstPartyForCookies() const
{
+ // TODO(mkwst): This doesn't properly handle HTML Import documents.
+
// If this is an imported document, grab its master document's first-party:
if (importsController() && importsController()->master() && importsController()->master() != this)
return importsController()->master()->firstPartyForCookies();
+ if (!frame())
+ return SecurityOrigin::urlWithUniqueSecurityOrigin();
+
// 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.
Frame* top = frame()->tree().top();

Powered by Google App Engine
This is Rietveld 408576698