Bug 1270832 - Activate standard c++ library hardening r=glandium
[gecko.git] / dom / webidl / Window.webidl
blobab89253de337132415c63db55c820170de1abe38
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  * http://www.whatwg.org/specs/web-apps/current-work/
8  * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
9  * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
10  * http://dev.w3.org/csswg/cssom/
11  * http://dev.w3.org/csswg/cssom-view/
12  * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
13  * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
14  * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
15  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
16  * https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object
17  * https://w3c.github.io/requestidlecallback/
18  * https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet
19  * https://wicg.github.io/visual-viewport/#the-visualviewport-interface
20  * https://wicg.github.io/cookie-store/#Window
21  */
23 interface Principal;
24 interface nsIBrowserDOMWindow;
25 interface XULControllers;
26 interface nsIDOMWindowUtils;
27 interface nsIPrintSettings;
29 // http://www.whatwg.org/specs/web-apps/current-work/
30 [Global=Window, LegacyUnenumerableNamedProperties, NeedResolve,
31  Exposed=Window,
32  InstrumentedProps=(AbsoluteOrientationSensor,
33                     Accelerometer,
34                     BackgroundFetchManager,
35                     BackgroundFetchRecord,
36                     BackgroundFetchRegistration,
37                     BeforeInstallPromptEvent,
38                     Bluetooth,
39                     BluetoothCharacteristicProperties,
40                     BluetoothDevice,
41                     BluetoothRemoteGATTCharacteristic,
42                     BluetoothRemoteGATTDescriptor,
43                     BluetoothRemoteGATTServer,
44                     BluetoothRemoteGATTService,
45                     BluetoothUUID,
46                     CanvasCaptureMediaStreamTrack,
47                     chrome,
48                     ClipboardItem,
49                     CSSImageValue,
50                     CSSKeywordValue,
51                     CSSMathClamp,
52                     CSSMathInvert,
53                     CSSMathMax,
54                     CSSMathMin,
55                     CSSMathNegate,
56                     CSSMathProduct,
57                     CSSMathSum,
58                     CSSMathValue,
59                     CSSMatrixComponent,
60                     CSSNumericArray,
61                     CSSNumericValue,
62                     CSSPerspective,
63                     CSSPositionValue,
64                     CSSPropertyRule,
65                     CSSRotate,
66                     CSSScale,
67                     CSSSkew,
68                     CSSSkewX,
69                     CSSSkewY,
70                     CSSStyleValue,
71                     CSSTransformComponent,
72                     CSSTransformValue,
73                     CSSTranslate,
74                     CSSUnitValue,
75                     CSSUnparsedValue,
76                     CSSVariableReferenceValue,
77                     defaultStatus,
78                     // Unfortunately, our telemetry histogram name generator
79                     // (the one that generates TelemetryHistogramEnums.h) can't
80                     // handle two DOM methods with names that only differ in
81                     // case, because it forces everything to uppercase.
82                     //defaultstatus,
83                     DeviceMotionEventAcceleration,
84                     DeviceMotionEventRotationRate,
85                     DOMError,
86                     EncodedVideoChunk,
87                     EnterPictureInPictureEvent,
88                     External,
89                     FederatedCredential,
90                     Gyroscope,
91                     HTMLContentElement,
92                     HTMLShadowElement,
93                     ImageCapture,
94                     InputDeviceCapabilities,
95                     InputDeviceInfo,
96                     Keyboard,
97                     KeyboardLayoutMap,
98                     LinearAccelerationSensor,
99                     MediaSettingsRange,
100                     MIDIAccess,
101                     MIDIConnectionEvent,
102                     MIDIInput,
103                     MIDIInputMap,
104                     MIDIMessageEvent,
105                     MIDIOutput,
106                     MIDIOutputMap,
107                     MIDIPort,
108                     NetworkInformation,
109                     offscreenBuffering,
110                     onbeforeinstallprompt,
111                     oncancel,
112                     onmousewheel,
113                     onorientationchange,
114                     onsearch,
115                     onselectionchange,
116                     openDatabase,
117                     orientation,
118                     OrientationSensor,
119                     OverconstrainedError,
120                     PasswordCredential,
121                     PaymentAddress,
122                     PaymentInstruments,
123                     PaymentManager,
124                     PaymentMethodChangeEvent,
125                     PaymentRequest,
126                     PaymentRequestUpdateEvent,
127                     PaymentResponse,
128                     PerformanceLongTaskTiming,
129                     PhotoCapabilities,
130                     PictureInPictureEvent,
131                     PictureInPictureWindow,
132                     Presentation,
133                     PresentationAvailability,
134                     PresentationConnection,
135                     PresentationConnectionAvailableEvent,
136                     PresentationConnectionCloseEvent,
137                     PresentationConnectionList,
138                     PresentationReceiver,
139                     PresentationRequest,
140                     RelativeOrientationSensor,
141                     RemotePlayback,
142                     Report,
143                     ReportBody,
144                     ReportingObserver,
145                     RTCError,
146                     RTCErrorEvent,
147                     RTCIceTransport,
148                     RTCPeerConnectionIceErrorEvent,
149                     Sensor,
150                     SensorErrorEvent,
151                     SpeechRecognitionAlternative,
152                     SpeechRecognitionResult,
153                     SpeechRecognitionResultList,
154                     styleMedia,
155                     StylePropertyMap,
156                     StylePropertyMapReadOnly,
157                     SVGDiscardElement,
158                     SyncManager,
159                     TaskAttributionTiming,
160                     TextEvent,
161                     Touch,
162                     TouchEvent,
163                     TouchList,
164                     USB,
165                     USBAlternateInterface,
166                     USBConfiguration,
167                     USBConnectionEvent,
168                     USBDevice,
169                     USBEndpoint,
170                     USBInterface,
171                     USBInTransferResult,
172                     USBIsochronousInTransferPacket,
173                     USBIsochronousInTransferResult,
174                     USBIsochronousOutTransferPacket,
175                     USBIsochronousOutTransferResult,
176                     USBOutTransferResult,
177                     UserActivation,
178                     VideoColorSpace,
179                     VideoDecoder,
180                     VideoEncoder,
181                     VideoFrame,
182                     WakeLock,
183                     WakeLockSentinel,
184                     webkitCancelAnimationFrame,
185                     webkitMediaStream,
186                     WebKitMutationObserver,
187                     webkitRequestAnimationFrame,
188                     webkitRequestFileSystem,
189                     webkitResolveLocalFileSystemURL,
190                     webkitRTCPeerConnection,
191                     webkitSpeechGrammar,
192                     webkitSpeechGrammarList,
193                     webkitSpeechRecognition,
194                     webkitSpeechRecognitionError,
195                     webkitSpeechRecognitionEvent,
196                     webkitStorageInfo)]
197 /*sealed*/ interface Window : EventTarget {
198   // the current browsing context
199   [LegacyUnforgeable, Constant, StoreInSlot,
200    CrossOriginReadable] readonly attribute WindowProxy window;
201   [Replaceable, Constant, StoreInSlot,
202    CrossOriginReadable] readonly attribute WindowProxy self;
203   [LegacyUnforgeable, StoreInSlot, Pure] readonly attribute Document? document;
204   [Throws] attribute DOMString name;
205   [PutForwards=href, LegacyUnforgeable, CrossOriginReadable,
206    CrossOriginWritable] readonly attribute Location location;
207   [Throws] readonly attribute History history;
208   [Func="Navigation::IsAPIEnabled"] readonly attribute Navigation navigation;
209   readonly attribute CustomElementRegistry customElements;
210   [Replaceable, Throws] readonly attribute BarProp locationbar;
211   [Replaceable, Throws] readonly attribute BarProp menubar;
212   [Replaceable, Throws] readonly attribute BarProp personalbar;
213   [Replaceable, Throws] readonly attribute BarProp scrollbars;
214   [Replaceable, Throws] readonly attribute BarProp statusbar;
215   [Replaceable, Throws] readonly attribute BarProp toolbar;
216   [Throws] attribute DOMString status;
217   [Throws, CrossOriginCallable, NeedsCallerType] undefined close();
218   [Throws, CrossOriginReadable] readonly attribute boolean closed;
219   [Throws] undefined stop();
220   [Throws, CrossOriginCallable, NeedsCallerType] undefined focus();
221   [Throws, CrossOriginCallable, NeedsCallerType] undefined blur();
222   [Replaceable] readonly attribute (Event or undefined) event;
224   // other browsing contexts
225   [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy frames;
226   [Replaceable, CrossOriginReadable] readonly attribute unsigned long length;
227   //[Unforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy top;
228   [LegacyUnforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy? top;
229   [Throws, CrossOriginReadable] attribute any opener;
230   //[Throws] readonly attribute WindowProxy parent;
231   [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy? parent;
232   [Throws, NeedsSubjectPrincipal] readonly attribute Element? frameElement;
233   //[Throws] WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "");
234   [Throws] WindowProxy? open(optional USVString url = "", optional DOMString target = "", optional [LegacyNullToEmptyString] DOMString features = "");
235   getter object (DOMString name);
237   // the user agent
238   readonly attribute Navigator navigator;
239   [Replaceable, BinaryName="Navigator"]
240   readonly attribute Navigator clientInformation;
242   [Replaceable] readonly attribute External external;
244   // user prompts
245   [Throws, NeedsSubjectPrincipal] undefined alert();
246   [Throws, NeedsSubjectPrincipal] undefined alert(DOMString message);
247   [Throws, NeedsSubjectPrincipal] boolean confirm(optional DOMString message = "");
248   [Throws, NeedsSubjectPrincipal] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
249   [Throws]
250   undefined print();
252   // Returns a window that you can use for a print preview.
253   //
254   // This may reuse an existing window if this window is already a print
255   // preview document, or if you pass a docshell explicitly.
256   [Throws, Func="nsContentUtils::IsCallerChromeOrFuzzingEnabled"]
257   WindowProxy? printPreview(optional nsIPrintSettings? settings = null,
258                             optional nsIWebProgressListener? listener = null,
259                             optional nsIDocShell? docShellToPreviewInto = null);
261   [Throws, CrossOriginCallable, NeedsSubjectPrincipal,
262    BinaryName="postMessageMoz"]
263   undefined postMessage(any message, DOMString targetOrigin, optional sequence<object> transfer = []);
264   [Throws, CrossOriginCallable, NeedsSubjectPrincipal,
265    BinaryName="postMessageMoz"]
266   undefined postMessage(any message, optional WindowPostMessageOptions options = {});
268   // also has obsolete members
270 Window includes GlobalEventHandlers;
271 Window includes WindowEventHandlers;
273 // http://www.whatwg.org/specs/web-apps/current-work/
274 interface mixin WindowSessionStorage {
275   //[Throws] readonly attribute Storage sessionStorage;
276   [Throws] readonly attribute Storage? sessionStorage;
278 Window includes WindowSessionStorage;
280 // http://www.whatwg.org/specs/web-apps/current-work/
281 interface mixin WindowLocalStorage {
282   [Throws] readonly attribute Storage? localStorage;
284 Window includes WindowLocalStorage;
286 // http://www.whatwg.org/specs/web-apps/current-work/
287 partial interface Window {
288   undefined captureEvents();
289   undefined releaseEvents();
292 // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
293 partial interface Window {
294   //[Throws] Selection getSelection();
295   [Throws] Selection? getSelection();
298 // https://drafts.csswg.org/cssom/#extensions-to-the-window-interface
299 partial interface Window {
300   //[NewObject, Throws] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString? pseudoElt = "");
301   [NewObject, Throws] CSSStyleDeclaration? getComputedStyle(Element elt, optional DOMString? pseudoElt = "");
304 // http://dev.w3.org/csswg/cssom-view/
305 enum ScrollBehavior { "auto", "instant", "smooth" };
307 dictionary ScrollOptions {
308   ScrollBehavior behavior = "auto";
311 dictionary ScrollToOptions : ScrollOptions {
312   unrestricted double left;
313   unrestricted double top;
316 partial interface Window {
317   //[Throws, NewObject, NeedsCallerType] MediaQueryList matchMedia(DOMString query);
318   [Throws, NewObject, NeedsCallerType] MediaQueryList? matchMedia(UTF8String query);
320   [SameObject, Replaceable] readonly attribute Screen screen;
322   // browsing context
323   //[Throws] undefined moveTo(double x, double y);
324   //[Throws] undefined moveBy(double x, double y);
325   //[Throws] undefined resizeTo(double x, double y);
326   //[Throws] undefined resizeBy(double x, double y);
327   [Throws, NeedsCallerType] undefined moveTo(long x, long y);
328   [Throws, NeedsCallerType] undefined moveBy(long x, long y);
329   [Throws, NeedsCallerType] undefined resizeTo(long x, long y);
330   [Throws, NeedsCallerType] undefined resizeBy(long x, long y);
332   // viewport
333   [Replaceable, Throws] readonly attribute double innerWidth;
334   [Replaceable, Throws] readonly attribute double innerHeight;
336   // viewport scrolling
337   undefined scroll(unrestricted double x, unrestricted double y);
338   undefined scroll(optional ScrollToOptions options = {});
339   undefined scrollTo(unrestricted double x, unrestricted double y);
340   undefined scrollTo(optional ScrollToOptions options = {});
341   undefined scrollBy(unrestricted double x, unrestricted double y);
342   undefined scrollBy(optional ScrollToOptions options = {});
343   // mozScrollSnap is used by chrome to perform scroll snapping after the
344   // user performs actions that may affect scroll position
345   // mozScrollSnap is deprecated, to be replaced by a web accessible API, such
346   // as an extension to the ScrollOptions dictionary.  See bug 1137937.
347   [ChromeOnly] undefined mozScrollSnap();
348   // The four properties below are double per spec at the moment, but whether
349   // that will continue is unclear.
350   [Replaceable, Throws] readonly attribute double scrollX;
351   [Replaceable, Throws] readonly attribute double pageXOffset;
352   [Replaceable, Throws] readonly attribute double scrollY;
353   [Replaceable, Throws] readonly attribute double pageYOffset;
355   // Aliases for screenX / screenY.
356   [Replaceable, Throws, NeedsCallerType] readonly attribute double screenLeft;
357   [Replaceable, Throws, NeedsCallerType] readonly attribute double screenTop;
359   // client
360   [Replaceable, Throws, NeedsCallerType] readonly attribute double screenX;
361   [Replaceable, Throws, NeedsCallerType] readonly attribute double screenY;
362   [Replaceable, Throws, NeedsCallerType] readonly attribute double outerWidth;
363   [Replaceable, Throws, NeedsCallerType] readonly attribute double outerHeight;
366 // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames
367 Window includes AnimationFrameProvider;
369 // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
370 partial interface Window {
371   [Replaceable, Pure, StoreInSlot] readonly attribute Performance? performance;
374 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
375 Window includes GlobalCrypto;
377 dictionary SizeToContentConstraints {
378   long maxWidth = 0;
379   long maxHeight = 0;
380   long prefWidth = 0;
383 #ifdef MOZ_WEBSPEECH
384 // http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
385 interface mixin SpeechSynthesisGetter {
386   [Throws, Pref="media.webspeech.synth.enabled"] readonly attribute SpeechSynthesis speechSynthesis;
389 Window includes SpeechSynthesisGetter;
390 #endif
392 // Mozilla-specific stuff
393 partial interface Window {
394   //[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
395   [NewObject, Throws] CSSStyleDeclaration? getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
397   // Mozilla extensions
398   /**
399    * Method for scrolling this window by a number of lines.
400    */
401   undefined                 scrollByLines(long numLines, optional ScrollOptions options = {});
403   /**
404    * Method for scrolling this window by a number of pages.
405    */
406   undefined                 scrollByPages(long numPages, optional ScrollOptions options = {});
409   /**
410    * Chrome-only method for sizing to content with an optional
411    * maximum-size constraint on either (or both) directions.
412    */
413   [Throws, ChromeOnly] undefined sizeToContent(optional SizeToContentConstraints constraints = {});
415   [ChromeOnly, Replaceable, Throws] readonly attribute XULControllers controllers;
417   [ChromeOnly, Throws] readonly attribute Element? realFrameElement;
419   [ChromeOnly] readonly attribute nsIDocShell? docShell;
421   [ChromeOnly, Constant, CrossOriginReadable, BinaryName="getBrowsingContext"]
422   readonly attribute BrowsingContext browsingContext;
424   [Throws, NeedsCallerType]
425   readonly attribute float mozInnerScreenX;
426   [Throws, NeedsCallerType]
427   readonly attribute float mozInnerScreenY;
428   [Replaceable, Throws, NeedsCallerType]
429   readonly attribute double devicePixelRatio;
431   // Allows chrome code to convert desktop pixels to device pixels and vice
432   // versa. Useful for interacting with the screen manager.
433   [ChromeOnly, Throws]
434   readonly attribute double desktopToDeviceScale;
436   // Returns the amount of CSS pixels relative to this window we're allowed to
437   // go out of the screen. This is needed so that SessionRestore is able to
438   // position windows that use client-side decorations correctly, but still
439   // pull mispositioned windows into the screen.
440   [ChromeOnly]
441   readonly attribute double screenEdgeSlopX;
442   [ChromeOnly]
443   readonly attribute double screenEdgeSlopY;
446   /* The maximum offset that the window can be scrolled to
447      (i.e., the document width/height minus the scrollport width/height) */
448   [ChromeOnly, Throws]  readonly attribute long   scrollMinX;
449   [ChromeOnly, Throws]  readonly attribute long   scrollMinY;
450   [Replaceable, Throws] readonly attribute long   scrollMaxX;
451   [Replaceable, Throws] readonly attribute long   scrollMaxY;
453   [Throws] attribute boolean fullScreen;
455   undefined                 updateCommands(DOMString action);
457   /* Find in page.
458    * @param str: the search pattern
459    * @param caseSensitive: is the search caseSensitive
460    * @param backwards: should we search backwards
461    * @param wrapAround: should we wrap the search
462    * @param wholeWord: should we search only for whole words
463    * @param searchInFrames: should we search through all frames
464    * @param showDialog: should we show the Find dialog
465    */
466   [Throws] boolean    find(optional DOMString str = "",
467                            optional boolean caseSensitive = false,
468                            optional boolean backwards = false,
469                            optional boolean wrapAround = false,
470                            optional boolean wholeWord = false,
471                            optional boolean searchInFrames = false,
472                            optional boolean showDialog = false);
474            attribute EventHandler ondevicemotion;
475            attribute EventHandler ondeviceorientation;
476            attribute EventHandler ondeviceorientationabsolute;
477            [Pref="device.sensors.proximity.enabled"]
478            attribute EventHandler onuserproximity;
479            [Pref="device.sensors.ambientLight.enabled"]
480            attribute EventHandler ondevicelight;
482   undefined                 dump(DOMString str);
484   /**
485    * This method is here for backwards compatibility with 4.x only,
486    * its implementation is a no-op
487    */
488   undefined                 setResizable(boolean resizable);
490   /**
491    * This is the scriptable version of
492    * nsPIDOMWindow::OpenDialog() that takes 3 optional
493    * arguments, plus any additional arguments are passed on as
494    * arguments on the dialog's window object (window.arguments).
495    */
496   [Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "",
497                                                optional DOMString name = "",
498                                                optional DOMString options = "",
499                                                any... extraArguments);
501   [ChromeOnly,
502    NonEnumerable, Replaceable, Throws, NeedsCallerType]
503   readonly attribute object? content;
505   [Throws, ChromeOnly] any getInterface(any iid);
507   /**
508    * Same as nsIDOMWindow.windowRoot, useful for event listener targeting.
509    */
510   [ChromeOnly, Throws]
511   readonly attribute WindowRoot? windowRoot;
513   /**
514    * ChromeOnly method to determine if a particular window should see console
515    * reports from service workers of the given scope.
516    */
517   [ChromeOnly]
518   boolean shouldReportForServiceWorkerScope(USVString aScope);
520   /**
521    * InstallTrigger is used for extension installs.  Ideally it would
522    * be something like a WebIDL namespace, but we don't support
523    * JS-implemented static things yet.  See bug 863952.
524    */
525   [Replaceable, Deprecated="InstallTriggerDeprecated", Pref="extensions.InstallTrigger.enabled"]
526   readonly attribute InstallTriggerImpl? InstallTrigger;
528   /**
529    * Get the nsIDOMWindowUtils for this window.
530    */
531   [Constant, Throws, ChromeOnly]
532   readonly attribute nsIDOMWindowUtils windowUtils;
534   [Pure, ChromeOnly]
535   readonly attribute WindowGlobalChild? windowGlobalChild;
537   /**
538    * The principal of the client source of the window. This is supposed to be
539    * used for the service worker.
540    *
541    * This is used for APIs like https://w3c.github.io/push-api/ that extend
542    * ServiceWorkerRegistration and therefore need to operate consistently with
543    * ServiceWorkers and its Clients API. The client principal is the appropriate
544    * principal to pass to all nsIServiceWorkerManager APIs.
545    *
546    * Note that the client principal will be different from the node principal of
547    * the window's document if the window is in a third-party context when dFPI
548    * is enabled. In this case, the client principal will be the partitioned
549    * principal to support the service worker partitioning.
550    */
551   [ChromeOnly]
552   readonly attribute Principal? clientPrincipal;
554   /**
555    *  Whether the chrome window is currently in a full screen transition. This
556    *  flag is updated from FullscreenTransitionTask.
557    *  Always set to false for non-chrome windows.
558    */
559   [ChromeOnly]
560   readonly attribute boolean isInFullScreenTransition;
563 Window includes TouchEventHandlers;
565 Window includes OnErrorEventHandlerForWindow;
567 #if defined(MOZ_WIDGET_ANDROID)
568 // https://compat.spec.whatwg.org/#windoworientation-interface
569 partial interface Window {
570   [NeedsCallerType]
571   readonly attribute short orientation;
572            attribute EventHandler onorientationchange;
574 #endif
576 [MOZ_CAN_RUN_SCRIPT_BOUNDARY]
577 callback PromiseDocumentFlushedCallback = any ();
579 // Mozilla extensions for Chrome windows.
580 partial interface Window {
581   // The STATE_* constants need to match the corresponding enum in nsGlobalWindow.cpp.
582   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
583   const unsigned short STATE_MAXIMIZED = 1;
584   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
585   const unsigned short STATE_MINIMIZED = 2;
586   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
587   const unsigned short STATE_NORMAL = 3;
588   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
589   const unsigned short STATE_FULLSCREEN = 4;
591   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
592   readonly attribute unsigned short windowState;
594   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
595   readonly attribute boolean isFullyOccluded;
597   /**
598    * browserDOMWindow provides access to yet another layer of
599    * utility functions implemented by chrome script. It will be null
600    * for DOMWindows not corresponding to browsers.
601    */
602   [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
603            attribute nsIBrowserDOMWindow? browserDOMWindow;
605   [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
606   undefined                 getAttention();
608   [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
609   undefined                 getAttentionWithCycleCount(long aCycleCount);
611   [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
612   undefined                 setCursor(UTF8String cursor);
614   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
615   undefined                 maximize();
616   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
617   undefined                 minimize();
618   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
619   undefined                 restore();
620   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
621   DOMString                 getWorkspaceID();
622   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
623   undefined                 moveToWorkspace(DOMString workspaceID);
625   /**
626    * Notify a default button is loaded on a dialog or a wizard.
627    * defaultButton is the default button.
628    */
629   [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
630   undefined notifyDefaultButtonLoaded(Element defaultButton);
632   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
633   readonly attribute ChromeMessageBroadcaster messageManager;
635   /**
636    * Returns the message manager identified by the given group name that
637    * manages all frame loaders belonging to that group.
638    */
639   [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
640   ChromeMessageBroadcaster getGroupMessageManager(DOMString aGroup);
642   /**
643    * Calls the given function as soon as a style or layout flush for the
644    * top-level document is not necessary, and returns a Promise which
645    * resolves to the callback's return value after it executes.
646    *
647    * In the event that the window goes away before a flush can occur, the
648    * callback will still be called and the Promise resolved as the window
649    * tears itself down.
650    *
651    * The callback _must not modify the DOM for any window in any way_. If it
652    * does, after finishing executing, the Promise returned by
653    * promiseDocumentFlushed will reject with
654    * NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR.
655    *
656    * Note that the callback can be called either synchronously or asynchronously
657    * depending on whether or not flushes are pending:
658    *
659    *   The callback will be called synchronously when calling
660    *   promiseDocumentFlushed when NO flushes are already pending. This is
661    *   to ensure that no script has a chance to dirty the DOM before the callback
662    *   is called.
663    *
664    *   The callback will be called asynchronously if a flush is pending.
665    *
666    * The expected execution order is that all pending callbacks will
667    * be fired first (and in the order that they were queued) and then the
668    * Promise resolution handlers will all be invoked later on during the
669    * next microtask checkpoint.
670    *
671    * Using window.top.promiseDocumentFlushed in combination with a callback
672    * that is querying items in a window that might be swapped out via
673    * nsFrameLoader::SwapWithOtherLoader is highly discouraged. For example:
674    *
675    *   let result = await window.top.promiseDocumentFlushed(() => {
676    *     return window.document.body.getBoundingClientRect();
677    *   });
678    *
679    *   If "window" might get swapped out via nsFrameLoader::SwapWithOtherLoader
680    *   at any time, then the callback might get called when the new host window
681    *   will still incur layout flushes, since it's only the original host window
682    *   that's being monitored via window.top.promiseDocumentFlushed.
683    *
684    *   See bug 1519407 for further details.
685    *
686    * promiseDocumentFlushed does not support re-entrancy - so calling it from
687    * within a promiseDocumentFlushed callback will result in the inner call
688    * throwing an NS_ERROR_FAILURE exception, and the outer Promise rejecting
689    * with that exception.
690    *
691    * The callback function *must not make any changes which would require
692    * a style or layout flush*.
693    *
694    * Also throws NS_ERROR_FAILURE if the window is not in a state where flushes
695    * can be waited for (for example, the PresShell has not yet been created).
696    *
697    * @param {function} callback
698    * @returns {Promise}
699    */
700   [NewObject, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
701   Promise<any> promiseDocumentFlushed(PromiseDocumentFlushedCallback callback);
703   [Func="IsChromeOrUAWidget"]
704   readonly attribute boolean isChromeWindow;
706   [Func="nsGlobalWindowInner::IsGleanNeeded"]
707   readonly attribute GleanImpl Glean;
708   [Func="nsGlobalWindowInner::IsGleanNeeded"]
709   readonly attribute GleanPingsImpl GleanPings;
712 partial interface Window {
713   [Pref="dom.vr.enabled"]
714   attribute EventHandler onvrdisplayconnect;
715   [Pref="dom.vr.enabled"]
716   attribute EventHandler onvrdisplaydisconnect;
717   [Pref="dom.vr.enabled"]
718   attribute EventHandler onvrdisplayactivate;
719   [Pref="dom.vr.enabled"]
720   attribute EventHandler onvrdisplaydeactivate;
721   [Pref="dom.vr.enabled"]
722   attribute EventHandler onvrdisplaypresentchange;
725 #ifndef RELEASE_OR_BETA
726 // https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet
727 partial interface Window {
728     [Pref="dom.paintWorklet.enabled", Throws]
729     readonly attribute Worklet paintWorklet;
731 #endif
733 Window includes WindowOrWorkerGlobalScope;
735 partial interface Window {
736   [Throws]
737   unsigned long requestIdleCallback(IdleRequestCallback callback,
738                                     optional IdleRequestOptions options = {});
739   undefined     cancelIdleCallback(unsigned long handle);
742 dictionary IdleRequestOptions {
743   unsigned long timeout;
746 callback IdleRequestCallback = undefined (IdleDeadline deadline);
748 partial interface Window {
749   /**
750    * Returns a list of locales that the internationalization components
751    * should be localized to.
752    *
753    * The function name refers to Regional Preferences which can be either
754    * fetched from the internal internationalization database (CLDR), or
755    * from the host environment.
756    *
757    * The result is a sorted list of valid locale IDs and it should be
758    * used for all APIs that accept list of locales, like ECMA402 and L10n APIs.
759    *
760    * This API always returns at least one locale.
761    *
762    * Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
763    */
764   [Func="IsChromeOrUAWidget"]
765   sequence<DOMString> getRegionalPrefsLocales();
767   /**
768    * Returns a list of locales that the web content would know from the user.
769    *
770    * One of the fingerprinting technique is to recognize users from their locales
771    * exposed to web content. For those components that would be fingerprintable
772    * from the locale should call this API instead of |getRegionalPrefsLocales()|.
773    *
774    * If the pref is set to spoof locale setting, this function will return the
775    * spoofed locale, otherwise it returns what |getRegionalPrefsLocales()| returns.
776    *
777    * This API always returns at least one locale.
778    *
779    * Example: ["en-US"]
780    */
781   [Func="IsChromeOrUAWidget"]
782   sequence<DOMString> getWebExposedLocales();
784   /**
785    * Getter funcion for IntlUtils, which provides helper functions for
786    * localization.
787    */
788   [Throws, Func="IsChromeOrUAWidget"]
789   readonly attribute IntlUtils intlUtils;
792 partial interface Window {
793   [SameObject, Replaceable]
794   readonly attribute VisualViewport visualViewport;
797 // Used to assign marks to appear on the scrollbar when
798 // finding on a page.
799 partial interface Window {
800   // The marks are values between 0 and scrollMax{X,Y} - scrollMin{X,Y}.
801   [ChromeOnly]
802   undefined setScrollMarks(sequence<unsigned long> marks,
803                            optional boolean onHorizontalScrollbar = false);
806 dictionary WindowPostMessageOptions : StructuredSerializeOptions {
807   USVString targetOrigin = "/";
810 // https://wicg.github.io/cookie-store/#Window
811 [SecureContext]
812 partial interface Window {
813   [SameObject, Pref="dom.cookieStore.enabled"] readonly attribute CookieStore cookieStore;