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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2080653002: SameSite: Correctly set requests' initiator for new tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: firstPartyForCookiesFix 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
Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 9166180f40520e80392a93c590b5a86b542d5cb8..f87dc9811204eb8450b87c5acdd93fe53411ba05 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -727,6 +727,25 @@ void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques
fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active");
}
+void FrameFetchContext::populateRequestorDataIfNecessary(ResourceRequest& request)
+{
+ if (!m_document)
+ return;
+
+ // Subresource requests inherit their requestor origin and first-party for
+ // cookies from |m_document| directly.
+ if (request.frameType() == WebURLRequest::FrameTypeNone) {
+ RefPtr<SecurityOrigin> documentSite = SecurityOrigin::create(m_document->url());
+ if (request.requestorOrigin()->isUnique() && !documentSite->isUnique())
+ request.setRequestorOrigin(documentSite);
+ if (request.firstPartyForCookies().isEmpty())
+ request.setFirstPartyForCookies(m_document->firstPartyForCookies());
+ }
+
+ // Top-level and nested frame types are taken care of in 'FrameLoadRequest()'.
+ // Auxiliary frame types in 'createWindow()' and 'FrameLoader::load'.
+}
+
MHTMLArchive* FrameFetchContext::archive() const
{
ASSERT(!isMainFrame());

Powered by Google App Engine
This is Rietveld 408576698