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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 const KURL* responseURL = m_response->url(); | 357 const KURL* responseURL = m_response->url(); |
358 if (!responseURL) | 358 if (!responseURL) |
359 return emptyString(); | 359 return emptyString(); |
360 if (!responseURL->hasFragmentIdentifier()) | 360 if (!responseURL->hasFragmentIdentifier()) |
361 return *responseURL; | 361 return *responseURL; |
362 KURL url(*responseURL); | 362 KURL url(*responseURL); |
363 url.removeFragmentIdentifier(); | 363 url.removeFragmentIdentifier(); |
364 return url; | 364 return url; |
365 } | 365 } |
366 | 366 |
| 367 bool Response::redirected() const { |
| 368 return m_response->urlList().size() > 1; |
| 369 } |
| 370 |
367 unsigned short Response::status() const { | 371 unsigned short Response::status() const { |
368 // "The status attribute's getter must return response's status." | 372 // "The status attribute's getter must return response's status." |
369 return m_response->status(); | 373 return m_response->status(); |
370 } | 374 } |
371 | 375 |
372 bool Response::ok() const { | 376 bool Response::ok() const { |
373 // "The ok attribute's getter must return true | 377 // "The ok attribute's getter must return true |
374 // if response's status is in the range 200 to 299, and false otherwise." | 378 // if response's status is in the range 200 to 299, and false otherwise." |
375 return 200 <= status() && status() <= 299; | 379 return 200 <= status() && status() <= 299; |
376 } | 380 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 475 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
472 } | 476 } |
473 | 477 |
474 DEFINE_TRACE(Response) { | 478 DEFINE_TRACE(Response) { |
475 Body::trace(visitor); | 479 Body::trace(visitor); |
476 visitor->trace(m_response); | 480 visitor->trace(m_response); |
477 visitor->trace(m_headers); | 481 visitor->trace(m_headers); |
478 } | 482 } |
479 | 483 |
480 } // namespace blink | 484 } // namespace blink |
OLD | NEW |