OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Request 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="request-idl" type="text/plain"> |
| 31 typedef (Request or USVString) RequestInfo; |
| 32 |
| 33 [Constructor(RequestInfo input, optional RequestInit init), |
| 34 Exposed=(Window,Worker)] |
| 35 interface Request { |
| 36 readonly attribute ByteString method; |
| 37 readonly attribute USVString url; |
| 38 [SameObject] readonly attribute Headers headers; |
| 39 |
| 40 readonly attribute RequestType type; |
| 41 readonly attribute RequestDestination destination; |
| 42 readonly attribute USVString referrer; |
| 43 readonly attribute ReferrerPolicy referrerPolicy; |
| 44 readonly attribute RequestMode mode; |
| 45 readonly attribute RequestCredentials credentials; |
| 46 readonly attribute RequestCache cache; |
| 47 readonly attribute RequestRedirect redirect; |
| 48 readonly attribute DOMString integrity; |
| 49 |
| 50 [NewObject] Request clone(); |
| 51 }; |
| 52 Request implements Body; |
| 53 |
| 54 dictionary RequestInit { |
| 55 ByteString method; |
| 56 HeadersInit headers; |
| 57 BodyInit? body; |
| 58 USVString referrer; |
| 59 ReferrerPolicy referrerPolicy; |
| 60 RequestMode mode; |
| 61 RequestCredentials credentials; |
| 62 RequestCache cache; |
| 63 RequestRedirect redirect; |
| 64 DOMString integrity; |
| 65 any window; // can only be set to null |
| 66 }; |
| 67 |
| 68 enum RequestType { "", "audio", "font", "image", "script", "style", "track
", "video" }; |
| 69 enum RequestDestination { "", "document", "sharedworker", "subresource", "
unknown", "worker" }; |
| 70 enum RequestMode { "navigate", "same-origin", "no-cors", "cors" }; |
| 71 enum RequestCredentials { "omit", "same-origin", "include" }; |
| 72 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-ca
che", "only-if-cached" }; |
| 73 enum RequestRedirect { "follow", "error", "manual" }; |
| 74 enum ReferrerPolicy { |
| 75 "", "no-referrer", "no-referrer-when-downgrade", "origin", |
| 76 "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin"
, |
| 77 "strict-origin-when-cross-origin" |
| 78 }; |
| 79 </script> |
| 80 <script> |
| 81 var idlsArray = new IdlArray(); |
| 82 var idl = document.getElementById("body-idl").textContent |
| 83 idl += document.getElementById("request-idl").textContent |
| 84 |
| 85 idlsArray.add_idls(idl); |
| 86 idlsArray.add_untested_idls("interface Headers {};"); |
| 87 idlsArray.add_objects({ Request: ['new Request("")'] }); |
| 88 idlsArray.test(); |
| 89 </script> |
| 90 </body> |
| 91 </html> |
OLD | NEW |