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/Response.h" | 5 #include "modules/fetch/Response.h" |
6 | 6 |
7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/V8ArrayBuffer.h" | 10 #include "bindings/core/v8/V8ArrayBuffer.h" |
11 #include "bindings/core/v8/V8ArrayBufferView.h" | 11 #include "bindings/core/v8/V8ArrayBufferView.h" |
12 #include "bindings/core/v8/V8Binding.h" | 12 #include "bindings/core/v8/V8Binding.h" |
13 #include "bindings/core/v8/V8Blob.h" | 13 #include "bindings/core/v8/V8Blob.h" |
14 #include "bindings/core/v8/V8FormData.h" | 14 #include "bindings/core/v8/V8FormData.h" |
15 #include "bindings/core/v8/V8HiddenValue.h" | 15 #include "bindings/core/v8/V8HiddenValue.h" |
16 #include "bindings/core/v8/V8URLSearchParams.h" | 16 #include "bindings/core/v8/V8URLSearchParams.h" |
17 #include "core/dom/DOMArrayBuffer.h" | 17 #include "core/dom/DOMArrayBuffer.h" |
18 #include "core/dom/DOMArrayBufferView.h" | 18 #include "core/dom/DOMArrayBufferView.h" |
19 #include "core/dom/URLSearchParams.h" | 19 #include "core/dom/URLSearchParams.h" |
| 20 #include "core/fetch/FetchUtils.h" |
20 #include "core/fileapi/Blob.h" | 21 #include "core/fileapi/Blob.h" |
21 #include "core/html/FormData.h" | 22 #include "core/html/FormData.h" |
22 #include "core/streams/ReadableStreamOperations.h" | 23 #include "core/streams/ReadableStreamOperations.h" |
23 #include "modules/fetch/BlobBytesConsumer.h" | 24 #include "modules/fetch/BlobBytesConsumer.h" |
24 #include "modules/fetch/BodyStreamBuffer.h" | 25 #include "modules/fetch/BodyStreamBuffer.h" |
25 #include "modules/fetch/FormDataBytesConsumer.h" | 26 #include "modules/fetch/FormDataBytesConsumer.h" |
26 #include "modules/fetch/ResponseInit.h" | 27 #include "modules/fetch/ResponseInit.h" |
27 #include "platform/network/EncodedFormData.h" | 28 #include "platform/network/EncodedFormData.h" |
28 #include "platform/network/HTTPHeaderMap.h" | 29 #include "platform/network/HTTPHeaderMap.h" |
29 #include "platform/network/NetworkUtils.h" | 30 #include "platform/network/NetworkUtils.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 370 } |
370 | 371 |
371 unsigned short Response::status() const { | 372 unsigned short Response::status() const { |
372 // "The status attribute's getter must return response's status." | 373 // "The status attribute's getter must return response's status." |
373 return m_response->status(); | 374 return m_response->status(); |
374 } | 375 } |
375 | 376 |
376 bool Response::ok() const { | 377 bool Response::ok() const { |
377 // "The ok attribute's getter must return true | 378 // "The ok attribute's getter must return true |
378 // if response's status is in the range 200 to 299, and false otherwise." | 379 // if response's status is in the range 200 to 299, and false otherwise." |
379 return 200 <= status() && status() <= 299; | 380 return FetchUtils::isOkStatus(status()); |
380 } | 381 } |
381 | 382 |
382 String Response::statusText() const { | 383 String Response::statusText() const { |
383 // "The statusText attribute's getter must return response's status message." | 384 // "The statusText attribute's getter must return response's status message." |
384 return m_response->statusMessage(); | 385 return m_response->statusMessage(); |
385 } | 386 } |
386 | 387 |
387 Headers* Response::headers() const { | 388 Headers* Response::headers() const { |
388 // "The headers attribute's getter must return the associated Headers object." | 389 // "The headers attribute's getter must return the associated Headers object." |
389 return m_headers; | 390 return m_headers; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 476 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
476 } | 477 } |
477 | 478 |
478 DEFINE_TRACE(Response) { | 479 DEFINE_TRACE(Response) { |
479 Body::trace(visitor); | 480 Body::trace(visitor); |
480 visitor->trace(m_response); | 481 visitor->trace(m_response); |
481 visitor->trace(m_headers); | 482 visitor->trace(m_headers); |
482 } | 483 } |
483 | 484 |
484 } // namespace blink | 485 } // namespace blink |
OLD | NEW |