Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / Request.webidl
blob2480d2b39a5f3c8387da4fe9f447da18ad0e7023
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 UTF8String) RequestInfo;
11 typedef unsigned long nsContentPolicyType;
13 [Exposed=(Window,Worker)]
14 interface Request {
15   /**
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.
19    */
20   [Throws]
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
41   // nsresult code.
42   [ChromeOnly]
43   readonly attribute boolean mozErrors;
45   [BinaryName="getOrCreateSignal"]
46   readonly attribute AbortSignal signal;
48   [Throws,
49    NewObject] Request clone();
51   // Bug 1124638 - Allow chrome callers to set the context.
52   [ChromeOnly]
53   undefined overrideContentPolicyType(nsContentPolicyType context);
55 Request includes Body;
57 // <https://fetch.spec.whatwg.org/#requestinit>.
58 dictionary RequestInit {
59   ByteString method;
60   HeadersInit headers;
61   BodyInit? body;
62   UTF8String referrer;
63   ReferrerPolicy referrerPolicy;
64   RequestMode mode;
65   /**
66    * If not set, defaults to "same-origin", except for system principal (chrome)
67    * requests where the default is "omit".
68    */
69   RequestCredentials credentials;
70   RequestCache cache;
71   RequestRedirect redirect;
72   DOMString integrity;
74   [Pref="dom.fetchKeepalive.enabled"]
75   boolean keepalive;
77   [ChromeOnly]
78   boolean mozErrors;
80   AbortSignal? signal;
82   [Pref="network.fetchpriority.enabled"]
83   RequestPriority priority;
85   [Pref="dom.fetchObserver.enabled"]
86   ObserverCallback observe;
89 enum RequestDestination {
90   "",
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" };