tor-browser

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

Request.webidl (3911B)


      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 */
      9 
     10 
     11 interface Principal;
     12 
     13 typedef (Request or UTF8String) RequestInfo;
     14 typedef unsigned long nsContentPolicyType;
     15 
     16 [Exposed=(Window,Worker)]
     17 interface Request {
     18  /**
     19   * Note that Requests created from system principal (ie "privileged"/chrome)
     20   * code will default to omitting credentials. You can override this behaviour
     21   * using the ``credentials`` member on the ``init`` dictionary.
     22   */
     23  [Throws]
     24  constructor(RequestInfo input, optional RequestInit init = {});
     25 
     26  readonly attribute ByteString method;
     27  readonly attribute UTF8String url;
     28  [SameObject, BinaryName="headers_"] readonly attribute Headers headers;
     29 
     30  readonly attribute RequestDestination destination;
     31  readonly attribute UTF8String referrer;
     32  [BinaryName="referrerPolicy_"]
     33  readonly attribute ReferrerPolicy referrerPolicy;
     34  readonly attribute RequestMode mode;
     35  readonly attribute RequestCredentials credentials;
     36  readonly attribute RequestCache cache;
     37  readonly attribute RequestRedirect redirect;
     38  readonly attribute DOMString integrity;
     39 
     40  [Pref="dom.fetchKeepalive.enabled"]
     41  readonly attribute boolean keepalive;
     42 
     43  // If a main-thread fetch() promise rejects, the error passed will be a
     44  // nsresult code.
     45  [ChromeOnly]
     46  readonly attribute boolean mozErrors;
     47 
     48  [BinaryName="getOrCreateSignal"]
     49  readonly attribute AbortSignal signal;
     50 
     51  [Throws,
     52   NewObject] Request clone();
     53 
     54  // Bug 1124638 - Allow chrome callers to set the context.
     55  [ChromeOnly]
     56  undefined overrideContentPolicyType(nsContentPolicyType context);
     57 };
     58 Request includes Body;
     59 
     60 // <https://fetch.spec.whatwg.org/#requestinit>.
     61 dictionary RequestInit {
     62  ByteString method;
     63  HeadersInit headers;
     64  BodyInit? body;
     65  UTF8String referrer;
     66  ReferrerPolicy referrerPolicy;
     67  RequestMode mode;
     68  /**
     69   * If not set, defaults to "same-origin", except for system principal (chrome)
     70   * requests where the default is "omit".
     71   */
     72  RequestCredentials credentials;
     73  RequestCache cache;
     74  RequestRedirect redirect;
     75  DOMString integrity;
     76 
     77  [Pref="dom.fetchKeepalive.enabled"]
     78  boolean keepalive;
     79 
     80  [ChromeOnly]
     81  boolean mozErrors;
     82 
     83  // This allows the Chrome process to send Fetch requests as if they were
     84  // triggered by another origin. It is up to the Chrome process to use
     85  // this responsibly to represent that a Fetch is _really_ being triggered
     86  // by some content even though it is occurring in a system context.
     87  [ChromeOnly]
     88  Principal triggeringPrincipal;
     89 
     90  // This allows fetches made by the system using the triggeringPrincipal
     91  // to ensure that the response can be read by the system. This forces
     92  // the request to never be tainted, so that the response remains Basic.
     93  // It is then up to the Chrome process to not share the contents to other
     94  // processes.
     95  [ChromeOnly]
     96  boolean neverTaint;
     97 
     98  AbortSignal? signal;
     99 
    100  [Pref="network.fetchpriority.enabled"]
    101  RequestPriority priority;
    102 
    103  [Pref="dom.fetchObserver.enabled"]
    104  ObserverCallback observe;
    105 };
    106 
    107 enum RequestDestination {
    108  "",
    109  "audio", "audioworklet", "document", "embed", "font", "frame", "iframe",
    110  "image", "json", "manifest", "object", "paintworklet", "report", "script",
    111  "sharedworker", "style",  "track", "video", "worker", "xslt"
    112 };
    113 
    114 enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
    115 enum RequestCredentials { "omit", "same-origin", "include" };
    116 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
    117 enum RequestRedirect { "follow", "error", "manual" };
    118 enum RequestPriority { "high" , "low" , "auto" };