2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 1; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2014-07-25 04:53:03 +04: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
|
|
|
|
*/
|
|
|
|
|
2014-11-20 14:58:00 +03:00
|
|
|
typedef (Request or USVString) RequestInfo;
|
2015-06-15 23:12:45 +03:00
|
|
|
typedef unsigned long nsContentPolicyType;
|
2014-07-25 04:53:03 +04:00
|
|
|
|
2019-09-12 14:01:17 +03:00
|
|
|
[Exposed=(Window,Worker)]
|
2014-07-25 04:53:03 +04:00
|
|
|
interface Request {
|
2019-09-12 14:01:17 +03:00
|
|
|
[Throws]
|
|
|
|
constructor(RequestInfo input, optional RequestInit init = {});
|
|
|
|
|
2014-07-25 04:53:03 +04:00
|
|
|
readonly attribute ByteString method;
|
2014-11-20 14:58:00 +03:00
|
|
|
readonly attribute USVString url;
|
2019-08-28 20:51:37 +03:00
|
|
|
[SameObject, BinaryName="headers_"] readonly attribute Headers headers;
|
2014-07-25 04:53:03 +04:00
|
|
|
|
2018-03-09 17:11:27 +03:00
|
|
|
readonly attribute RequestDestination destination;
|
2016-02-24 01:18:40 +03:00
|
|
|
readonly attribute USVString referrer;
|
2019-08-28 20:51:37 +03:00
|
|
|
[BinaryName="referrerPolicy_"]
|
2016-02-27 01:36:45 +03:00
|
|
|
readonly attribute ReferrerPolicy referrerPolicy;
|
2014-07-25 04:53:03 +04:00
|
|
|
readonly attribute RequestMode mode;
|
|
|
|
readonly attribute RequestCredentials credentials;
|
2015-01-08 03:24:40 +03:00
|
|
|
readonly attribute RequestCache cache;
|
2015-09-01 00:26:29 +03:00
|
|
|
readonly attribute RequestRedirect redirect;
|
2016-09-07 05:20:23 +03:00
|
|
|
readonly attribute DOMString integrity;
|
2014-07-25 04:53:03 +04:00
|
|
|
|
2017-11-21 01:07:26 +03:00
|
|
|
// If a main-thread fetch() promise rejects, the error passed will be a
|
|
|
|
// nsresult code.
|
|
|
|
[ChromeOnly]
|
|
|
|
readonly attribute boolean mozErrors;
|
|
|
|
|
2017-09-27 04:50:46 +03:00
|
|
|
[BinaryName="getOrCreateSignal"]
|
2017-08-29 12:31:06 +03:00
|
|
|
readonly attribute AbortSignal signal;
|
|
|
|
|
2015-02-20 04:24:24 +03:00
|
|
|
[Throws,
|
|
|
|
NewObject] Request clone();
|
2015-01-28 03:02:12 +03:00
|
|
|
|
|
|
|
// Bug 1124638 - Allow chrome callers to set the context.
|
|
|
|
[ChromeOnly]
|
2016-04-08 00:13:09 +03:00
|
|
|
void overrideContentPolicyType(nsContentPolicyType context);
|
2014-07-25 04:53:03 +04:00
|
|
|
};
|
2019-08-15 19:53:49 +03:00
|
|
|
Request includes Body;
|
2014-07-25 04:53:03 +04:00
|
|
|
|
|
|
|
dictionary RequestInit {
|
|
|
|
ByteString method;
|
|
|
|
HeadersInit headers;
|
2016-02-24 19:34:33 +03:00
|
|
|
BodyInit? body;
|
2016-02-26 02:12:20 +03:00
|
|
|
USVString referrer;
|
2016-02-27 01:36:45 +03:00
|
|
|
ReferrerPolicy referrerPolicy;
|
2014-07-25 04:53:03 +04:00
|
|
|
RequestMode mode;
|
|
|
|
RequestCredentials credentials;
|
2015-01-08 03:24:40 +03:00
|
|
|
RequestCache cache;
|
2015-09-01 00:26:29 +03:00
|
|
|
RequestRedirect redirect;
|
2016-09-07 05:20:23 +03:00
|
|
|
DOMString integrity;
|
2017-03-22 13:04:57 +03:00
|
|
|
|
2017-11-15 22:53:42 +03:00
|
|
|
[ChromeOnly]
|
|
|
|
boolean mozErrors;
|
|
|
|
|
2017-08-30 19:47:23 +03:00
|
|
|
AbortSignal? signal;
|
2017-03-22 13:06:23 +03:00
|
|
|
|
2019-06-13 12:01:41 +03:00
|
|
|
[Pref="dom.fetchObserver.enabled"]
|
2017-03-22 13:06:23 +03:00
|
|
|
ObserverCallback observe;
|
2014-07-25 04:53:03 +04:00
|
|
|
};
|
|
|
|
|
2018-03-09 17:11:27 +03:00
|
|
|
enum RequestDestination {
|
|
|
|
"",
|
|
|
|
"audio", "audioworklet", "document", "embed", "font", "image", "manifest", "object",
|
|
|
|
"paintworklet", "report", "script", "sharedworker", "style", "track", "video",
|
|
|
|
"worker", "xslt"
|
2015-01-28 02:43:09 +03:00
|
|
|
};
|
2015-01-08 03:24:40 +03:00
|
|
|
|
2016-01-14 02:15:37 +03:00
|
|
|
enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
|
2014-07-25 04:53:03 +04:00
|
|
|
enum RequestCredentials { "omit", "same-origin", "include" };
|
2016-05-17 06:20:52 +03:00
|
|
|
enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
|
2015-09-01 00:26:29 +03:00
|
|
|
enum RequestRedirect { "follow", "error", "manual" };
|