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 // http://fetch.spec.whatwg.org/#response-class | 5 // http://fetch.spec.whatwg.org/#response-class |
6 | 6 |
7 enum ResponseType { "basic", "cors", "default", "error", "opaque" }; | 7 enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredire
ct" }; |
8 | |
9 // FIXME: Add union type: URLSearchParams | |
10 typedef (Blob or ArrayBuffer or ArrayBufferView or FormData or USVString) BodyIn
it; | |
11 | 8 |
12 [ | 9 [ |
13 Constructor(optional BodyInit body, optional Dictionary responseInitDict), | 10 // TODO(yhirano): We use "any" for body because the IDL processor doesn't |
14 ConstructorCallWith=ExecutionContext, | 11 // recognize ReadableStream implemented with V8 extras. Fix it. |
| 12 Constructor(optional any body, optional Dictionary responseInitDict), |
| 13 ConstructorCallWith=ScriptState, |
15 Exposed=(Window,Worker), | 14 Exposed=(Window,Worker), |
16 RaisesException=Constructor, | 15 RaisesException=Constructor, |
17 ActiveDOMObject, | 16 DependentLifetime, |
18 GarbageCollected, | 17 GarbageCollected, |
19 TypeChecking=Interface, | |
20 ] interface Response { | 18 ] interface Response { |
21 [CallWith=ExecutionContext] static Response error(); | 19 [CallWith=ExecutionContext] static Response error(); |
22 [CallWith=ExecutionContext, RaisesException] static Response redirect(USVStr
ing url, optional unsigned short status = 302); | 20 [CallWith=ExecutionContext, RaisesException] static Response redirect(USVStr
ing url, optional unsigned short status = 302); |
23 readonly attribute ResponseType type; | 21 readonly attribute ResponseType type; |
24 readonly attribute USVString url; | 22 readonly attribute USVString url; |
25 readonly attribute unsigned short status; | 23 readonly attribute unsigned short status; |
26 readonly attribute boolean ok; | 24 readonly attribute boolean ok; |
27 readonly attribute ByteString statusText; | 25 readonly attribute ByteString statusText; |
28 readonly attribute Headers headers; | 26 readonly attribute Headers headers; |
29 | 27 |
30 [RaisesException] Response clone(); | 28 [RaisesException] Response clone(); |
31 | 29 |
32 readonly attribute ReadableByteStream body; | 30 [ImplementedAs=bodyWithUseCounter] readonly attribute ReadableByteStream bod
y; |
33 }; | 31 }; |
34 | 32 |
35 Response implements Body; | 33 Response implements Body; |
OLD | NEW |