Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / WindowOrWorkerGlobalScope.webidl
blob5e3ff86e8842b95899bb32eba4ceb06cfa591644
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://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin
8  * https://fetch.spec.whatwg.org/#fetch-method
9  * https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object
10  * https://w3c.github.io/ServiceWorker/#self-caches
11  */
13 // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin
14 [Exposed=(Window,Worker)]
15 interface mixin WindowOrWorkerGlobalScope {
16   [Replaceable] readonly attribute USVString origin;
17   readonly attribute boolean crossOriginIsolated;
19   [Throws, NeedsCallerType]
20   undefined reportError(any e);
22   // base64 utility methods
23   [Throws]
24   DOMString btoa(DOMString btoa);
25   [Throws]
26   DOMString atob(DOMString atob);
28   // timers
29   // NOTE: We're using overloads where the spec uses a union.  Should
30   // be black-box the same.
31   [Throws]
32   long setTimeout(Function handler, optional long timeout = 0, any... arguments);
33   [Throws]
34   long setTimeout(DOMString handler, optional long timeout = 0, any... unused);
35   undefined clearTimeout(optional long handle = 0);
36   [Throws]
37   long setInterval(Function handler, optional long timeout = 0, any... arguments);
38   [Throws]
39   long setInterval(DOMString handler, optional long timeout = 0, any... unused);
40   undefined clearInterval(optional long handle = 0);
42   // microtask queuing
43   undefined queueMicrotask(VoidFunction callback);
45   // ImageBitmap
46   [Throws]
47   Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage,
48                                          optional ImageBitmapOptions aOptions = {});
49   [Throws]
50   Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage,
51                                          long aSx, long aSy, long aSw, long aSh,
52                                          optional ImageBitmapOptions aOptions = {});
54   // structured cloning
55   [Throws]
56   any structuredClone(any value, optional StructuredSerializeOptions options = {});
59 // https://fetch.spec.whatwg.org/#fetch-method
60 partial interface mixin WindowOrWorkerGlobalScope {
61   [NewObject, NeedsCallerType]
62   Promise<Response> fetch(RequestInfo input, optional RequestInit init = {});
65 // https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object
66 partial interface mixin WindowOrWorkerGlobalScope {
67   readonly attribute boolean isSecureContext;
70 // http://w3c.github.io/IndexedDB/#factory-interface
71 partial interface mixin WindowOrWorkerGlobalScope {
72   // readonly attribute IDBFactory indexedDB; // bug 1776789
73   [Throws]
74   readonly attribute IDBFactory? indexedDB;
77 // https://w3c.github.io/ServiceWorker/#self-caches
78 partial interface mixin WindowOrWorkerGlobalScope {
79   [Throws, Func="nsGlobalWindowInner::CachesEnabled", SameObject]
80   readonly attribute CacheStorage caches;
83 // https://wicg.github.io/scheduling-apis/#ref-for-windoworworkerglobalscope-scheduler
84 partial interface mixin WindowOrWorkerGlobalScope {
85   [Replaceable, Pref="dom.enable_web_task_scheduling", SameObject]
86   readonly attribute Scheduler scheduler;
90 // https://w3c.github.io/trusted-types/dist/spec/#extensions-to-the-windoworworkerglobalscope-interface
91 partial interface mixin WindowOrWorkerGlobalScope {
92   [Pref="dom.security.trusted_types.enabled"]
93   readonly attribute TrustedTypePolicyFactory trustedTypes;