| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 unsigned long long entitySize = beacon.size(); | 165 unsigned long long entitySize = beacon.size(); |
| 166 if (allowance > 0 && static_cast<unsigned long long>(allowance) < entity
Size) | 166 if (allowance > 0 && static_cast<unsigned long long>(allowance) < entity
Size) |
| 167 return false; | 167 return false; |
| 168 | 168 |
| 169 ResourceRequest request(beaconURL); | 169 ResourceRequest request(beaconURL); |
| 170 request.setRequestContext(WebURLRequest::RequestContextBeacon); | 170 request.setRequestContext(WebURLRequest::RequestContextBeacon); |
| 171 request.setHTTPMethod(HTTPNames::POST); | 171 request.setHTTPMethod(HTTPNames::POST); |
| 172 request.setHTTPHeaderField(HTTPNames::Cache_Control, "max-age=0"); | 172 request.setHTTPHeaderField(HTTPNames::Cache_Control, "max-age=0"); |
| 173 request.setAllowStoredCredentials(true); | 173 request.setAllowStoredCredentials(true); |
| 174 frame->document()->fetcher()->context().addAdditionalRequestHeaders(requ
est, FetchSubresource); | 174 frame->document()->fetcher()->context().addAdditionalRequestHeaders(requ
est, FetchSubresource); |
| 175 frame->document()->fetcher()->context().setFirstPartyForCookies(request)
; | 175 frame->document()->fetcher()->context().populateRequestData(request); |
| 176 | 176 |
| 177 if (MixedContentChecker::shouldBlockFetch(frame, request, request.url())
) | 177 if (MixedContentChecker::shouldBlockFetch(frame, request, request.url())
) |
| 178 return false; | 178 return false; |
| 179 | 179 |
| 180 payloadLength = entitySize; | 180 payloadLength = entitySize; |
| 181 if (!beacon.serialize(request, allowance, payloadLength)) | 181 if (!beacon.serialize(request, allowance, payloadLength)) |
| 182 return false; | 182 return false; |
| 183 | 183 |
| 184 FetchInitiatorInfo initiatorInfo; | 184 FetchInitiatorInfo initiatorInfo; |
| 185 initiatorInfo.name = FetchInitiatorTypeNames::beacon; | 185 initiatorInfo.name = FetchInitiatorTypeNames::beacon; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |