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 "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 ASSERT(SchemeRegistry::shouldTreatURLSchemeAsSupportingFetchAPI(m_request->u
rl().protocol()) || (m_request->url().protocolIs("blob") && !corsFlag && !corsPr
eflightFlag)); | 519 ASSERT(SchemeRegistry::shouldTreatURLSchemeAsSupportingFetchAPI(m_request->u
rl().protocol()) || (m_request->url().protocolIs("blob") && !corsFlag && !corsPr
eflightFlag)); |
520 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo
ader. | 520 // CORS preflight fetch procedure is implemented inside DocumentThreadableLo
ader. |
521 | 521 |
522 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s | 522 // "1. Let |HTTPRequest| be a copy of |request|, except that |HTTPRequest|'s |
523 // body is a tee of |request|'s body." | 523 // body is a tee of |request|'s body." |
524 // We use ResourceRequest class for HTTPRequest. | 524 // We use ResourceRequest class for HTTPRequest. |
525 // FIXME: Support body. | 525 // FIXME: Support body. |
526 ResourceRequest request(m_request->url()); | 526 ResourceRequest request(m_request->url()); |
527 request.setRequestContext(m_request->context()); | 527 request.setRequestContext(m_request->context()); |
528 request.setHTTPMethod(m_request->method()); | 528 request.setHTTPMethod(m_request->method()); |
| 529 request.setFetchRequestMode(m_request->mode()); |
| 530 request.setFetchCredentialsMode(m_request->credentials()); |
529 const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList(
)->list(); | 531 const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList(
)->list(); |
530 for (size_t i = 0; i < list.size(); ++i) { | 532 for (size_t i = 0; i < list.size(); ++i) { |
531 request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(li
st[i]->second)); | 533 request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(li
st[i]->second)); |
532 } | 534 } |
533 | 535 |
534 if (m_request->method() != HTTPNames::GET && m_request->method() != HTTPName
s::HEAD) { | 536 if (m_request->method() != HTTPNames::GET && m_request->method() != HTTPName
s::HEAD) { |
535 if (m_request->buffer()) { | 537 if (m_request->buffer()) { |
536 request.setHTTPBody(m_request->buffer()->drainAsFormData()); | 538 request.setHTTPBody(m_request->buffer()->drainAsFormData()); |
537 } | 539 } |
538 } | 540 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 loader->dispose(); | 716 loader->dispose(); |
715 } | 717 } |
716 | 718 |
717 DEFINE_TRACE(FetchManager) | 719 DEFINE_TRACE(FetchManager) |
718 { | 720 { |
719 visitor->trace(m_executionContext); | 721 visitor->trace(m_executionContext); |
720 visitor->trace(m_loaders); | 722 visitor->trace(m_loaders); |
721 } | 723 } |
722 | 724 |
723 } // namespace blink | 725 } // namespace blink |
OLD | NEW |