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 "modules/fetch/FetchManager.h" | 6 #include "modules/fetch/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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 ASSERT(m_request->url().protocolIsInHTTPFamily()); | 272 ASSERT(m_request->url().protocolIsInHTTPFamily()); |
273 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo
ader. | 273 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo
ader. |
274 | 274 |
275 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s | 275 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s |
276 // body is a tee of |request|'s body." | 276 // body is a tee of |request|'s body." |
277 // We use ResourceRequest class for HTTPRequest. | 277 // We use ResourceRequest class for HTTPRequest. |
278 // FIXME: Support body. | 278 // FIXME: Support body. |
279 ResourceRequest request(m_request->url()); | 279 ResourceRequest request(m_request->url()); |
280 request.setRequestContext(WebURLRequest::RequestContextFetch); | 280 request.setRequestContext(WebURLRequest::RequestContextFetch); |
281 request.setHTTPMethod(m_request->method()); | 281 request.setHTTPMethod(m_request->method()); |
282 const Vector<OwnPtr<FetchHeaderList::Header> >& list = m_request->headerList
()->list(); | 282 const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList(
)->list(); |
283 for (size_t i = 0; i < list.size(); ++i) { | 283 for (size_t i = 0; i < list.size(); ++i) { |
284 request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(li
st[i]->second)); | 284 request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(li
st[i]->second)); |
285 } | 285 } |
286 | 286 |
287 if (m_request->method() != "GET" && m_request->method() != "HEAD") { | 287 if (m_request->method() != "GET" && m_request->method() != "HEAD") { |
288 RefPtr<BlobDataHandle> blobDataHandle = m_request->blobDataHandle(); | 288 RefPtr<BlobDataHandle> blobDataHandle = m_request->blobDataHandle(); |
289 if (blobDataHandle.get()) { | 289 if (blobDataHandle.get()) { |
290 RefPtr<FormData> httpBody(FormData::create()); | 290 RefPtr<FormData> httpBody(FormData::create()); |
291 httpBody->appendBlob(blobDataHandle->uuid(), blobDataHandle); | 291 httpBody->appendBlob(blobDataHandle->uuid(), blobDataHandle); |
292 request.setHTTPBody(httpBody); | 292 request.setHTTPBody(httpBody); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // We don't use remove here, becuase it may cause recursive deletion. | 403 // We don't use remove here, becuase it may cause recursive deletion. |
404 OwnPtr<Loader> p = m_loaders.take(loader); | 404 OwnPtr<Loader> p = m_loaders.take(loader); |
405 } | 405 } |
406 | 406 |
407 void FetchManager::trace(Visitor* visitor) | 407 void FetchManager::trace(Visitor* visitor) |
408 { | 408 { |
409 visitor->trace(m_executionContext); | 409 visitor->trace(m_executionContext); |
410 } | 410 } |
411 | 411 |
412 } // namespace blink | 412 } // namespace blink |
OLD | NEW |