| 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 "modules/fetch/FetchManager.h" | 5 #include "modules/fetch/FetchManager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 719 |
| 720 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s | 720 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s |
| 721 // body is a tee of |request|'s body." | 721 // body is a tee of |request|'s body." |
| 722 // We use ResourceRequest class for HTTPRequest. | 722 // We use ResourceRequest class for HTTPRequest. |
| 723 // FIXME: Support body. | 723 // FIXME: Support body. |
| 724 ResourceRequest request(m_request->url()); | 724 ResourceRequest request(m_request->url()); |
| 725 request.setRequestContext(m_request->context()); | 725 request.setRequestContext(m_request->context()); |
| 726 request.setHTTPMethod(m_request->method()); | 726 request.setHTTPMethod(m_request->method()); |
| 727 request.setFetchRequestMode(m_request->mode()); | 727 request.setFetchRequestMode(m_request->mode()); |
| 728 request.setFetchCredentialsMode(m_request->credentials()); | 728 request.setFetchCredentialsMode(m_request->credentials()); |
| 729 const Vector<std::unique_ptr<FetchHeaderList::Header>>& list = | 729 for (const auto& header : m_request->headerList()->list()) { |
| 730 m_request->headerList()->list(); | 730 request.addHTTPHeaderField(AtomicString(header.first), |
| 731 for (size_t i = 0; i < list.size(); ++i) { | 731 AtomicString(header.second)); |
| 732 request.addHTTPHeaderField(AtomicString(list[i]->first), | |
| 733 AtomicString(list[i]->second)); | |
| 734 } | 732 } |
| 735 | 733 |
| 736 if (m_request->method() != HTTPNames::GET && | 734 if (m_request->method() != HTTPNames::GET && |
| 737 m_request->method() != HTTPNames::HEAD) { | 735 m_request->method() != HTTPNames::HEAD) { |
| 738 if (m_request->buffer()) | 736 if (m_request->buffer()) |
| 739 request.setHTTPBody(m_request->buffer()->drainAsFormData()); | 737 request.setHTTPBody(m_request->buffer()->drainAsFormData()); |
| 740 if (m_request->attachedCredential()) | 738 if (m_request->attachedCredential()) |
| 741 request.setAttachedCredential(m_request->attachedCredential()); | 739 request.setAttachedCredential(m_request->attachedCredential()); |
| 742 } | 740 } |
| 743 request.setFetchRedirectMode(m_request->redirect()); | 741 request.setFetchRedirectMode(m_request->redirect()); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 m_loaders.erase(loader); | 930 m_loaders.erase(loader); |
| 933 loader->dispose(); | 931 loader->dispose(); |
| 934 } | 932 } |
| 935 | 933 |
| 936 DEFINE_TRACE(FetchManager) { | 934 DEFINE_TRACE(FetchManager) { |
| 937 visitor->trace(m_loaders); | 935 visitor->trace(m_loaders); |
| 938 ContextLifecycleObserver::trace(visitor); | 936 ContextLifecycleObserver::trace(visitor); |
| 939 } | 937 } |
| 940 | 938 |
| 941 } // namespace blink | 939 } // namespace blink |
| OLD | NEW |