tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Response.webidl (1961B)


      1 /* -*- Mode: IDL; tab-width: 2; 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/#response-class
      8 */
      9 
     10 [Exposed=(Window,Worker)]
     11 interface Response {
     12  // This should be constructor(optional BodyInit... but BodyInit doesn't
     13  // include ReadableStream yet because we don't want to expose Streams API to
     14  // Request.
     15  [Throws]
     16  constructor(optional (Blob or BufferSource or FormData or URLSearchParams or ReadableStream or USVString)? body = null,
     17              optional ResponseInit init = {});
     18 
     19  [NewObject] static Response error();
     20  [Throws,
     21   NewObject] static Response redirect(UTF8String url, optional unsigned short status = 302);
     22  [BinaryName=CreateFromJson, Throws,
     23   NewObject] static Response json(any data, optional ResponseInit init = {});
     24 
     25  readonly attribute ResponseType type;
     26 
     27  readonly attribute UTF8String url;
     28  readonly attribute boolean redirected;
     29  readonly attribute unsigned short status;
     30  readonly attribute boolean ok;
     31  readonly attribute ByteString statusText;
     32  [SameObject, BinaryName="headers_"] readonly attribute Headers headers;
     33 
     34  [Throws,
     35   NewObject] Response clone();
     36 
     37  [ChromeOnly, NewObject, Throws] Response cloneUnfiltered();
     38 
     39  // For testing only.
     40  [ChromeOnly] readonly attribute boolean hasCacheInfoChannel;
     41 };
     42 Response includes Body;
     43 
     44 // This should be part of Body but we don't want to expose body to request yet.
     45 // See bug 1387483.
     46 partial interface Response {
     47  [GetterThrows]
     48  readonly attribute ReadableStream? body;
     49 };
     50 
     51 dictionary ResponseInit {
     52  unsigned short status = 200;
     53  ByteString statusText = "";
     54  HeadersInit headers;
     55 };
     56 
     57 enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };