2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2014-07-25 04:50:32 +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/#response-class
|
|
|
|
*/
|
|
|
|
|
2019-09-12 14:01:17 +03:00
|
|
|
[Exposed=(Window,Worker)]
|
2014-07-25 04:50:32 +04:00
|
|
|
interface Response {
|
2019-09-12 14:01:17 +03:00
|
|
|
// This should be constructor(optional BodyInit... but BodyInit doesn't
|
|
|
|
// include ReadableStream yet because we don't want to expose Streams API to
|
|
|
|
// Request.
|
|
|
|
[Throws]
|
2019-09-11 14:06:58 +03:00
|
|
|
constructor(optional (Blob or BufferSource or FormData or URLSearchParams or ReadableStream or USVString)? body = null,
|
2019-09-12 14:01:17 +03:00
|
|
|
optional ResponseInit init = {});
|
|
|
|
|
2015-01-08 03:24:40 +03:00
|
|
|
[NewObject] static Response error();
|
2014-12-26 20:44:09 +03:00
|
|
|
[Throws,
|
|
|
|
NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
|
2014-07-25 04:50:32 +04:00
|
|
|
|
|
|
|
readonly attribute ResponseType type;
|
|
|
|
|
2014-11-20 14:58:00 +03:00
|
|
|
readonly attribute USVString url;
|
2016-05-03 04:48:40 +03:00
|
|
|
readonly attribute boolean redirected;
|
2014-07-25 04:50:32 +04:00
|
|
|
readonly attribute unsigned short status;
|
2015-01-28 04:34:34 +03:00
|
|
|
readonly attribute boolean ok;
|
2014-07-25 04:50:32 +04:00
|
|
|
readonly attribute ByteString statusText;
|
2019-08-28 20:51:37 +03:00
|
|
|
[SameObject, BinaryName="headers_"] readonly attribute Headers headers;
|
2014-07-25 04:50:32 +04:00
|
|
|
|
2015-02-20 04:24:24 +03:00
|
|
|
[Throws,
|
|
|
|
NewObject] Response clone();
|
2016-01-12 23:15:12 +03:00
|
|
|
|
|
|
|
[ChromeOnly, NewObject, Throws] Response cloneUnfiltered();
|
2019-02-20 13:05:35 +03:00
|
|
|
|
|
|
|
// For testing only.
|
|
|
|
[ChromeOnly] readonly attribute boolean hasCacheInfoChannel;
|
2014-07-25 04:50:32 +04:00
|
|
|
};
|
2019-08-15 19:53:49 +03:00
|
|
|
Response includes Body;
|
2014-07-25 04:50:32 +04:00
|
|
|
|
2017-08-11 04:04:54 +03:00
|
|
|
// This should be part of Body but we don't want to expose body to request yet.
|
|
|
|
// See bug 1387483.
|
|
|
|
partial interface Response {
|
2019-06-13 12:01:41 +03:00
|
|
|
[GetterThrows, Pref="javascript.options.streams"]
|
2017-08-11 04:04:54 +03:00
|
|
|
readonly attribute ReadableStream? body;
|
|
|
|
};
|
|
|
|
|
2014-07-25 04:50:32 +04:00
|
|
|
dictionary ResponseInit {
|
|
|
|
unsigned short status = 200;
|
2019-02-26 06:56:08 +03:00
|
|
|
ByteString statusText = "";
|
2014-07-25 04:50:32 +04:00
|
|
|
HeadersInit headers;
|
|
|
|
};
|
|
|
|
|
2015-09-01 00:26:29 +03:00
|
|
|
enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };
|