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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp

Issue 1749153002: CORS-RFC1918: Teach ResourceRequest about "external" requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Jochen's feedback. Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/fetch/FetchBlobDataConsumerHandle.h" 5 #include "modules/fetch/FetchBlobDataConsumerHandle.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/fetch/FetchInitiatorTypeNames.h" 8 #include "core/fetch/FetchInitiatorTypeNames.h"
9 #include "core/loader/ThreadableLoaderClient.h" 9 #include "core/loader/ThreadableLoaderClient.h"
10 #include "modules/fetch/CompositeDataConsumerHandle.h" 10 #include "modules/fetch/CompositeDataConsumerHandle.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return; 89 return;
90 } 90 }
91 BlobRegistry::registerPublicBlobURL(executionContext->securityOrigin(), url, m_blobDataHandle); 91 BlobRegistry::registerPublicBlobURL(executionContext->securityOrigin(), url, m_blobDataHandle);
92 92
93 m_loader = createLoader(executionContext, this); 93 m_loader = createLoader(executionContext, this);
94 ASSERT(m_loader); 94 ASSERT(m_loader);
95 95
96 ResourceRequest request(url); 96 ResourceRequest request(url);
97 request.setRequestContext(WebURLRequest::RequestContextInternal); 97 request.setRequestContext(WebURLRequest::RequestContextInternal);
98 request.setUseStreamOnResponse(true); 98 request.setUseStreamOnResponse(true);
99 // We intentionally skip 'setExternalRequestStateFromRequestorAddressSpa ce', as 'data:' can never be external.
99 m_loader->start(request); 100 m_loader->start(request);
100 } 101 }
101 102
102 private: 103 private:
103 PassRefPtr<ThreadableLoader> createLoader(ExecutionContext* executionContext , ThreadableLoaderClient* client) const 104 PassRefPtr<ThreadableLoader> createLoader(ExecutionContext* executionContext , ThreadableLoaderClient* client) const
104 { 105 {
105 ThreadableLoaderOptions options; 106 ThreadableLoaderOptions options;
106 options.preflightPolicy = ConsiderPreflight; 107 options.preflightPolicy = ConsiderPreflight;
107 options.crossOriginRequestPolicy = DenyCrossOriginRequests; 108 options.crossOriginRequestPolicy = DenyCrossOriginRequests;
108 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPo licy; 109 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPo licy;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 305
305 return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHa ndle, new DefaultLoaderFactory)); 306 return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHa ndle, new DefaultLoaderFactory));
306 } 307 }
307 308
308 FetchDataConsumerHandle::Reader* FetchBlobDataConsumerHandle::obtainReaderIntern al(Client* client) 309 FetchDataConsumerHandle::Reader* FetchBlobDataConsumerHandle::obtainReaderIntern al(Client* client)
309 { 310 {
310 return m_readerContext->obtainReader(client).leakPtr(); 311 return m_readerContext->obtainReader(client).leakPtr();
311 } 312 }
312 313
313 } // namespace blink 314 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698