2018-09-13 20:04:55 +00:00
|
|
|
/* -*- Mode: IDL; tab-width: 1; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2014-07-25 00:53:03 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* https://fetch.spec.whatwg.org/#request-class
|
|
|
|
*/
|
|
|
|
|
2024-08-07 09:16:20 +00:00
|
|
|
|
|
|
|
interface Principal;
|
|
|
|
|
2024-04-04 11:49:57 +00:00
|
|
|
typedef (Request or UTF8String) RequestInfo;
|
2015-06-15 20:12:45 +00:00
|
|
|
typedef unsigned long nsContentPolicyType;
|
2014-07-25 00:53:03 +00:00
|
|
|
|
2019-09-12 11:01:17 +00:00
|
|
|
[Exposed=(Window,Worker)]
|
2014-07-25 00:53:03 +00:00
|
|
|
interface Request {
|
2024-03-26 16:50:44 +00:00
|
|
|
/**
|
|
|
|
* Note that Requests created from system principal (ie "privileged"/chrome)
|
|
|
|
* code will default to omitting credentials. You can override this behaviour
|
|
|
|
* using the ``credentials`` member on the ``init`` dictionary.
|
|
|
|
*/
|
2019-09-12 11:01:17 +00:00
|
|
|
[Throws]
|
|
|
|
constructor(RequestInfo input, optional RequestInit init = {});
|
|
|
|
|
2014-07-25 00:53:03 +00:00
|
|
|
readonly attribute ByteString method;
|
2024-04-04 11:49:57 +00:00
|
|
|
readonly attribute UTF8String url;
|
2019-08-28 17:51:37 +00:00
|
|
|
[SameObject, BinaryName="headers_"] readonly attribute Headers headers;
|
2014-07-25 00:53:03 +00:00
|
|
|
|
2018-03-09 14:11:27 +00:00
|
|
|
readonly attribute RequestDestination destination;
|
2024-04-04 11:49:57 +00:00
|
|
|
readonly attribute UTF8String referrer;
|
2019-08-28 17:51:37 +00:00
|
|
|
[BinaryName="referrerPolicy_"]
|
2016-02-26 22:36:45 +00:00
|
|
|
readonly attribute ReferrerPolicy referrerPolicy;
|
2014-07-25 00:53:03 +00:00
|
|
|
readonly attribute RequestMode mode;
|
|
|
|
readonly attribute RequestCredentials credentials;
|
2015-01-08 00:24:40 +00:00
|
|
|
readonly attribute RequestCache cache;
|
2015-08-31 21:26:29 +00:00
|
|
|
readonly attribute RequestRedirect redirect;
|
2016-09-07 02:20:23 +00:00
|
|
|
readonly attribute DOMString integrity;
|
2014-07-25 00:53:03 +00:00
|
|
|
|
2024-03-20 13:14:51 +00:00
|
|
|
[Pref="dom.fetchKeepalive.enabled"]
|
|
|
|
readonly attribute boolean keepalive;
|
|
|
|
|
2017-11-20 22:07:26 +00:00
|
|
|
// If a main-thread fetch() promise rejects, the error passed will be a
|
|
|
|
// nsresult code.
|
|
|
|
[ChromeOnly]
|
|
|
|
readonly attribute boolean mozErrors;
|
|
|
|
|
2017-09-27 01:50:46 +00:00
|
|
|
[BinaryName="getOrCreateSignal"]
|
2017-08-29 09:31:06 +00:00
|
|
|
readonly attribute AbortSignal signal;
|
|
|
|
|
2015-02-20 01:24:24 +00:00
|
|
|
[Throws,
|
|
|
|
NewObject] Request clone();
|
2015-01-28 00:02:12 +00:00
|
|
|
|
|
|
|
// Bug 1124638 - Allow chrome callers to set the context.
|
|
|
|
[ChromeOnly]
|
2022-09-21 07:44:58 +00:00
|
|
|
undefined overrideContentPolicyType(nsContentPolicyType context);
|
2014-07-25 00:53:03 +00:00
|
|
|
};
|
2019-08-15 16:53:49 +00:00
|
|
|
Request includes Body;
|
2014-07-25 00:53:03 +00:00
|
|
|
|
2023-08-28 11:56:33 +00:00
|
|
|
// <https://fetch.spec.whatwg.org/#requestinit>.
|
2014-07-25 00:53:03 +00:00
|
|
|
dictionary RequestInit {
|
|
|
|
ByteString method;
|
|
|
|
HeadersInit headers;
|
2016-02-24 16:34:33 +00:00
|
|
|
BodyInit? body;
|
2024-04-04 11:49:57 +00:00
|
|
|
UTF8String referrer;
|
2016-02-26 22:36:45 +00:00
|
|
|
ReferrerPolicy referrerPolicy;
|
2014-07-25 00:53:03 +00:00
|
|
|
RequestMode mode;
|
2024-03-26 16:50:44 +00:00
|
|
|
/**
|
|
|
|
* If not set, defaults to "same-origin", except for system principal (chrome)
|
|
|
|
* requests where the default is "omit".
|
|
|
|
*/
|
2014-07-25 00:53:03 +00:00
|
|
|
RequestCredentials credentials;
|
2015-01-08 00:24:40 +00:00
|
|
|
RequestCache cache;
|
2015-08-31 21:26:29 +00:00
|
|
|
RequestRedirect redirect;
|
2016-09-07 02:20:23 +00:00
|
|
|
DOMString integrity;
|
2017-03-22 10:04:57 +00:00
|
|
|
|
2024-03-20 13:14:51 +00:00
|
|
|
[Pref="dom.fetchKeepalive.enabled"]
|
|
|
|
boolean keepalive;
|
|
|
|
|
2017-11-15 19:53:42 +00:00
|
|
|
[ChromeOnly]
|
|
|
|
boolean mozErrors;
|
|
|
|
|
2024-08-07 09:16:20 +00:00
|
|
|
[ChromeOnly]
|
|
|
|
Principal triggeringPrincipal;
|
|
|
|
|
2017-08-30 16:47:23 +00:00
|
|
|
AbortSignal? signal;
|
2017-03-22 10:06:23 +00:00
|
|
|
|
2024-02-23 15:14:17 +00:00
|
|
|
[Pref="network.fetchpriority.enabled"]
|
|
|
|
RequestPriority priority;
|
|
|
|
|
2019-06-13 09:01:41 +00:00
|
|
|
[Pref="dom.fetchObserver.enabled"]
|
2017-03-22 10:06:23 +00:00
|
|
|
ObserverCallback observe;
|
2014-07-25 00:53:03 +00:00
|
|
|
};
|
|
|
|
|
2018-03-09 14:11:27 +00:00
|
|
|
enum RequestDestination {
|
|
|
|
"",
|
2020-12-14 08:32:55 +00:00
|
|
|
"audio", "audioworklet", "document", "embed", "font", "frame", "iframe",
|
|
|
|
"image", "manifest", "object", "paintworklet", "report", "script",
|
|
|
|
"sharedworker", "style", "track", "video", "worker", "xslt"
|
2015-01-27 23:43:09 +00:00
|
|
|
};
|
2015-01-08 00:24:40 +00:00
|
|
|
|
2016-01-13 23:15:37 +00:00
|
|
|
enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
|
2014-07-25 00:53:03 +00:00
|
|
|
enum RequestCredentials { "omit", "same-origin", "include" };
|
2016-05-17 03:20:52 +00:00
|
|
|
enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
|
2015-08-31 21:26:29 +00:00
|
|
|
enum RequestRedirect { "follow", "error", "manual" };
|
2023-08-28 11:56:33 +00:00
|
|
|
enum RequestPriority { "high" , "low" , "auto" };
|