OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/BeaconLoader.h" | 5 #include "core/loader/BeaconLoader.h" |
6 | 6 |
7 #include "core/dom/DOMArrayBufferView.h" | 7 #include "core/dom/DOMArrayBufferView.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/fetch/CrossOriginAccessControl.h" | 9 #include "core/fetch/CrossOriginAccessControl.h" |
10 #include "core/fetch/FetchContext.h" | 10 #include "core/fetch/FetchContext.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 BeaconBlob beacon(data); | 214 BeaconBlob beacon(data); |
215 return Sender::send(frame, allowance, beaconURL, beacon, payloadLength); | 215 return Sender::send(frame, allowance, beaconURL, beacon, payloadLength); |
216 } | 216 } |
217 | 217 |
218 BeaconLoader::BeaconLoader(LocalFrame* frame, ResourceRequest& request, const Fe
tchInitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) | 218 BeaconLoader::BeaconLoader(LocalFrame* frame, ResourceRequest& request, const Fe
tchInitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) |
219 : PingLoader(frame, request, initiatorInfo, credentialsAllowed) | 219 : PingLoader(frame, request, initiatorInfo, credentialsAllowed) |
220 , m_beaconOrigin(frame->document()->getSecurityOrigin()) | 220 , m_beaconOrigin(frame->document()->getSecurityOrigin()) |
221 { | 221 { |
222 } | 222 } |
223 | 223 |
224 void BeaconLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewReq
uest, const WebURLResponse& passedRedirectResponse) | 224 void BeaconLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewReq
uest, const WebURLResponse& passedRedirectResponse, int64_t encodedDataLength) |
225 { | 225 { |
226 passedNewRequest.setAllowStoredCredentials(true); | 226 passedNewRequest.setAllowStoredCredentials(true); |
227 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); | 227 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); |
228 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe
sponse()); | 228 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe
sponse()); |
229 | 229 |
230 ASSERT(!newRequest.isNull()); | 230 ASSERT(!newRequest.isNull()); |
231 ASSERT(!redirectResponse.isNull()); | 231 ASSERT(!redirectResponse.isNull()); |
232 | 232 |
233 String errorDescription; | 233 String errorDescription; |
234 StoredCredentials withCredentials = AllowStoredCredentials; | 234 StoredCredentials withCredentials = AllowStoredCredentials; |
235 ResourceLoaderOptions options; | 235 ResourceLoaderOptions options; |
236 if (!CrossOriginAccessControl::handleRedirect(m_beaconOrigin.get(), newReque
st, redirectResponse, withCredentials, options, errorDescription)) { | 236 if (!CrossOriginAccessControl::handleRedirect(m_beaconOrigin.get(), newReque
st, redirectResponse, withCredentials, options, errorDescription)) { |
237 if (LocalFrame* localFrame = frame()) { | 237 if (LocalFrame* localFrame = frame()) { |
238 if (localFrame->document()) | 238 if (localFrame->document()) |
239 localFrame->document()->addConsoleMessage(ConsoleMessage::create
(JSMessageSource, ErrorMessageLevel, errorDescription)); | 239 localFrame->document()->addConsoleMessage(ConsoleMessage::create
(JSMessageSource, ErrorMessageLevel, errorDescription)); |
240 } | 240 } |
241 // Cancel the load and self destruct. | 241 // Cancel the load and self destruct. |
242 dispose(); | 242 dispose(); |
243 return; | 243 return; |
244 } | 244 } |
245 // FIXME: http://crbug.com/427429 is needed to correctly propagate | 245 // FIXME: http://crbug.com/427429 is needed to correctly propagate |
246 // updates of Origin: following this successful redirect. | 246 // updates of Origin: following this successful redirect. |
247 } | 247 } |
248 | 248 |
249 } // namespace blink | 249 } // namespace blink |
OLD | NEW |