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