Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: Source/core/loader/BeaconLoader.cpp

Issue 468853002: Use a precise target type for Beacon requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/FetchInitiatorTypeNames.h" 8 #include "core/FetchInitiatorTypeNames.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"
11 #include "core/fileapi/File.h" 11 #include "core/fileapi/File.h"
12 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
13 #include "core/html/DOMFormData.h" 13 #include "core/html/DOMFormData.h"
14 #include "platform/network/FormData.h" 14 #include "platform/network/FormData.h"
15 #include "platform/network/ParsedContentType.h" 15 #include "platform/network/ParsedContentType.h"
16 #include "platform/network/ResourceRequest.h" 16 #include "platform/network/ResourceRequest.h"
17 #include "public/platform/WebURLRequest.h" 17 #include "public/platform/WebURLRequest.h"
18 #include "wtf/ArrayBufferView.h" 18 #include "wtf/ArrayBufferView.h"
19 19
20 namespace blink { 20 namespace blink {
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 request.setRequestContext(WebURLRequest::RequestContextBeacon);
25 request.setRequestContext(blink::WebURLRequest::RequestContextPing);
Mike West 2014/08/13 13:54:41 Why was this note here? It's certainly less releva
sof 2014/08/13 14:05:38 Just a remark that Blink didn't expose the "Beacon
26 request.setHTTPMethod("POST"); 25 request.setHTTPMethod("POST");
27 request.setHTTPHeaderField("Cache-Control", "max-age=0"); 26 request.setHTTPHeaderField("Cache-Control", "max-age=0");
28 request.setAllowStoredCredentials(true); 27 request.setAllowStoredCredentials(true);
29 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); 28 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource);
30 frame->loader().fetchContext().setFirstPartyForCookies(request); 29 frame->loader().fetchContext().setFirstPartyForCookies(request);
31 } 30 }
32 31
33 void BeaconLoader::issueRequest(LocalFrame* frame, ResourceRequest& request) 32 void BeaconLoader::issueRequest(LocalFrame* frame, ResourceRequest& request)
34 { 33 {
35 FetchInitiatorInfo initiatorInfo; 34 FetchInitiatorInfo initiatorInfo;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 AtomicString contentType = AtomicString("multipart/form-data; boundary=", At omicString::ConstructFromLiteral) + entityBody->boundary().data(); 120 AtomicString contentType = AtomicString("multipart/form-data; boundary=", At omicString::ConstructFromLiteral) + entityBody->boundary().data();
122 request.setHTTPBody(entityBody.release()); 121 request.setHTTPBody(entityBody.release());
123 request.setHTTPContentType(contentType); 122 request.setHTTPContentType(contentType);
124 123
125 issueRequest(frame, request); 124 issueRequest(frame, request);
126 payloadLength = entitySize; 125 payloadLength = entitySize;
127 return true; 126 return true;
128 } 127 }
129 128
130 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698