File: window.idl

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (224 lines) | stat: -rw-r--r-- 12,417 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/*
 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
 * Copyright (C) 2011 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

// https://html.spec.whatwg.org/C/#the-window-object

// FIXME: explain all uses of [CrossOrigin]
// NOTE: In the spec, Window inherits from EventTarget. We inject an additional
// layer to implement window's named properties object.
[
    ImplementedAs=DOMWindow,
    Global=Window,
    Exposed=Window
] interface Window : WindowProperties {
    // the current browsing context
    // FIXME: The spec uses the WindowProxy type for this and many other attributes.
    [LegacyUnforgeable, CrossOrigin, CachedAccessor=kWindowProxy, Measure] readonly attribute Window window;
    [Replaceable, CrossOrigin, CachedAccessor=kWindowProxy, Measure] readonly attribute Window self;
    [LegacyUnforgeable, CachedAccessor=kWindowDocument] readonly attribute Document document;
    attribute DOMString name;
    [PutForwards=href, LegacyUnforgeable, CrossOrigin=(Getter,Setter), Measure] readonly attribute Location location;
    [CallWith=ScriptState] readonly attribute CustomElementRegistry customElements;
    readonly attribute History history;
    [Replaceable] readonly attribute Navigation navigation;
    [Replaceable, MeasureAs=BarPropLocationbar] readonly attribute BarProp locationbar;
    [Replaceable, MeasureAs=BarPropMenubar] readonly attribute BarProp menubar;
    [Replaceable, MeasureAs=BarPropPersonalbar] readonly attribute BarProp personalbar;
    [Replaceable, MeasureAs=BarPropScrollbars] readonly attribute BarProp scrollbars;
    [Replaceable, MeasureAs=BarPropStatusbar] readonly attribute BarProp statusbar;
    [Replaceable, MeasureAs=BarPropToolbar] readonly attribute BarProp toolbar;
    attribute DOMString status;
    [CrossOrigin, CallWith=Isolate, Measure] void close();
    [MeasureAs=WindowClosed, CrossOrigin] readonly attribute boolean closed;
    void stop();
    [CrossOrigin, CallWith=Isolate, Measure] void focus();
    [CrossOrigin, Measure] void blur();

    // other browsing contexts
    [Replaceable, CrossOrigin, CachedAccessor=kWindowProxy, Measure] readonly attribute Window frames;
    [Replaceable, CrossOrigin, Measure] readonly attribute unsigned long length;
    [LegacyUnforgeable, CrossOrigin, Measure] readonly attribute Window? top;
    // FIXME: opener should be of type any.
    [CrossOrigin, ImplementedAs=openerForBindings, CallWith=Isolate, RaisesException=Setter, Measure] attribute any opener;
    [Replaceable, CrossOrigin, Measure] readonly attribute Window? parent;
    [CheckSecurity=ReturnValue] readonly attribute Element? frameElement;

    [CallWith=Isolate, RaisesException] Window? open(optional USVString url="", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");

    // indexed properties
    // https://html.spec.whatwg.org/C/browsers.html#windowproxy-getownproperty
    [NotEnumerable, CrossOrigin] getter Window (unsigned long index);

    // named properties
    // The spec defines the named getter on the Window interface, but we inject
    // the named properties object as its own interface that Window inherits
    // from.
    // getter object (DOMString name);

    // the user agent
    [LogActivity=GetterOnly] readonly attribute Navigator navigator;

    [RuntimeEnabled=OriginIsolationHeader] readonly attribute boolean originAgentCluster;

    // user prompts
    [Measure, CallWith=ScriptState] void alert();
    [Measure, CallWith=ScriptState] void alert(DOMString message);
    [Measure, CallWith=ScriptState] boolean confirm(optional DOMString message = "");
    [Measure, CallWith=ScriptState] DOMString? prompt(optional DOMString message = "", optional DOMString defaultValue = "");
    [Measure, CallWith=ScriptState] void print();

    [CrossOrigin, CallWith=Isolate, RaisesException, Measure] void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);

    [CrossOrigin, CallWith=Isolate, RaisesException, Measure] void postMessage(any message, optional WindowPostMessageOptions options = {});

    // WindowOrWorkerGlobalScope mixin
    // https://html.spec.whatwg.org/C/#windoworworkerglobalscope-mixin
    // https://wicg.github.io/origin-policy/#monkeypatch-html-windoworworkerglobalscope
    [Replaceable] readonly attribute DOMString origin;

    // AnimationFrameProvider mixin
    // https://html.spec.whatwg.org/C/#animation-frames
    [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(FrameRequestCallback callback);
    void cancelAnimationFrame(long handle);

    // HTML obsolete features
    // https://html.spec.whatwg.org/C/#Window-partial
    [MeasureAs=WindowCaptureEvents] void captureEvents();
    [MeasureAs=WindowReleaseEvents] void releaseEvents();

    [Replaceable, SameObject] readonly attribute External external;

    // CSS Object Model (CSSOM)
    // https://drafts.csswg.org/cssom/#extensions-to-the-window-interface
    [Affects=Nothing, NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString? pseudoElt);

    // CSSOM View Module
    // https://drafts.csswg.org/cssom-view/#extensions-to-the-window-interface
    [HighEntropy, Measure, NewObject] MediaQueryList matchMedia(DOMString query);
    [SameObject, Replaceable] readonly attribute Screen screen;

    // browsing context
    [MeasureAs=WindowMove] void moveTo(long x, long y);
    [MeasureAs=WindowMove] void moveBy(long x, long y);
    [MeasureAs=WindowResize, RaisesException] void resizeTo(long x, long y);
    [MeasureAs=WindowResize, RaisesException] void resizeBy(long x, long y);

    // viewport
    [HighEntropy=Direct, MeasureAs=WindowInnerWidth, Replaceable] readonly attribute long innerWidth;
    [HighEntropy=Direct, MeasureAs=WindowInnerHeight, Replaceable] readonly attribute long innerHeight;

    // viewport scrolling
    [HighEntropy=Direct, MeasureAs=WindowScrollX, Replaceable] readonly attribute double scrollX;
    [HighEntropy=Direct, MeasureAs=WindowPageXOffset, Replaceable] readonly attribute double pageXOffset;
    [HighEntropy=Direct, MeasureAs=WindowScrollY, Replaceable] readonly attribute double scrollY;
    [HighEntropy=Direct, MeasureAs=WindowPageYOffset, Replaceable] readonly attribute double pageYOffset;
    void scroll(optional ScrollToOptions options = {});
    void scroll(unrestricted double x, unrestricted double y);
    void scrollTo(optional ScrollToOptions options = {});
    void scrollTo(unrestricted double x, unrestricted double y);
    void scrollBy(optional ScrollToOptions options = {});
    void scrollBy(unrestricted double x, unrestricted double y);

    // Visual Viewport API
    // https://github.com/WICG/ViewportAPI
    [Replaceable, SameObject] readonly attribute VisualViewport visualViewport;

    // Viewport API
    // https://drafts.csswg.org/css-viewport-1/
    [Replaceable, SameObject, RuntimeEnabled=ViewportSegments] readonly attribute Viewport viewport;

    // client
    [HighEntropy=Direct, MeasureAs=WindowScreenX, Replaceable] readonly attribute long screenX;
    [HighEntropy=Direct, MeasureAs=WindowScreenY, Replaceable] readonly attribute long screenY;
    [HighEntropy=Direct, MeasureAs=WindowOuterWidth, Replaceable] readonly attribute long outerWidth;
    [HighEntropy=Direct, MeasureAs=WindowOuterHeight, Replaceable] readonly attribute long outerHeight;
    [HighEntropy=Direct, MeasureAs=WindowDevicePixelRatio, Replaceable] readonly attribute double devicePixelRatio;

    // Selection API
    // https://w3c.github.io/selection-api/#extensions-to-window-interface
    [Affects=Nothing] Selection? getSelection();

    // Console API
    // https://console.spec.whatwg.org/#console-interface
    // [Replaceable] readonly attribute Console console;
    // Console is installed by v8 inspector when context is created
    // and is left commented here just for documentation.

    // Compatibility
    // https://compat.spec.whatwg.org/#windoworientation-interface
    [RuntimeEnabled=OrientationEvent] attribute EventHandler onorientationchange;
    // This is the interface orientation in degrees. Some examples are:
    //  0 is straight up; -90 is when the device is rotated 90 clockwise;
    //  90 is when rotated counter clockwise.
    [HighEntropy=Direct, MeasureAs=WindowOrientation, RuntimeEnabled=OrientationEvent] readonly attribute long orientation;

    // Event handler attribute for the pageswap event.
    [RuntimeEnabled=PageSwapEvent] attribute EventHandler onpageswap;

    // Event handler attribute for the pagereveal event.
    // https://drafts.csswg.org/css-view-transitions-2/#reveal-event
    [RuntimeEnabled=PageRevealEvent] attribute EventHandler onpagereveal;

    // https://dom.spec.whatwg.org/#interface-window-extensions
    [Replaceable, GetterCallWith=ScriptState, MeasureAs=WindowEvent] readonly attribute any event;

    // Non-standard APIs
    [MeasureAs=WindowClientInformation, Replaceable] readonly attribute Navigator clientInformation;
    [MeasureAs=WindowFind] boolean find(optional DOMString string = "",
                                        optional boolean caseSensitive = false,
                                        optional boolean backwards = false,
                                        optional boolean wrap = false,
                                        optional boolean wholeWord = false,
                                        optional boolean searchInFrames = false,
                                        optional boolean showDialog = false);
    [MeasureAs=WindowOffscreenBuffering, Replaceable, NotEnumerable] readonly attribute boolean offscreenBuffering;
    [HighEntropy=Direct, MeasureAs=WindowScreenLeft, Replaceable] readonly attribute long screenLeft;
    [HighEntropy=Direct, MeasureAs=WindowScreenTop, Replaceable] readonly attribute long screenTop;
    [RuntimeEnabled=WindowDefaultStatus,MeasureAs=WindowDefaultStatus] attribute DOMString defaultStatus;
    [RuntimeEnabled=WindowDefaultStatus,MeasureAs=WindowDefaultstatus, ImplementedAs=defaultStatus] attribute DOMString defaultstatus;
    [MeasureAs=StyleMedia] readonly attribute StyleMedia styleMedia;
    [DeprecateAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(FrameRequestCallback callback);
    [DeprecateAs=PrefixedCancelAnimationFrame, ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);

    // Event handler attributes
    attribute EventHandler onsearch;

    // TrustedTypes API: http://github.com/w3c/trusted-types
    [CallWith=ScriptState] readonly attribute TrustedTypePolicyFactory trustedTypes;

    // Anonymous iframe:
    // https://github.com/WICG/anonymous-iframe
    [RuntimeEnabled=AnonymousIframe] readonly attribute boolean credentialless;

    // Collection of fenced frame APIs
    // https://github.com/shivanigithub/fenced-frame/issues/14
    [RuntimeEnabled=FencedFrames] readonly attribute Fence? fence;
};

Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;
Window includes UniversalGlobalScope;
Window includes WindowOrWorkerGlobalScope;