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 "config.h" | 5 #include "config.h" |
6 #include "core/loader/BeaconLoader.h" | 6 #include "core/loader/BeaconLoader.h" |
7 | 7 |
8 #include "core/dom/DOMArrayBufferView.h" | 8 #include "core/dom/DOMArrayBufferView.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/fetch/CrossOriginAccessControl.h" | 10 #include "core/fetch/CrossOriginAccessControl.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return false; | 81 return false; |
82 | 82 |
83 ResourceRequest request(beaconURL); | 83 ResourceRequest request(beaconURL); |
84 request.setRequestContext(WebURLRequest::RequestContextBeacon); | 84 request.setRequestContext(WebURLRequest::RequestContextBeacon); |
85 request.setHTTPMethod("POST"); | 85 request.setHTTPMethod("POST"); |
86 request.setHTTPHeaderField("Cache-Control", "max-age=0"); | 86 request.setHTTPHeaderField("Cache-Control", "max-age=0"); |
87 request.setAllowStoredCredentials(true); | 87 request.setAllowStoredCredentials(true); |
88 frame->document()->fetcher()->context().addAdditionalRequestHeaders(requ
est, FetchSubresource); | 88 frame->document()->fetcher()->context().addAdditionalRequestHeaders(requ
est, FetchSubresource); |
89 frame->document()->fetcher()->context().setFirstPartyForCookies(request)
; | 89 frame->document()->fetcher()->context().setFirstPartyForCookies(request)
; |
90 | 90 |
91 if (MixedContentChecker::shouldBlockFetch(frame, request, request.url())
) | 91 if (MixedContentChecker::shouldBlockFetch(frame, &request, request.url()
)) |
92 return false; | 92 return false; |
93 | 93 |
94 payloadLength = entitySize; | 94 payloadLength = entitySize; |
95 if (!beacon.serialize(request, allowance, payloadLength)) | 95 if (!beacon.serialize(request, allowance, payloadLength)) |
96 return false; | 96 return false; |
97 | 97 |
98 FetchInitiatorInfo initiatorInfo; | 98 FetchInitiatorInfo initiatorInfo; |
99 initiatorInfo.name = FetchInitiatorTypeNames::beacon; | 99 initiatorInfo.name = FetchInitiatorTypeNames::beacon; |
100 | 100 |
101 // Leak the loader, since it will kill itself as soon as it receives a r
esponse. | 101 // Leak the loader, since it will kill itself as soon as it receives a r
esponse. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 request.setHTTPBody(entityBody.release()); | 237 request.setHTTPBody(entityBody.release()); |
238 request.setHTTPContentType(contentType); | 238 request.setHTTPContentType(contentType); |
239 | 239 |
240 payloadLength = entitySize; | 240 payloadLength = entitySize; |
241 return true; | 241 return true; |
242 } | 242 } |
243 | 243 |
244 } // namespace | 244 } // namespace |
245 | 245 |
246 } // namespace blink | 246 } // namespace blink |
OLD | NEW |