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/Request.h" | 6 #include "modules/fetch/Request.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Request object, and a new request otherwise." | 58 // Request object, and a new request otherwise." |
59 // "3. Set |request| to a new request whose url is |request|'s url, method | 59 // "3. Set |request| to a new request whose url is |request|'s url, method |
60 // is |request|'s method, header list is a copy of |request|'s header list, | 60 // is |request|'s method, header list is a copy of |request|'s header list, |
61 // unsafe request flag is set, body is |request|'s body, client is entry | 61 // unsafe request flag is set, body is |request|'s body, client is entry |
62 // settings object, origin is entry settings object's origin, force Origin | 62 // settings object, origin is entry settings object's origin, force Origin |
63 // header flag is set, same-origin data URL flag is set, referrer is client, | 63 // header flag is set, same-origin data URL flag is set, referrer is client, |
64 // context is fetch, mode is |request|'s mode, credentials mode is | 64 // context is fetch, mode is |request|'s mode, credentials mode is |
65 // |request|'s credentials mode, and cache mode is |request|'s cache mode." | 65 // |request|'s credentials mode, and cache mode is |request|'s cache mode." |
66 FetchRequestData* request = createCopyOfFetchRequestDataForFetch(context, in
putRequest ? inputRequest->request() : FetchRequestData::create()); | 66 FetchRequestData* request = createCopyOfFetchRequestDataForFetch(context, in
putRequest ? inputRequest->request() : FetchRequestData::create()); |
67 | 67 |
| 68 if (inputRequest && inputRequest->blobDataHandle() && inputRequest->isBodyCo
nsumed()) { |
| 69 // Currently the only methods that can consume body data without |
| 70 // setting 'body passed' flag consume entire body (e.g. text()). Thus |
| 71 // we can set an empty blob to the new request instead of creating a |
| 72 // draining stream. |
| 73 // TODO(yhirano): Fix this once Request.body is introduced. |
| 74 OwnPtr<BlobData> blobData = BlobData::create(); |
| 75 blobData->setContentType(inputRequest->blobDataHandle()->type()); |
| 76 request->setBlobDataHandle(BlobDataHandle::create(blobData.release(), 0)
); |
| 77 } |
| 78 |
68 // "4. Let |fallbackMode| be null." | 79 // "4. Let |fallbackMode| be null." |
69 // "5. Let |fallbackCredentials| be null." | 80 // "5. Let |fallbackCredentials| be null." |
70 // "6. Let |fallbackCache| be null." | 81 // "6. Let |fallbackCache| be null." |
71 // We don't use fallback values. We set these flags directly in below. | 82 // We don't use fallback values. We set these flags directly in below. |
72 | 83 |
73 // "7. If |input| is a string, run these substeps:" | 84 // "7. If |input| is a string, run these substeps:" |
74 if (!inputRequest) { | 85 if (!inputRequest) { |
75 // "1. Let |parsedURL| be the result of parsing |input| with entry | 86 // "1. Let |parsedURL| be the result of parsing |input| with entry |
76 // settings object's API base URL." | 87 // settings object's API base URL." |
77 KURL parsedURL = context->completeURL(inputString); | 88 KURL parsedURL = context->completeURL(inputString); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 406 } |
396 | 407 |
397 DEFINE_TRACE(Request) | 408 DEFINE_TRACE(Request) |
398 { | 409 { |
399 Body::trace(visitor); | 410 Body::trace(visitor); |
400 visitor->trace(m_request); | 411 visitor->trace(m_request); |
401 visitor->trace(m_headers); | 412 visitor->trace(m_headers); |
402 } | 413 } |
403 | 414 |
404 } // namespace blink | 415 } // namespace blink |
OLD | NEW |