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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 // FIXME: Support body. | 263 // FIXME: Support body. |
264 ResourceRequest request(m_request->url()); | 264 ResourceRequest request(m_request->url()); |
265 request.setRequestContext(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 if (m_request->method() != "GET" && m_request->method() != "HEAD") { | |
michaeln1
2014/09/03 20:03:44
Would it be better to test positive for "POST" and
horo
2014/09/04 05:21:01
I want to do the same as XMLHttpRequest.
performHT
| |
274 RefPtr<BlobDataHandle> blobDataHandle = m_request->blobDataHandle(); | |
275 if (blobDataHandle.get()) { | |
276 RefPtr<FormData> httpBody(FormData::create()); | |
277 httpBody->appendBlob(blobDataHandle->uuid(), blobDataHandle); | |
278 request.setHTTPBody(httpBody); | |
279 } | |
280 } | |
281 | |
273 // "2. Append `Referer`/empty byte sequence, if |HTTPRequest|'s |referrer| | 282 // "2. Append `Referer`/empty byte sequence, if |HTTPRequest|'s |referrer| |
274 // is none, and `Referer`/|HTTPRequest|'s referrer, serialized and utf-8 | 283 // is none, and `Referer`/|HTTPRequest|'s referrer, serialized and utf-8 |
275 // encoded, otherwise, to HTTPRequest's header list. | 284 // encoded, otherwise, to HTTPRequest's header list. |
276 // We set the referrer using workerGlobalScope's URL in | 285 // We set the referrer using workerGlobalScope's URL in |
277 // WorkerThreadableLoader. | 286 // WorkerThreadableLoader. |
278 | 287 |
279 // "3. Append `Host`, ..." | 288 // "3. Append `Host`, ..." |
280 // FIXME: Implement this when the spec is fixed. | 289 // FIXME: Implement this when the spec is fixed. |
281 | 290 |
282 // "4.If |HTTPRequest|'s force Origin header flag is set, append `Origin`/ | 291 // "4.If |HTTPRequest|'s force Origin header flag is set, append `Origin`/ |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 loader->start(); | 355 loader->start(); |
347 return promise; | 356 return promise; |
348 } | 357 } |
349 | 358 |
350 void FetchManager::onLoaderFinished(Loader* loader) | 359 void FetchManager::onLoaderFinished(Loader* loader) |
351 { | 360 { |
352 m_loaders.remove(loader); | 361 m_loaders.remove(loader); |
353 } | 362 } |
354 | 363 |
355 } // namespace blink | 364 } // namespace blink |
OLD | NEW |