Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <title>Service Workers: Request Objects</title> |
| 4 | <head> |
| 5 | <link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#request-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 | <script type=text/plain id="idl_0"> |
| 16 | [Constructor(optional RequestInit init)] |
| 17 | interface Request { |
| 18 | attribute unsigned long timeout; |
| 19 | attribute DOMString url; |
| 20 | attribute ByteString method; |
| 21 | readonly attribute DOMString origin; |
| 22 | readonly attribute Mode mode; |
| 23 | attribute boolean synchronous; |
| 24 | attribute boolean forcePreflight; |
| 25 | attribute boolean omitCredentials; |
| 26 | readonly attribute DOMString referrer; |
| 27 | readonly attribute HeaderMap headers; // alternative: sequence<Header> headers; |
| 28 | attribute any body; |
| 29 | }; |
| 30 | |
| 31 | dictionary RequestInit { |
| 32 | unsigned long timeout = 0; |
| 33 | DOMString url; |
| 34 | boolean synchronous = false; |
| 35 | boolean forcePreflight = false; |
| 36 | boolean omitCredentials = false; |
| 37 | ByteString method = "GET"; |
| 38 | HeaderMap headers; |
| 39 | any body; |
| 40 | }; |
| 41 | |
| 42 | enum Mode { |
| 43 | "same origin", |
| 44 | "tainted cross-origin", |
| 45 | "CORS", |
| 46 | "CORS-with-forced-preflight" |
| 47 | }; |
| 48 | |
| 49 | [MapClass(DOMString, DOMString)] |
| 50 | interface HeaderMap { |
| 51 | }; |
| 52 | </pre> |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | <script> |
| 58 | var idl_array = new IdlArray(); |
| 59 | idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); |
| 60 | idl_array.add_idls(document.getElementById("idl_0").textContent); |
| 61 | idl_array.add_objects({ |
| 62 | Request: ["throw new Error ('No object defined for the Request interface')"], |
| 63 | RequestInit: ["throw new Error ('No object defined for the RequestInit dictionary')"], |
| 64 | Mode: ["throw new Error ('No object defined for the Mode enum')"], |
| 65 | HeaderMap: ["throw new Error ('No object defined for the HeaderMap interface')"] |
| 66 | }); |
| 67 | idl_array.test(); |
| 68 | </script> |
| 69 | |
| 70 | </body> |
| 71 | </html> |
| 72 | |