OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Response idl interface</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#response"> |
| 7 <meta name="author" title="Canon Research France" href="https://www.crf.cano
n.fr"> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script src="/resources/WebIDLParser.js"></script> |
| 11 <script src="/resources/idlharness.js"></script> |
| 12 </head> |
| 13 <body> |
| 14 <script id="body-idl" type="text/plain"> |
| 15 typedef any JSON; |
| 16 typedef (Blob or BufferSource or FormData or URLSearchParams or USVString)
BodyInit; |
| 17 |
| 18 [NoInterfaceObject, |
| 19 Exposed=(Window,Worker)] |
| 20 interface Body { |
| 21 readonly attribute ReadableStream? body; |
| 22 readonly attribute boolean bodyUsed; |
| 23 [NewObject] Promise<ArrayBuffer> arrayBuffer(); |
| 24 [NewObject] Promise<Blob> blob(); |
| 25 [NewObject] Promise<FormData> formData(); |
| 26 [NewObject] Promise<JSON> json(); |
| 27 [NewObject] Promise<USVString> text(); |
| 28 }; |
| 29 </script> |
| 30 <script id="response-idl" type="text/plain"> |
| 31 [Constructor(optional BodyInit body, optional ResponseInit init), |
| 32 Exposed=(Window,Worker)] |
| 33 interface Response { |
| 34 [NewObject] static Response error(); |
| 35 [NewObject] static Response redirect(USVString url, optional unsigned sh
ort status = 302); |
| 36 |
| 37 readonly attribute ResponseType type; |
| 38 |
| 39 readonly attribute USVString url; |
| 40 readonly attribute unsigned short status; |
| 41 readonly attribute boolean ok; |
| 42 readonly attribute ByteString statusText; |
| 43 [SameObject] readonly attribute Headers headers; |
| 44 readonly attribute Promise<Headers> trailer; |
| 45 |
| 46 [NewObject] Response clone(); |
| 47 }; |
| 48 Response implements Body; |
| 49 |
| 50 dictionary ResponseInit { |
| 51 unsigned short status = 200; |
| 52 ByteString statusText = "OK"; |
| 53 HeadersInit headers; |
| 54 }; |
| 55 |
| 56 enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaque
redirect" }; |
| 57 </script> |
| 58 <script> |
| 59 var idlsArray = new IdlArray(); |
| 60 var idl = document.getElementById("body-idl").textContent |
| 61 idl += document.getElementById("response-idl").textContent |
| 62 |
| 63 idlsArray.add_idls(idl); |
| 64 idlsArray.add_untested_idls("interface Headers {};"); |
| 65 idlsArray.add_untested_idls("interface ReadableStream {};"); |
| 66 idlsArray.add_objects({ Response: ['new Response()'] }); |
| 67 idlsArray.test(); |
| 68 </script> |
| 69 </body> |
| 70 </html> |
OLD | NEW |