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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1411813003: Teach URLRequest about initiator checks for First-Party-Only cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 4 years, 11 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: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index bc43dc39a3be545f3d88307cc15e0e988d125049..df45aef0a22796fbc13a1db5bbcf2efe6b63f52a 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -3563,7 +3563,8 @@ void RenderFrameImpl::willSendRequest(
return;
// Set the first party for cookies url if it has not been set yet (new
- // requests). For redirects, it is updated by WebURLLoaderImpl.
+ // requests). This value will be updated during redirects, consistent with
+ // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1
if (request.firstPartyForCookies().isEmpty()) {
if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) {
request.setFirstPartyForCookies(request.url());
@@ -3576,6 +3577,10 @@ void RenderFrameImpl::willSendRequest(
frame->top()->document().firstPartyForCookies());
}
}
+
+ // If we need to set the first party, then we need to set the request's
+ // initiator as well; it will not be updated during redirects.
+ request.setRequestorOrigin(frame->document().securityOrigin());
}
WebDataSource* provisional_data_source = frame->provisionalDataSource();

Powered by Google App Engine
This is Rietveld 408576698