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 USVString) RequestInfo;
11 typedef unsigned long nsContentPolicyType;
13 [Exposed=(Window,Worker)]
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
35 readonly attribute boolean mozErrors;
37 [BinaryName="getOrCreateSignal"]
38 readonly attribute AbortSignal signal;
41 NewObject] Request clone();
43 // Bug 1124638 - Allow chrome callers to set the context.
45 void overrideContentPolicyType(nsContentPolicyType context);
47 Request includes Body;
49 dictionary RequestInit {
54 ReferrerPolicy referrerPolicy;
56 RequestCredentials credentials;
58 RequestRedirect redirect;
66 [Pref="dom.fetchObserver.enabled"]
67 ObserverCallback observe;
70 enum RequestDestination {
72 "audio", "audioworklet", "document", "embed", "font", "image", "manifest", "object",
73 "paintworklet", "report", "script", "sharedworker", "style", "track", "video",
77 enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
78 enum RequestCredentials { "omit", "same-origin", "include" };
79 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
80 enum RequestRedirect { "follow", "error", "manual" };