tor-browser

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

Window.webidl (37460B)


      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 */
     22 
     23 interface Principal;
     24 interface nsIBrowserDOMWindow;
     25 interface XULControllers;
     26 interface nsIDOMWindowUtils;
     27 interface nsIPrintSettings;
     28 
     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  [Replaceable, 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;
    223 
    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);
    236 
    237  // the user agent
    238  readonly attribute Navigator navigator;
    239  [Replaceable, BinaryName="Navigator"]
    240  readonly attribute Navigator clientInformation;
    241 
    242  [Replaceable] readonly attribute External external;
    243 
    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();
    251 
    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);
    260 
    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 = {});
    267 
    268  // also has obsolete members
    269 };
    270 Window includes GlobalEventHandlers;
    271 Window includes WindowEventHandlers;
    272 
    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;
    277 };
    278 Window includes WindowSessionStorage;
    279 
    280 // http://www.whatwg.org/specs/web-apps/current-work/
    281 interface mixin WindowLocalStorage {
    282  [Throws] readonly attribute Storage? localStorage;
    283 };
    284 Window includes WindowLocalStorage;
    285 
    286 // http://www.whatwg.org/specs/web-apps/current-work/
    287 partial interface Window {
    288  undefined captureEvents();
    289  undefined releaseEvents();
    290 };
    291 
    292 // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
    293 partial interface Window {
    294  //[Throws] Selection getSelection();
    295  [Throws] Selection? getSelection();
    296 };
    297 
    298 // https://drafts.csswg.org/cssom/#extensions-to-the-window-interface
    299 partial interface Window {
    300  //[NewObject, Throws] CSSStyleProperties getComputedStyle(Element elt, optional DOMString? pseudoElt = "");
    301  [NewObject, Throws] CSSStyleProperties? getComputedStyle(Element elt, optional DOMString? pseudoElt = "");
    302 };
    303 
    304 // http://dev.w3.org/csswg/cssom-view/
    305 enum ScrollBehavior { "auto", "instant", "smooth" };
    306 
    307 dictionary ScrollOptions {
    308  ScrollBehavior behavior = "auto";
    309 };
    310 
    311 dictionary ScrollToOptions : ScrollOptions {
    312  unrestricted double left;
    313  unrestricted double top;
    314 };
    315 
    316 partial interface Window {
    317  //[Throws, NewObject, NeedsCallerType] MediaQueryList matchMedia(DOMString query);
    318  [Throws, NewObject, NeedsCallerType] MediaQueryList? matchMedia(UTF8String query);
    319 
    320  [SameObject, Replaceable] readonly attribute Screen screen;
    321 
    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);
    331 
    332  // viewport
    333  [Replaceable, Throws] readonly attribute double innerWidth;
    334  [Replaceable, Throws] readonly attribute double innerHeight;
    335 
    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;
    354 
    355  // Aliases for screenX / screenY.
    356  [Replaceable, Throws, NeedsCallerType] readonly attribute double screenLeft;
    357  [Replaceable, Throws, NeedsCallerType] readonly attribute double screenTop;
    358 
    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;
    364 };
    365 
    366 // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames
    367 Window includes AnimationFrameProvider;
    368 
    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;
    372 };
    373 
    374 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
    375 Window includes GlobalCrypto;
    376 
    377 dictionary SizeToContentConstraints {
    378  long maxWidth = 0;
    379  long maxHeight = 0;
    380  long prefWidth = 0;
    381 };
    382 
    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;
    387 };
    388 
    389 Window includes SpeechSynthesisGetter;
    390 #endif
    391 
    392 // Mozilla-specific stuff
    393 dictionary SynthesizeMouseEventData {
    394  // A unique identifier for the pointer causing the event, defaulting to 0.
    395  unsigned long identifier = 0;
    396  // Indicates which mouse button is pressed/released when a mouse event is triggered.
    397  long button = 0;
    398  // Indicates which mouse buttons are pressed when a mouse event is triggered.
    399  // If not specified, the value is generated from the button property.
    400  long buttons;
    401  // Number of clicks that have been performed. If not specified, a default value
    402  // is generated based on the event type, e.g. 1 for mousedown and mouseup events,
    403  // and 0 for others.
    404  long clickCount;
    405  // Touch input pressure (0.0 -> 1.0).
    406  float pressure = 0;
    407  // Input source, see MouseEvent for values. Defaults to MouseEvent.MOZ_SOURCE_MOUSE.
    408  short inputSource = 1;
    409  // Modifiers pressed, using constants defined as MODIFIER_* in nsIDOMWindowUtils.
    410  long modifiers = 0;
    411 };
    412 
    413 // Mozilla-specific stuff
    414 dictionary SynthesizeMouseEventOptions {
    415  // Indicates whether the event should ignore viewport bounds during dispatch.
    416  boolean ignoreRootScrollFrame = false;
    417  // If true the event is dispatched to the parent process through APZ,
    418  // without being injected into the OS event queue.
    419  boolean isAsyncEnabled = false;
    420  // Controls Event.isSynthesized value that helps identifying test related events.
    421  boolean isDOMEventSynthesized = true;
    422  // Controls WidgetMouseEvent.mReason value.
    423  boolean isWidgetEventSynthesized = false;
    424  // Set this to true to ensure that the event is dispatched to this DOM window
    425  // or one of its children.
    426  boolean toWindow = false;
    427 };
    428 
    429 // Mozilla-specific stuff
    430 partial interface Window {
    431  //[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
    432  [NewObject, Throws] CSSStyleDeclaration? getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
    433 
    434  // Mozilla extensions
    435  /**
    436   * Method for scrolling this window by a number of lines.
    437   */
    438  undefined                 scrollByLines(long numLines, optional ScrollOptions options = {});
    439 
    440  /**
    441   * Method for scrolling this window by a number of pages.
    442   */
    443  undefined                 scrollByPages(long numPages, optional ScrollOptions options = {});
    444 
    445 
    446  /**
    447   * Chrome-only method for sizing to content with an optional
    448   * maximum-size constraint on either (or both) directions.
    449   */
    450  [Throws, ChromeOnly] undefined sizeToContent(optional SizeToContentConstraints constraints = {});
    451 
    452  [ChromeOnly, Replaceable, Throws] readonly attribute XULControllers controllers;
    453 
    454  [ChromeOnly, Throws] readonly attribute Element? realFrameElement;
    455 
    456  [ChromeOnly] readonly attribute nsIDocShell? docShell;
    457 
    458  [ChromeOnly, Constant, CrossOriginReadable, BinaryName="getBrowsingContext"]
    459  readonly attribute BrowsingContext browsingContext;
    460 
    461  [Throws, NeedsCallerType]
    462  readonly attribute float mozInnerScreenX;
    463  [Throws, NeedsCallerType]
    464  readonly attribute float mozInnerScreenY;
    465  [Replaceable, Throws, NeedsCallerType]
    466  readonly attribute double devicePixelRatio;
    467 
    468  // Allows chrome code to convert desktop pixels to device pixels and vice
    469  // versa. Useful for interacting with the screen manager.
    470  [ChromeOnly, Throws]
    471  readonly attribute double desktopToDeviceScale;
    472 
    473  // Returns the amount of CSS pixels relative to this window we're allowed to
    474  // go out of the screen. This is needed so that SessionRestore is able to
    475  // position windows that use client-side decorations correctly, but still
    476  // pull mispositioned windows into the screen.
    477  [ChromeOnly]
    478  readonly attribute double screenEdgeSlopX;
    479  [ChromeOnly]
    480  readonly attribute double screenEdgeSlopY;
    481 
    482 
    483  /* The maximum offset that the window can be scrolled to
    484     (i.e., the document width/height minus the scrollport width/height) */
    485  [ChromeOnly, Throws]  readonly attribute long   scrollMinX;
    486  [ChromeOnly, Throws]  readonly attribute long   scrollMinY;
    487  [Replaceable, Throws] readonly attribute long   scrollMaxX;
    488  [Replaceable, Throws] readonly attribute long   scrollMaxY;
    489 
    490  [Throws, Deprecated=FullscreenAttribute] attribute boolean fullScreen;
    491 
    492  undefined                 updateCommands(DOMString action);
    493 
    494  /* Find in page.
    495   * @param str: the search pattern
    496   * @param caseSensitive: is the search caseSensitive
    497   * @param backwards: should we search backwards
    498   * @param wrapAround: should we wrap the search
    499   * @param wholeWord: should we search only for whole words
    500   * @param searchInFrames: should we search through all frames
    501   * @param showDialog: should we show the Find dialog
    502   */
    503  [Throws] boolean    find(optional DOMString str = "",
    504                           optional boolean caseSensitive = false,
    505                           optional boolean backwards = false,
    506                           optional boolean wrapAround = false,
    507                           optional boolean wholeWord = false,
    508                           optional boolean searchInFrames = false,
    509                           optional boolean showDialog = false);
    510 
    511           attribute EventHandler ondevicemotion;
    512           attribute EventHandler ondeviceorientation;
    513           attribute EventHandler ondeviceorientationabsolute;
    514           [Pref="device.sensors.proximity.enabled"]
    515           attribute EventHandler onuserproximity;
    516           [Pref="device.sensors.ambientLight.enabled"]
    517           attribute EventHandler ondevicelight;
    518 
    519  undefined                 dump(DOMString str);
    520 
    521  /**
    522   * This method is here for backwards compatibility with 4.x only,
    523   * its implementation is a no-op
    524   */
    525  undefined                 setResizable(boolean resizable);
    526 
    527  /**
    528   * This is the scriptable version of
    529   * nsPIDOMWindow::OpenDialog() that takes 3 optional
    530   * arguments, plus any additional arguments are passed on as
    531   * arguments on the dialog's window object (window.arguments).
    532   */
    533  [Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "",
    534                                               optional DOMString name = "",
    535                                               optional DOMString options = "",
    536                                               any... extraArguments);
    537 
    538  [ChromeOnly,
    539   NonEnumerable, Replaceable, Throws, NeedsCallerType]
    540  readonly attribute object? content;
    541 
    542  [Throws, ChromeOnly] any getInterface(any iid);
    543 
    544  /**
    545   * Same as nsIDOMWindow.windowRoot, useful for event listener targeting.
    546   */
    547  [ChromeOnly, Throws]
    548  readonly attribute WindowRoot? windowRoot;
    549 
    550  /**
    551   * ChromeOnly method to determine if a particular window should see console
    552   * reports from service workers of the given scope.
    553   */
    554  [ChromeOnly]
    555  boolean shouldReportForServiceWorkerScope(USVString aScope);
    556 
    557  /**
    558   * InstallTrigger was an interface for installing extensions. It was disabled
    559   * in bug 1772901 and the implementation was removed in bug 1776426.
    560   *
    561   * We maintain this stub to avoid breaking websites that do
    562   * "typeof InstallTrigger !== 'undefined" to detect Firefox
    563   */
    564  [Replaceable, Deprecated="InstallTriggerDeprecated", Pref="extensions.InstallTrigger.enabled"]
    565  readonly attribute object? InstallTrigger;
    566 
    567  /**
    568   * Get the nsIDOMWindowUtils for this window.
    569   */
    570  [Constant, Throws, ChromeOnly]
    571  readonly attribute nsIDOMWindowUtils windowUtils;
    572 
    573  /**
    574   * Synthesize a mouse event. The event types supported are:
    575   *    mousedown, mouseup, mousemove, mouseover, mouseout, mousecancel,
    576   *    contextmenu, MozMouseHittest
    577   *
    578   * Events are sent in coordinates offset by offsetX and offsetY from the window.
    579   *
    580   * Note that additional events may be fired as a result of this call. For
    581   * instance, typically a click event will be fired as a result of a
    582   * mousedown and mouseup in sequence.
    583   *
    584   * Normally at this level of events, the mouseover and mouseout events are
    585   * only fired when the window is entered or exited. For inter-element
    586   * mouseover and mouseout events, a movemove event fired on the new element
    587   * should be sufficient to generate the correct over and out events as well.
    588   *
    589   * The event is dispatched via the toplevel window, so it could go to any
    590   * window under the toplevel window, in some cases it could never reach this
    591   * window at all.
    592   *
    593   * NOTE: mousecancel is used to represent the vanishing of an input device
    594   * such as a pen leaving its digitizer by synthesizing a WidgetMouseEvent,
    595   * whose mMessage is eMouseExitFromWidget and mExitFrom is
    596   * WidgetMouseEvent::eTopLevel.
    597   *
    598   * @param type            Event type.
    599   * @param offsetX         X offset in CSS pixels.
    600   * @param offsetY         Y offset in CSS pixels.
    601   * @param mouseEventData  A SynthesizeMouseEventData dictionary containing mouse event data.
    602   * @param options         A SynthesizeMouseEventOptions dictionary containing options
    603   *                        for the event dispatching.
    604   * @param callback        A function to call when the synthesized mouse event
    605   *                        has been dispatched.
    606   *                        XXX: This is currently not supported in the content
    607   *                        process, simply because we don't have a use case for
    608   *                        it yet. The same applies when the synthesized event
    609   *                        might be coalesced, such as when
    610   *                        `isDOMEventSynthesized = false`.
    611   *                        In such cases, passing callback will throw an
    612   *                        exception.
    613   *
    614   * @return true if someone called prevent default on this event.
    615   */
    616  [ChromeOnly, Throws]
    617  boolean synthesizeMouseEvent(DOMString type, float offsetX, float offsetY,
    618                               optional SynthesizeMouseEventData mouseEventData = {},
    619                               optional SynthesizeMouseEventOptions options = {},
    620                               optional VoidFunction callback);
    621 
    622  [Pure, ChromeOnly]
    623  readonly attribute WindowGlobalChild? windowGlobalChild;
    624 
    625  /**
    626   * The principal of the client source of the window. This is supposed to be
    627   * used for the service worker.
    628   *
    629   * This is used for APIs like https://w3c.github.io/push-api/ that extend
    630   * ServiceWorkerRegistration and therefore need to operate consistently with
    631   * ServiceWorkers and its Clients API. The client principal is the appropriate
    632   * principal to pass to all nsIServiceWorkerManager APIs.
    633   *
    634   * Note that the client principal will be different from the node principal of
    635   * the window's document if the window is in a third-party context when dFPI
    636   * is enabled. In this case, the client principal will be the partitioned
    637   * principal to support the service worker partitioning.
    638   */
    639  [ChromeOnly]
    640  readonly attribute Principal? clientPrincipal;
    641 
    642  /**
    643   *  Whether the chrome window is currently in a full screen transition. This
    644   *  flag is updated from FullscreenTransitionTask.
    645   *  Always set to false for non-chrome windows.
    646   */
    647  [ChromeOnly]
    648  readonly attribute boolean isInFullScreenTransition;
    649 };
    650 
    651 Window includes TouchEventHandlers;
    652 
    653 Window includes OnErrorEventHandlerForWindow;
    654 
    655 #if defined(MOZ_WIDGET_ANDROID)
    656 // https://compat.spec.whatwg.org/#windoworientation-interface
    657 partial interface Window {
    658  [NeedsCallerType]
    659  readonly attribute short orientation;
    660           attribute EventHandler onorientationchange;
    661 };
    662 #endif
    663 
    664 [MOZ_CAN_RUN_SCRIPT_BOUNDARY]
    665 callback PromiseDocumentFlushedCallback = any ();
    666 
    667 // Mozilla extensions for Chrome windows.
    668 partial interface Window {
    669  // The STATE_* constants need to match the corresponding enum in nsGlobalWindow.cpp.
    670  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    671  const unsigned short STATE_MAXIMIZED = 1;
    672  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    673  const unsigned short STATE_MINIMIZED = 2;
    674  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    675  const unsigned short STATE_NORMAL = 3;
    676  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    677  const unsigned short STATE_FULLSCREEN = 4;
    678 
    679  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    680  readonly attribute unsigned short windowState;
    681 
    682  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    683  readonly attribute boolean isFullyOccluded;
    684 
    685  /**
    686   * On Windows, returns whether the window is cloaked, presumably
    687   * because it is on another virtual desktop. Per Microsoft, we
    688   * should not automatically switch to this window if we are looking
    689   * for an existing window to focus, and instead open a new window.
    690   * On non-Windows platforms, this is always false.
    691   */
    692  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    693  readonly attribute boolean isCloaked;
    694 
    695  /**
    696   * browserDOMWindow provides access to yet another layer of
    697   * utility functions implemented by chrome script. It will be null
    698   * for DOMWindows not corresponding to browsers.
    699   */
    700  [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    701           attribute nsIBrowserDOMWindow? browserDOMWindow;
    702 
    703  [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    704  undefined                 getAttention();
    705 
    706  [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    707  undefined                 getAttentionWithCycleCount(long aCycleCount);
    708 
    709  [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    710  undefined                 setCursor(UTF8String cursor);
    711 
    712  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    713  undefined                 maximize();
    714  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    715  undefined                 minimize();
    716  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    717  undefined                 restore();
    718  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    719  DOMString                 getWorkspaceID();
    720  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    721  undefined                 moveToWorkspace(DOMString workspaceID);
    722 
    723  /**
    724   * Notify a default button is loaded on a dialog or a wizard.
    725   * defaultButton is the default button.
    726   */
    727  [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    728  undefined notifyDefaultButtonLoaded(Element defaultButton);
    729 
    730  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    731  readonly attribute ChromeMessageBroadcaster messageManager;
    732 
    733  /**
    734   * Returns the message manager identified by the given group name that
    735   * manages all frame loaders belonging to that group.
    736   */
    737  [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    738  ChromeMessageBroadcaster getGroupMessageManager(DOMString aGroup);
    739 
    740  /**
    741   * Calls the given function as soon as a style or layout flush for the
    742   * top-level document is not necessary, and returns a Promise which
    743   * resolves to the callback's return value after it executes.
    744   *
    745   * In the event that the window goes away before a flush can occur, the
    746   * callback will still be called and the Promise resolved as the window
    747   * tears itself down.
    748   *
    749   * The callback _must not modify the DOM for any window in any way_. If it
    750   * does, after finishing executing, the Promise returned by
    751   * promiseDocumentFlushed will reject with
    752   * NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR.
    753   *
    754   * Note that the callback can be called either synchronously or asynchronously
    755   * depending on whether or not flushes are pending:
    756   *
    757   *   The callback will be called synchronously when calling
    758   *   promiseDocumentFlushed when NO flushes are already pending. This is
    759   *   to ensure that no script has a chance to dirty the DOM before the callback
    760   *   is called.
    761   *
    762   *   The callback will be called asynchronously if a flush is pending.
    763   *
    764   * The expected execution order is that all pending callbacks will
    765   * be fired first (and in the order that they were queued) and then the
    766   * Promise resolution handlers will all be invoked later on during the
    767   * next microtask checkpoint.
    768   *
    769   * Using window.top.promiseDocumentFlushed in combination with a callback
    770   * that is querying items in a window that might be swapped out via
    771   * nsFrameLoader::SwapWithOtherLoader is highly discouraged. For example:
    772   *
    773   *   let result = await window.top.promiseDocumentFlushed(() => {
    774   *     return window.document.body.getBoundingClientRect();
    775   *   });
    776   *
    777   *   If "window" might get swapped out via nsFrameLoader::SwapWithOtherLoader
    778   *   at any time, then the callback might get called when the new host window
    779   *   will still incur layout flushes, since it's only the original host window
    780   *   that's being monitored via window.top.promiseDocumentFlushed.
    781   *
    782   *   See bug 1519407 for further details.
    783   *
    784   * promiseDocumentFlushed does not support re-entrancy - so calling it from
    785   * within a promiseDocumentFlushed callback will result in the inner call
    786   * throwing an NS_ERROR_FAILURE exception, and the outer Promise rejecting
    787   * with that exception.
    788   *
    789   * The callback function *must not make any changes which would require
    790   * a style or layout flush*.
    791   *
    792   * Also throws NS_ERROR_FAILURE if the window is not in a state where flushes
    793   * can be waited for (for example, the PresShell has not yet been created).
    794   *
    795   * @param {function} callback
    796   * @returns {Promise}
    797   */
    798  [NewObject, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"]
    799  Promise<any> promiseDocumentFlushed(PromiseDocumentFlushedCallback callback);
    800 
    801  [Func="IsChromeOrUAWidget"]
    802  readonly attribute boolean isChromeWindow;
    803 
    804  [Func="GleanWebidlEnabled"]
    805  readonly attribute GleanImpl Glean;
    806  [Func="GleanWebidlEnabled"]
    807  readonly attribute GleanPingsImpl GleanPings;
    808 };
    809 
    810 partial interface Window {
    811  [Pref="dom.vr.enabled"]
    812  attribute EventHandler onvrdisplayconnect;
    813  [Pref="dom.vr.enabled"]
    814  attribute EventHandler onvrdisplaydisconnect;
    815  [Pref="dom.vr.enabled"]
    816  attribute EventHandler onvrdisplayactivate;
    817  [Pref="dom.vr.enabled"]
    818  attribute EventHandler onvrdisplaydeactivate;
    819  [Pref="dom.vr.enabled"]
    820  attribute EventHandler onvrdisplaypresentchange;
    821 };
    822 
    823 #ifndef RELEASE_OR_BETA
    824 // https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet
    825 partial interface Window {
    826    [Pref="dom.paintWorklet.enabled", Throws]
    827    readonly attribute Worklet paintWorklet;
    828 };
    829 #endif
    830 
    831 Window includes WindowOrWorkerGlobalScope;
    832 
    833 partial interface Window {
    834  [Throws]
    835  unsigned long requestIdleCallback(IdleRequestCallback callback,
    836                                    optional IdleRequestOptions options = {});
    837  undefined     cancelIdleCallback(unsigned long handle);
    838 };
    839 
    840 dictionary IdleRequestOptions {
    841  unsigned long timeout;
    842 };
    843 
    844 callback IdleRequestCallback = undefined (IdleDeadline deadline);
    845 
    846 partial interface Window {
    847  /**
    848   * Returns a list of locales that the web content would know from the user.
    849   *
    850   * One of the fingerprinting technique is to recognize users from their locales
    851   * exposed to web content. For those components that would be fingerprintable
    852   * from the locale should call this API instead of |getRegionalPrefsLocales()|.
    853   *
    854   * If the pref is set to spoof locale setting, this function will return the
    855   * spoofed locale, otherwise it returns what |getRegionalPrefsLocales()| returns.
    856   *
    857   * This API always returns at least one locale.
    858   *
    859   * Example: ["en-US"]
    860   */
    861  [Func="IsChromeOrUAWidget"]
    862  sequence<DOMString> getWebExposedLocales();
    863 
    864  /**
    865   * Getter funcion for IntlUtils, which provides helper functions for
    866   * localization.
    867   */
    868  [Throws, Func="IsChromeOrUAWidget"]
    869  readonly attribute IntlUtils intlUtils;
    870 };
    871 
    872 partial interface Window {
    873  [SameObject, Replaceable]
    874  readonly attribute VisualViewport visualViewport;
    875 };
    876 
    877 // Used to assign marks to appear on the scrollbar when
    878 // finding on a page.
    879 partial interface Window {
    880  // The marks are values between 0 and scrollMax{X,Y} - scrollMin{X,Y}.
    881  [ChromeOnly]
    882  undefined setScrollMarks(sequence<unsigned long> marks,
    883                           optional boolean onHorizontalScrollbar = false);
    884 };
    885 
    886 dictionary WindowPostMessageOptions : StructuredSerializeOptions {
    887  USVString targetOrigin = "/";
    888 };
    889 
    890 // https://wicg.github.io/cookie-store/#Window
    891 [SecureContext]
    892 partial interface Window {
    893  [SameObject, Pref="dom.cookieStore.enabled"] readonly attribute CookieStore cookieStore;
    894 };
    895 
    896 // https://html.spec.whatwg.org/multipage/browsers.html#origin-keyed-agent-clusters
    897 partial interface Window {
    898  [Pref="dom.origin_agent_cluster.enabled"] readonly attribute boolean originAgentCluster;
    899 };
    900 
    901 // https://wicg.github.io/document-picture-in-picture/#api
    902 partial interface Window {
    903  [SameObject, SecureContext, Pref="dom.documentpip.enabled"]
    904  readonly attribute DocumentPictureInPicture documentPictureInPicture;
    905 };