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

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

Issue 2147473002: Set 'ResourceRequest::requestorOrigin' in Blink for more request types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jochen 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/loader/FrameLoadRequest.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp b/third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp
index 9c4ad94d0bc066d6f3a534f17b09d35c6851f147..4dd89cf2fcdd3578c7a0180cd9249c655f31d28f 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp
@@ -53,10 +53,22 @@ FrameLoadRequest::FrameLoadRequest(Document* originDocument, const ResourceReque
if (originDocument) {
m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(originDocument->url()));
- } else {
- if (m_resourceRequest.frameType() == WebURLRequest::FrameTypeTopLevel) {
- m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(resourceRequest.url()));
- }
+ return;
+ }
+
+ // If we don't have an origin document, and we're going to throw away the response data
+ // regardless, set the requestor to a unique origin.
+ if (m_substituteData.isValid()) {
+ m_resourceRequest.setRequestorOrigin(SecurityOrigin::createUnique());
+ return;
+ }
+
+ // If we're dealing with a top-level request, use the origin of the requested URL as the initiator.
+ //
+ // TODO(mkwst): This should be `nullptr`. https://crbug.com/625969
+ if (m_resourceRequest.frameType() == WebURLRequest::FrameTypeTopLevel) {
+ m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(resourceRequest.url()));
+ return;
}
}
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp ('k') | third_party/WebKit/Source/core/loader/PingLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698