Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / webidl / Request.webidl
blob1aa6be963f4daf473f6c6202882d9bbf6edc1011
1 /* -*- Mode: IDL; tab-width: 1; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this IDL file is
7  * https://fetch.spec.whatwg.org/#request-class
8  */
10 typedef (Request or USVString) RequestInfo;
11 typedef unsigned long nsContentPolicyType;
13 [Exposed=(Window,Worker)]
14 interface Request {
15   [Throws]
16   constructor(RequestInfo input, optional RequestInit init = {});
18   readonly attribute ByteString method;
19   readonly attribute USVString url;
20   [SameObject, BinaryName="headers_"] readonly attribute Headers headers;
22   readonly attribute RequestDestination destination;
23   readonly attribute USVString referrer;
24   [BinaryName="referrerPolicy_"]
25   readonly attribute ReferrerPolicy referrerPolicy;
26   readonly attribute RequestMode mode;
27   readonly attribute RequestCredentials credentials;
28   readonly attribute RequestCache cache;
29   readonly attribute RequestRedirect redirect;
30   readonly attribute DOMString integrity;
32   // If a main-thread fetch() promise rejects, the error passed will be a
33   // nsresult code.
34   [ChromeOnly]
35   readonly attribute boolean mozErrors;
37   [BinaryName="getOrCreateSignal"]
38   readonly attribute AbortSignal signal;
40   [Throws,
41    NewObject] Request clone();
43   // Bug 1124638 - Allow chrome callers to set the context.
44   [ChromeOnly]
45   undefined overrideContentPolicyType(nsContentPolicyType context);
47 Request includes Body;
49 // <https://fetch.spec.whatwg.org/#requestinit>.
50 dictionary RequestInit {
51   ByteString method;
52   HeadersInit headers;
53   BodyInit? body;
54   USVString referrer;
55   ReferrerPolicy referrerPolicy;
56   RequestMode mode;
57   RequestCredentials credentials;
58   RequestCache cache;
59   RequestRedirect redirect;
60   DOMString integrity;
62   [ChromeOnly]
63   boolean mozErrors;
65   AbortSignal? signal;
67   [Pref="dom.fetchObserver.enabled"]
68   ObserverCallback observe;
71 enum RequestDestination {
72   "",
73   "audio", "audioworklet", "document", "embed", "font", "frame", "iframe",
74   "image", "manifest", "object", "paintworklet", "report", "script",
75   "sharedworker", "style",  "track", "video", "worker", "xslt"
78 enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
79 enum RequestCredentials { "omit", "same-origin", "include" };
80 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
81 enum RequestRedirect { "follow", "error", "manual" };
82 enum RequestPriority { "high" , "low" , "auto" };