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 "Response.h" | 6 #include "Response.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 case WebServiceWorkerResponseTypeError: | 52 case WebServiceWorkerResponseTypeError: |
53 ASSERT(response->type() == FetchResponseData::ErrorType); | 53 ASSERT(response->type() == FetchResponseData::ErrorType); |
54 break; | 54 break; |
55 } | 55 } |
56 | 56 |
57 return response; | 57 return response; |
58 } | 58 } |
59 | 59 |
60 } | 60 } |
61 | 61 |
| 62 Response* Response::create(ExecutionContext* context, ExceptionState& exceptionS
tate) |
| 63 { |
| 64 return create(context, nullptr, ResponseInit(), exceptionState); |
| 65 } |
| 66 |
62 Response* Response::create(ExecutionContext* context, Blob* body, const Dictiona
ry& responseInit, ExceptionState& exceptionState) | 67 Response* Response::create(ExecutionContext* context, Blob* body, const Dictiona
ry& responseInit, ExceptionState& exceptionState) |
63 { | 68 { |
| 69 ASSERT(body); |
64 return create(context, body, ResponseInit(responseInit, exceptionState), exc
eptionState); | 70 return create(context, body, ResponseInit(responseInit, exceptionState), exc
eptionState); |
65 } | 71 } |
66 | 72 |
67 Response* Response::create(ExecutionContext* context, const String& body, const
Dictionary& responseInit, ExceptionState& exceptionState) | 73 Response* Response::create(ExecutionContext* context, const String& body, const
Dictionary& responseInit, ExceptionState& exceptionState) |
68 { | 74 { |
69 OwnPtr<BlobData> blobData = BlobData::create(); | 75 OwnPtr<BlobData> blobData = BlobData::create(); |
70 blobData->appendText(body, false); | 76 blobData->appendText(body, false); |
71 // "Set |Content-Type| to `text/plain;charset=UTF-8`." | 77 // "Set |Content-Type| to `text/plain;charset=UTF-8`." |
72 blobData->setContentType("text/plain;charset=UTF-8"); | 78 blobData->setContentType("text/plain;charset=UTF-8"); |
73 const long long length = blobData->length(); | 79 const long long length = blobData->length(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 270 } |
265 | 271 |
266 void Response::trace(Visitor* visitor) | 272 void Response::trace(Visitor* visitor) |
267 { | 273 { |
268 Body::trace(visitor); | 274 Body::trace(visitor); |
269 visitor->trace(m_response); | 275 visitor->trace(m_response); |
270 visitor->trace(m_headers); | 276 visitor->trace(m_headers); |
271 } | 277 } |
272 | 278 |
273 } // namespace blink | 279 } // namespace blink |
OLD | NEW |