OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 WebURLRequest::FetchCredentialsModeInclude); | 68 WebURLRequest::FetchCredentialsModeInclude); |
69 m_resourceRequest.setFetchRedirectMode( | 69 m_resourceRequest.setFetchRedirectMode( |
70 WebURLRequest::FetchRedirectModeManual); | 70 WebURLRequest::FetchRedirectModeManual); |
71 | 71 |
72 if (originDocument) { | 72 if (originDocument) { |
73 m_resourceRequest.setRequestorOrigin( | 73 m_resourceRequest.setRequestorOrigin( |
74 SecurityOrigin::create(originDocument->url())); | 74 SecurityOrigin::create(originDocument->url())); |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
78 // If we don't have an origin document, and we're going to throw away the resp
onse data | 78 // If we don't have an origin document, and we're going to throw away the |
79 // regardless, set the requestor to a unique origin. | 79 // response data regardless, set the requestor to a unique origin. |
80 if (m_substituteData.isValid()) { | 80 if (m_substituteData.isValid()) { |
81 m_resourceRequest.setRequestorOrigin(SecurityOrigin::createUnique()); | 81 m_resourceRequest.setRequestorOrigin(SecurityOrigin::createUnique()); |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 // If we're dealing with a top-level request, use the origin of the requested
URL as the initiator. | 85 // If we're dealing with a top-level request, use the origin of the requested |
86 // | 86 // URL as the initiator. |
87 // TODO(mkwst): This should be `nullptr`. https://crbug.com/625969 | 87 // TODO(mkwst): This should be `nullptr`. https://crbug.com/625969 |
88 if (m_resourceRequest.frameType() == WebURLRequest::FrameTypeTopLevel) { | 88 if (m_resourceRequest.frameType() == WebURLRequest::FrameTypeTopLevel) { |
89 m_resourceRequest.setRequestorOrigin( | 89 m_resourceRequest.setRequestorOrigin( |
90 SecurityOrigin::create(resourceRequest.url())); | 90 SecurityOrigin::create(resourceRequest.url())); |
91 return; | 91 return; |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 } // namespace blink | 95 } // namespace blink |
OLD | NEW |