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/.
6 * The origin of this IDL file is
7 * https://fetch.spec.whatwg.org/#request-class
10 typedef (Request or UTF8String) RequestInfo;
11 typedef unsigned long nsContentPolicyType;
13 [Exposed=(Window,Worker)]
16 * Note that Requests created from system principal (ie "privileged"/chrome)
17 * code will default to omitting credentials. You can override this behaviour
18 * using the ``credentials`` member on the ``init`` dictionary.
21 constructor(RequestInfo input, optional RequestInit init = {});
23 readonly attribute ByteString method;
24 readonly attribute UTF8String url;
25 [SameObject, BinaryName="headers_"] readonly attribute Headers headers;
27 readonly attribute RequestDestination destination;
28 readonly attribute UTF8String referrer;
29 [BinaryName="referrerPolicy_"]
30 readonly attribute ReferrerPolicy referrerPolicy;
31 readonly attribute RequestMode mode;
32 readonly attribute RequestCredentials credentials;
33 readonly attribute RequestCache cache;
34 readonly attribute RequestRedirect redirect;
35 readonly attribute DOMString integrity;
37 [Pref="dom.fetchKeepalive.enabled"]
38 readonly attribute boolean keepalive;
40 // If a main-thread fetch() promise rejects, the error passed will be a
43 readonly attribute boolean mozErrors;
45 [BinaryName="getOrCreateSignal"]
46 readonly attribute AbortSignal signal;
49 NewObject] Request clone();
51 // Bug 1124638 - Allow chrome callers to set the context.
53 undefined overrideContentPolicyType(nsContentPolicyType context);
55 Request includes Body;
57 // <https://fetch.spec.whatwg.org/#requestinit>.
58 dictionary RequestInit {
63 ReferrerPolicy referrerPolicy;
66 * If not set, defaults to "same-origin", except for system principal (chrome)
67 * requests where the default is "omit".
69 RequestCredentials credentials;
71 RequestRedirect redirect;
74 [Pref="dom.fetchKeepalive.enabled"]
82 [Pref="network.fetchpriority.enabled"]
83 RequestPriority priority;
85 [Pref="dom.fetchObserver.enabled"]
86 ObserverCallback observe;
89 enum RequestDestination {
91 "audio", "audioworklet", "document", "embed", "font", "frame", "iframe",
92 "image", "manifest", "object", "paintworklet", "report", "script",
93 "sharedworker", "style", "track", "video", "worker", "xslt"
96 enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
97 enum RequestCredentials { "omit", "same-origin", "include" };
98 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
99 enum RequestRedirect { "follow", "error", "manual" };
100 enum RequestPriority { "high" , "low" , "auto" };