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 "FetchManager.h" | 6 #include "FetchManager.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 void FetchManager::Loader::performHTTPFetch() | 256 void FetchManager::Loader::performHTTPFetch() |
257 { | 257 { |
258 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo
ader. | 258 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo
ader. |
259 | 259 |
260 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s | 260 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s |
261 // body is a tee of |request|'s body." | 261 // body is a tee of |request|'s body." |
262 // We use ResourceRequest class for HTTPRequest. | 262 // We use ResourceRequest class for HTTPRequest. |
263 // FIXME: Support body. | 263 // FIXME: Support body. |
264 ResourceRequest request(m_request->url()); | 264 ResourceRequest request(m_request->url()); |
265 request.setRequestContext(blink::WebURLRequest::RequestContextFetch); | 265 request.setRequestContext(WebURLRequest::RequestContextFetch); |
266 request.setDownloadToFile(true); | 266 request.setDownloadToFile(true); |
267 request.setHTTPMethod(m_request->method()); | 267 request.setHTTPMethod(m_request->method()); |
268 const Vector<OwnPtr<FetchHeaderList::Header> >& list = m_request->headerList
()->list(); | 268 const Vector<OwnPtr<FetchHeaderList::Header> >& list = m_request->headerList
()->list(); |
269 for (size_t i = 0; i < list.size(); ++i) { | 269 for (size_t i = 0; i < list.size(); ++i) { |
270 request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(li
st[i]->second)); | 270 request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(li
st[i]->second)); |
271 } | 271 } |
272 | 272 |
273 // "2. Append `Referer`/empty byte sequence, if |HTTPRequest|'s |referrer| | 273 // "2. Append `Referer`/empty byte sequence, if |HTTPRequest|'s |referrer| |
274 // is none, and `Referer`/|HTTPRequest|'s referrer, serialized and utf-8 | 274 // is none, and `Referer`/|HTTPRequest|'s referrer, serialized and utf-8 |
275 // encoded, otherwise, to HTTPRequest's header list. | 275 // encoded, otherwise, to HTTPRequest's header list. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 loader->start(); | 346 loader->start(); |
347 return promise; | 347 return promise; |
348 } | 348 } |
349 | 349 |
350 void FetchManager::onLoaderFinished(Loader* loader) | 350 void FetchManager::onLoaderFinished(Loader* loader) |
351 { | 351 { |
352 m_loaders.remove(loader); | 352 m_loaders.remove(loader); |
353 } | 353 } |
354 | 354 |
355 } // namespace blink | 355 } // namespace blink |
OLD | NEW |