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 "FetchInitiatorTypeNames.h" | 8 #include "FetchInitiatorTypeNames.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" |
11 #include "core/fetch/FetchContext.h" | 11 #include "core/fetch/FetchContext.h" |
12 #include "core/fileapi/File.h" | 12 #include "core/fileapi/File.h" |
13 #include "core/frame/LocalFrame.h" | 13 #include "core/frame/LocalFrame.h" |
14 #include "core/html/DOMFormData.h" | 14 #include "core/html/DOMFormData.h" |
15 #include "platform/network/FormData.h" | 15 #include "platform/network/FormData.h" |
16 #include "platform/network/ParsedContentType.h" | 16 #include "platform/network/ParsedContentType.h" |
17 #include "platform/network/ResourceRequest.h" | 17 #include "platform/network/ResourceRequest.h" |
18 #include "wtf/ArrayBufferView.h" | 18 #include "wtf/ArrayBufferView.h" |
19 | 19 |
20 namespace WebCore { | 20 namespace WebCore { |
21 | 21 |
22 void BeaconLoader::prepareRequest(LocalFrame* frame, ResourceRequest& request) | 22 void BeaconLoader::prepareRequest(LocalFrame* frame, ResourceRequest& request) |
23 { | 23 { |
24 // NOTE: do not distinguish Beacon by target type. | 24 // NOTE: do not distinguish Beacon by target type. |
25 request.setTargetType(ResourceRequest::TargetIsPing); | 25 request.setTargetType(ResourceRequest::TargetIsPing); |
26 request.setHTTPMethod("POST"); | 26 request.setHTTPMethod("POST"); |
27 request.setHTTPHeaderField("Cache-Control", "max-age=0"); | 27 request.setHTTPHeaderField("Cache-Control", "max-age=0"); |
28 request.setAllowStoredCredentials(true); | 28 request.setAllowStoredCredentials(true); |
29 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document()
, request, FetchSubresource); | 29 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document()
, request, FetchSubresource); |
| 30 frame->loader().fetchContext().setFirstPartyForCookies(request); |
30 } | 31 } |
31 | 32 |
32 void BeaconLoader::issueRequest(LocalFrame* frame, ResourceRequest& request) | 33 void BeaconLoader::issueRequest(LocalFrame* frame, ResourceRequest& request) |
33 { | 34 { |
34 FetchInitiatorInfo initiatorInfo; | 35 FetchInitiatorInfo initiatorInfo; |
35 initiatorInfo.name = FetchInitiatorTypeNames::beacon; | 36 initiatorInfo.name = FetchInitiatorTypeNames::beacon; |
36 | 37 |
37 PingLoader::start(frame, request, initiatorInfo); | 38 PingLoader::start(frame, request, initiatorInfo); |
38 } | 39 } |
39 | 40 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 AtomicString contentType = AtomicString("multipart/form-data; boundary=", At
omicString::ConstructFromLiteral) + entityBody->boundary().data(); | 121 AtomicString contentType = AtomicString("multipart/form-data; boundary=", At
omicString::ConstructFromLiteral) + entityBody->boundary().data(); |
121 request.setHTTPBody(entityBody.release()); | 122 request.setHTTPBody(entityBody.release()); |
122 request.setHTTPContentType(contentType); | 123 request.setHTTPContentType(contentType); |
123 | 124 |
124 issueRequest(frame, request); | 125 issueRequest(frame, request); |
125 payloadLength = entitySize; | 126 payloadLength = entitySize; |
126 return true; | 127 return true; |
127 } | 128 } |
128 | 129 |
129 } // namespace WebCore | 130 } // namespace WebCore |
OLD | NEW |