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" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return response; | 196 return response; |
197 } | 197 } |
198 | 198 |
199 Response* Response::create(ScriptState* scriptState, | 199 Response* Response::create(ScriptState* scriptState, |
200 BodyStreamBuffer* body, | 200 BodyStreamBuffer* body, |
201 const String& contentType, | 201 const String& contentType, |
202 const ResponseInit& init, | 202 const ResponseInit& init, |
203 ExceptionState& exceptionState) { | 203 ExceptionState& exceptionState) { |
204 unsigned short status = init.status; | 204 unsigned short status = init.status; |
205 | 205 |
206 // "1. If |init|'s status member is not in the range 200 to 599, inclusive, th
row a | 206 // "1. If |init|'s status member is not in the range 200 to 599, inclusive, |
207 // RangeError." | 207 // throw a RangeError." |
208 if (status < 200 || 599 < status) { | 208 if (status < 200 || 599 < status) { |
209 exceptionState.throwRangeError( | 209 exceptionState.throwRangeError( |
210 ExceptionMessages::indexOutsideRange<unsigned>( | 210 ExceptionMessages::indexOutsideRange<unsigned>( |
211 "status", status, 200, ExceptionMessages::InclusiveBound, 599, | 211 "status", status, 200, ExceptionMessages::InclusiveBound, 599, |
212 ExceptionMessages::InclusiveBound)); | 212 ExceptionMessages::InclusiveBound)); |
213 return nullptr; | 213 return nullptr; |
214 } | 214 } |
215 | 215 |
216 // "2. If |init|'s statusText member does not match the Reason-Phrase | 216 // "2. If |init|'s statusText member does not match the Reason-Phrase |
217 // token production, throw a TypeError." | 217 // token production, throw a TypeError." |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 461 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
462 } | 462 } |
463 | 463 |
464 DEFINE_TRACE(Response) { | 464 DEFINE_TRACE(Response) { |
465 Body::trace(visitor); | 465 Body::trace(visitor); |
466 visitor->trace(m_response); | 466 visitor->trace(m_response); |
467 visitor->trace(m_headers); | 467 visitor->trace(m_headers); |
468 } | 468 } |
469 | 469 |
470 } // namespace blink | 470 } // namespace blink |
OLD | NEW |