OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <title>Service Workers: Response Objects</title> |
| 4 <head> |
| 5 <link rel="help" href="https://w3c.github.io/ServiceWorker/#response-obj
ects"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 |
| 9 <script src=/resources/WebIDLParser.js></script> |
| 10 <script src=/resources/idlharness.js></script> |
| 11 |
| 12 </head> |
| 13 <body> |
| 14 |
| 15 <!-- |
| 16 `Response` objects model HTTP responses. |
| 17 --> |
| 18 <script type=text/plain id="idl_0"> |
| 19 [Constructor] |
| 20 interface AbstractResponse { |
| 21 }; |
| 22 |
| 23 interface OpaqueResponse : AbstractResponse { |
| 24 readonly attribute unsigned short status; |
| 25 readonly attribute ByteString statusText; |
| 26 // Returns a filtered list of headers. See prose for details. |
| 27 readonly attribute HeaderMap headers; |
| 28 // No setter for headers |
| 29 readonly attribute DOMString url; |
| 30 }; |
| 31 |
| 32 interface CORSResponse : Response { |
| 33 readonly attribute HeaderMap headers; |
| 34 }; |
| 35 |
| 36 [Constructor(optional ResponseInit responseInitDict)] |
| 37 interface Response : AbstractResponse { |
| 38 attribute unsigned short status; |
| 39 attribute ByteString statusText; |
| 40 readonly attribute HeaderMap headers; |
| 41 attribute DOMString url; |
| 42 Promise<Blob> toBlob(); |
| 43 }; |
| 44 |
| 45 dictionary ResponseInit { |
| 46 unsigned short status = 200; |
| 47 ByteString statusText = "OK"; |
| 48 HeaderMap headers; |
| 49 }; |
| 50 </pre> |
| 51 |
| 52 |
| 53 |
| 54 <script type=text/plain id="untested_idls"> |
| 55 interface HeaderMap {}; |
| 56 interface Blob {}; |
| 57 </pre> |
| 58 |
| 59 <script> |
| 60 var idl_array = new IdlArray(); |
| 61 idl_array.add_untested_idls(document.getElementById("untested_idls").tex
tContent); |
| 62 idl_array.add_idls(document.getElementById("idl_0").textContent); |
| 63 idl_array.add_objects({ |
| 64 AbstractResponse: ["throw new Error ('No object defined for the Abst
ractResponse interface')"], |
| 65 OpaqueResponse: ["throw new Error ('No object defined for the Opaque
Response interface')"], |
| 66 CORSResponse: ["throw new Error ('No object defined for the CORSResp
onse interface')"], |
| 67 Response: ["throw new Error ('No object defined for the Response int
erface')"], |
| 68 ResponseInit: ["throw new Error ('No object defined for the Response
Init dictionary')"] |
| 69 }); |
| 70 idl_array.test(); |
| 71 </script> |
| 72 |
| 73 </body> |
| 74 </html> |
| 75 |
OLD | NEW |