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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/FrameLoadRequest.h" 5 #include "core/loader/FrameLoadRequest.h"
6 6
7 #include "platform/network/ResourceRequest.h" 7 #include "platform/network/ResourceRequest.h"
8 #include "public/platform/WebURLRequest.h" 8 #include "public/platform/WebURLRequest.h"
9 #include "wtf/text/AtomicString.h" 9 #include "wtf/text/AtomicString.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 , m_shouldSetOpener(MaybeSetOpener) 46 , m_shouldSetOpener(MaybeSetOpener)
47 , m_shouldCheckMainWorldContentSecurityPolicy(shouldCheckMainWorldContentSec urityPolicy) 47 , m_shouldCheckMainWorldContentSecurityPolicy(shouldCheckMainWorldContentSec urityPolicy)
48 { 48 {
49 // These flags are passed to a service worker which controls the page. 49 // These flags are passed to a service worker which controls the page.
50 m_resourceRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeNavigat e); 50 m_resourceRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeNavigat e);
51 m_resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsMod eInclude); 51 m_resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsMod eInclude);
52 m_resourceRequest.setFetchRedirectMode(WebURLRequest::FetchRedirectModeManua l); 52 m_resourceRequest.setFetchRedirectMode(WebURLRequest::FetchRedirectModeManua l);
53 53
54 if (originDocument) { 54 if (originDocument) {
55 m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(originDocume nt->url())); 55 m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(originDocume nt->url()));
56 } else { 56 return;
57 if (m_resourceRequest.frameType() == WebURLRequest::FrameTypeTopLevel) { 57 }
58 m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(resource Request.url())); 58
59 } 59 // If we don't have an origin document, and we're going to throw away the re sponse data
60 // regardless, set the requestor to a unique origin.
61 if (m_substituteData.isValid()) {
62 m_resourceRequest.setRequestorOrigin(SecurityOrigin::createUnique());
63 return;
64 }
65
66 // If we're dealing with a top-level request, use the origin of the requeste d URL as the initiator.
67 //
68 // TODO(mkwst): This should be `nullptr`. https://crbug.com/625969
69 if (m_resourceRequest.frameType() == WebURLRequest::FrameTypeTopLevel) {
70 m_resourceRequest.setRequestorOrigin(SecurityOrigin::create(resourceRequ est.url()));
71 return;
60 } 72 }
61 } 73 }
62 74
63 } // namespace blink 75 } // namespace blink
OLDNEW
« 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