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/Request.h" | 5 #include "modules/fetch/Request.h" |
6 | 6 |
7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/fetch/FetchUtils.h" | 10 #include "core/fetch/FetchUtils.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 // "Set |r|'s MIME type to the result of extracting a MIME type from |r|'s | 402 // "Set |r|'s MIME type to the result of extracting a MIME type from |r|'s |
403 // request's header list." | 403 // request's header list." |
404 r->m_request->setMIMEType(r->m_request->headerList()->extractMIMEType()); | 404 r->m_request->setMIMEType(r->m_request->headerList()->extractMIMEType()); |
405 | 405 |
406 // "If |input| is a Request object and |input|'s request's body is | 406 // "If |input| is a Request object and |input|'s request's body is |
407 // non-null, run these substeps:" | 407 // non-null, run these substeps:" |
408 if (inputRequest && inputRequest->bodyBuffer()) { | 408 if (inputRequest && inputRequest->bodyBuffer()) { |
409 // "Let |dummyStream| be an empty ReadableStream object." | 409 // "Let |dummyStream| be an empty ReadableStream object." |
410 auto dummyStream = new BodyStreamBuffer( | 410 auto dummyStream = |
411 scriptState, createFetchDataConsumerHandleFromWebHandle( | 411 new BodyStreamBuffer(scriptState, BytesConsumer::createClosed()); |
412 createDoneDataConsumerHandle())); | |
413 // "Set |input|'s request's body to a new body whose stream is | 412 // "Set |input|'s request's body to a new body whose stream is |
414 // |dummyStream|." | 413 // |dummyStream|." |
415 inputRequest->m_request->setBuffer(dummyStream); | 414 inputRequest->m_request->setBuffer(dummyStream); |
416 inputRequest->refreshBody(scriptState); | 415 inputRequest->refreshBody(scriptState); |
417 // "Let |reader| be the result of getting reader from |dummyStream|." | 416 // "Let |reader| be the result of getting reader from |dummyStream|." |
418 // "Read all bytes from |dummyStream| with |reader|." | 417 // "Read all bytes from |dummyStream| with |reader|." |
419 inputRequest->bodyBuffer()->closeAndLockAndDisturb(); | 418 inputRequest->bodyBuffer()->closeAndLockAndDisturb(); |
420 } | 419 } |
421 | 420 |
422 // "Return |r|." | 421 // "Return |r|." |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 735 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
737 } | 736 } |
738 | 737 |
739 DEFINE_TRACE(Request) { | 738 DEFINE_TRACE(Request) { |
740 Body::trace(visitor); | 739 Body::trace(visitor); |
741 visitor->trace(m_request); | 740 visitor->trace(m_request); |
742 visitor->trace(m_headers); | 741 visitor->trace(m_headers); |
743 } | 742 } |
744 | 743 |
745 } // namespace blink | 744 } // namespace blink |
OLD | NEW |