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 10typedef (Request or USVString) RequestInfo; 11typedef unsigned long nsContentPolicyType; 12 13[Constructor(RequestInfo input, optional RequestInit init), 14 Exposed=(Window,Worker)] 15interface Request { 16 readonly attribute ByteString method; 17 readonly attribute USVString url; 18 [SameObject] readonly attribute Headers headers; 19 20 readonly attribute RequestDestination destination; 21 readonly attribute USVString referrer; 22 readonly attribute ReferrerPolicy referrerPolicy; 23 readonly attribute RequestMode mode; 24 readonly attribute RequestCredentials credentials; 25 readonly attribute RequestCache cache; 26 readonly attribute RequestRedirect redirect; 27 readonly attribute DOMString integrity; 28 29 30 [BinaryName="getOrCreateSignal"] 31 readonly attribute AbortSignal signal; 32 33 [Throws, 34 NewObject] Request clone(); 35 36 // Bug 1124638 - Allow chrome callers to set the context. 37 [ChromeOnly] 38 void overrideContentPolicyType(nsContentPolicyType context); 39}; 40Request includes Body; 41 42dictionary RequestInit { 43 ByteString method; 44 HeadersInit headers; 45 BodyInit? body; 46 USVString referrer; 47 ReferrerPolicy referrerPolicy; 48 RequestMode mode; 49 RequestCredentials credentials; 50 RequestCache cache; 51 RequestRedirect redirect; 52 DOMString integrity; 53 54 AbortSignal? signal; 55 56 [Func="mozilla::dom::DOMPrefs::FetchObserverEnabled"] 57 ObserverCallback observe; 58}; 59 60enum RequestDestination { 61 "", 62 "audio", "audioworklet", "document", "embed", "font", "image", "manifest", "object", 63 "paintworklet", "report", "script", "sharedworker", "style", "track", "video", 64 "worker", "xslt" 65}; 66 67enum RequestMode { "same-origin", "no-cors", "cors", "navigate" }; 68enum RequestCredentials { "omit", "same-origin", "include" }; 69enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }; 70enum RequestRedirect { "follow", "error", "manual" }; 71enum ReferrerPolicy { 72 "", "no-referrer", "no-referrer-when-downgrade", "origin", 73 "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin", 74 "strict-origin-when-cross-origin" 75}; 76