blob: a3345864c25c87bf903c0aca63e2fc7aefa76f09 [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001<!DOCTYPE html>
2<html>
3<title>Service Workers: Response Objects</title>
4 <head>
5 <link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#response-objects">
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]
20interface AbstractResponse {
21};
22
23interface 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
32interface CORSResponse : Response {
33 readonly attribute HeaderMap headers;
34};
35
36[Constructor(optional ResponseInit responseInitDict)]
37interface 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
45dictionary 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").textContent);
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 AbstractResponse interface')"],
65 OpaqueResponse: ["throw new Error ('No object defined for the OpaqueResponse interface')"],
66 CORSResponse: ["throw new Error ('No object defined for the CORSResponse interface')"],
67 Response: ["throw new Error ('No object defined for the Response interface')"],
68 ResponseInit: ["throw new Error ('No object defined for the ResponseInit dictionary')"]
69 });
70 idl_array.test();
71 </script>
72
73 </body>
74</html>
75