OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * | |
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 */ | |
26 | |
27 [ | |
28 CheckSecurity, | |
29 EventTarget, | |
30 CustomToV8, | |
31 DoNotGenerateWrap, | |
32 ImplementedAs=DOMWindow | |
33 ] interface Window { | |
34 // DOM Level 0 | |
35 [Replaceable] readonly attribute Screen screen; | |
36 [Replaceable] readonly attribute History history; | |
37 [Replaceable] readonly attribute BarProp locationbar; | |
38 [Replaceable] readonly attribute BarProp menubar; | |
39 [Replaceable] readonly attribute BarProp personalbar; | |
40 [Replaceable] readonly attribute BarProp scrollbars; | |
41 [Replaceable] readonly attribute BarProp statusbar; | |
42 [Replaceable] readonly attribute BarProp toolbar; | |
43 [Replaceable, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds] readonl
y attribute Navigator navigator; | |
44 [Replaceable] readonly attribute Navigator clientInformation; | |
45 [DoNotCheckSecurity, CustomSetter, Unforgeable, Replaceable, PerWorldBinding
s, ActivityLog=AccessForIsolatedWorlds] readonly attribute Location location; | |
46 [MeasureAs=WindowEvent, NotEnumerable, Replaceable, CustomGetter, CustomSett
er] readonly attribute Event event; | |
47 | |
48 Selection getSelection(); | |
49 | |
50 [CheckSecurityForNode] readonly attribute Element frameElement; | |
51 | |
52 [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void focus(); | |
53 [DoNotCheckSecurity] void blur(); | |
54 [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void close(); | |
55 | |
56 void print(); | |
57 void stop(); | |
58 | |
59 [Custom] Window open(DOMString url, | |
60 DOMString name, | |
61 optional DOMString options); | |
62 | |
63 [Custom] any showModalDialog(DOMString url, | |
64 optional any dialogArgs, | |
65 optional DOMString featureArgs); | |
66 | |
67 void alert([Default=Undefined] optional DOMString message); | |
68 boolean confirm([Default=Undefined] optional DOMString message); | |
69 [TreatReturnedNullStringAs=Null] DOMString prompt([Default=Undefined] option
al DOMString message, | |
70 [TreatNullAs=NullString, TreatUn
definedAs=NullString,Default=Undefined] optional DOMString defaultValue); | |
71 | |
72 boolean find([Default=Undefined] optional DOMString string, | |
73 [Default=Undefined] optional boolean caseSensitive, | |
74 [Default=Undefined] optional boolean backwards, | |
75 [Default=Undefined] optional boolean wrap, | |
76 [Default=Undefined] optional boolean wholeWord, | |
77 [Default=Undefined] optional boolean searchInFrames, | |
78 [Default=Undefined] optional boolean showDialog); | |
79 | |
80 [Replaceable] readonly attribute boolean offscreenBuffering; | |
81 | |
82 [Replaceable] readonly attribute long outerHeight; | |
83 [Replaceable] readonly attribute long outerWidth; | |
84 [Replaceable] readonly attribute long innerHeight; | |
85 [Replaceable] readonly attribute long innerWidth; | |
86 [Replaceable] readonly attribute long screenX; | |
87 [Replaceable] readonly attribute long screenY; | |
88 [Replaceable] readonly attribute long screenLeft; | |
89 [Replaceable] readonly attribute long screenTop; | |
90 [Replaceable] readonly attribute long scrollX; | |
91 [Replaceable] readonly attribute long scrollY; | |
92 readonly attribute long pageXOffset; | |
93 readonly attribute long pageYOffset; | |
94 | |
95 void scrollBy([Default=Undefined] optional long x, [Default=Undefined] optio
nal long y); | |
96 void scrollTo([Default=Undefined] optional long x, [Default=Undefined] optio
nal long y); | |
97 void scroll([Default=Undefined] optional long x, [Default=Undefined] optiona
l long y); | |
98 void moveBy([Default=Undefined] optional float x, [Default=Undefined] option
al float y); // FIXME: this should take longs not floats. | |
99 void moveTo([Default=Undefined] optional float x, [Default=Undefined] option
al float y); // FIXME: this should take longs not floats. | |
100 void resizeBy([Default=Undefined] optional float x, [Default=Undefined] opti
onal float y); // FIXME: this should take longs not floats. | |
101 void resizeTo([Default=Undefined] optional float width, [Default=Undefined]
optional float height); // FIXME: this should take longs not floats. | |
102 | |
103 [DoNotCheckSecurity] readonly attribute boolean closed; | |
104 | |
105 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute unsigned long l
ength; | |
106 | |
107 attribute DOMString name; | |
108 | |
109 attribute DOMString status; | |
110 attribute DOMString defaultStatus; | |
111 // This attribute is an alias of defaultStatus and is necessary for legacy u
ses. | |
112 attribute DOMString defaultstatus; | |
113 | |
114 // Self referential attributes | |
115 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window self; | |
116 [DoNotCheckSecurity, Unforgeable] readonly attribute Window window; | |
117 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window frames; | |
118 | |
119 [Replaceable, DoNotCheckSecurityOnGetter, CustomSetter] readonly attribute W
indow opener; | |
120 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window parent; | |
121 [DoNotCheckSecurityOnGetter, Unforgeable] readonly attribute Window top; | |
122 | |
123 // DOM Level 2 AbstractView Interface | |
124 readonly attribute Document document; | |
125 | |
126 // CSSOM View Module | |
127 MediaQueryList matchMedia(DOMString query); | |
128 | |
129 // styleMedia has been removed from the CSSOM View specification. | |
130 readonly attribute StyleMedia styleMedia; | |
131 | |
132 // DOM Level 2 Style Interface | |
133 [PerWorldBindings] CSSStyleDeclaration getComputedStyle([Default=Undefined]
optional Element element, | |
134 [TreatNullAs=NullS
tring, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoE
lement); | |
135 | |
136 // WebKit extensions | |
137 CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element, | |
138 [TreatNullAs=NullString, TreatUndefinedAs=Nul
lString,Default=Undefined] optional DOMString pseudoElement); | |
139 | |
140 [Replaceable] readonly attribute double devicePixelRatio; | |
141 | |
142 WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional No
de node, | |
143 [Default=Undefined] optional We
bKitPoint p); | |
144 WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional No
de node, | |
145 [Default=Undefined] optional We
bKitPoint p); | |
146 | |
147 [EnabledAtRuntime, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds] re
adonly attribute DOMApplicationCache applicationCache; | |
148 | |
149 [EnabledAtRuntime, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds, Ge
tterRaisesException] readonly attribute Storage sessionStorage; | |
150 [EnabledAtRuntime, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds, Ge
tterRaisesException] readonly attribute Storage localStorage; | |
151 | |
152 #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS | |
153 // This is the interface orientation in degrees. Some examples are: | |
154 // 0 is straight up; -90 is when the device is rotated 90 clockwise; | |
155 // 90 is when rotated counter clockwise. | |
156 readonly attribute long orientation; | |
157 #endif | |
158 | |
159 [Replaceable] readonly attribute Console console; | |
160 | |
161 // cross-document messaging | |
162 [DoNotCheckSecurity, Custom, RaisesException] void postMessage(SerializedScr
iptValue message, DOMString targetOrigin, optional Array messagePorts); | |
163 | |
164 [Replaceable] readonly attribute Performance performance; | |
165 | |
166 // Timers | |
167 [Custom] long setTimeout(any handler, [Default=Undefined] optional long time
out); | |
168 void clearTimeout([Default=Undefined] optional long handle); | |
169 [Custom] long setInterval(any handler, [Default=Undefined] optional long tim
eout); | |
170 void clearInterval([Default=Undefined] optional long handle); | |
171 | |
172 [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(Reque
stAnimationFrameCallback callback); | |
173 void cancelAnimationFrame(long id); | |
174 [MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(R
equestAnimationFrameCallback callback); | |
175 [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id
); | |
176 [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(
long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove
this when removing vendor prefix. | |
177 | |
178 // Base64 | |
179 [RaisesException] DOMString atob([TreatNullAs=NullString,Default=Undefined]
optional DOMString string); | |
180 [RaisesException] DOMString btoa([TreatNullAs=NullString,Default=Undefined]
optional DOMString string); | |
181 | |
182 [Replaceable] readonly attribute CSS CSS; | |
183 | |
184 // Events | |
185 attribute EventListener onabort; | |
186 attribute EventListener onbeforeunload; | |
187 attribute EventListener onblur; | |
188 attribute EventListener oncanplay; | |
189 attribute EventListener oncanplaythrough; | |
190 attribute EventListener onchange; | |
191 attribute EventListener onclick; | |
192 attribute EventListener oncontextmenu; | |
193 attribute EventListener ondblclick; | |
194 attribute EventListener ondrag; | |
195 attribute EventListener ondragend; | |
196 attribute EventListener ondragenter; | |
197 attribute EventListener ondragleave; | |
198 attribute EventListener ondragover; | |
199 attribute EventListener ondragstart; | |
200 attribute EventListener ondrop; | |
201 attribute EventListener ondurationchange; | |
202 attribute EventListener onemptied; | |
203 attribute EventListener onended; | |
204 attribute EventListener onerror; | |
205 attribute EventListener onfocus; | |
206 attribute EventListener onhashchange; | |
207 attribute EventListener oninput; | |
208 attribute EventListener oninvalid; | |
209 attribute EventListener onkeydown; | |
210 attribute EventListener onkeypress; | |
211 attribute EventListener onkeyup; | |
212 attribute EventListener onload; | |
213 attribute EventListener onloadeddata; | |
214 attribute EventListener onloadedmetadata; | |
215 attribute EventListener onloadstart; | |
216 attribute EventListener onmessage; | |
217 attribute EventListener onmousedown; | |
218 attribute EventListener onmousemove; | |
219 attribute EventListener onmouseout; | |
220 attribute EventListener onmouseover; | |
221 attribute EventListener onmouseup; | |
222 attribute EventListener onmousewheel; | |
223 attribute EventListener onoffline; | |
224 attribute EventListener ononline; | |
225 attribute EventListener onpagehide; | |
226 attribute EventListener onpageshow; | |
227 attribute EventListener onpause; | |
228 attribute EventListener onplay; | |
229 attribute EventListener onplaying; | |
230 attribute EventListener onpopstate; | |
231 attribute EventListener onprogress; | |
232 attribute EventListener onratechange; | |
233 attribute EventListener onresize; | |
234 attribute EventListener onscroll; | |
235 attribute EventListener onseeked; | |
236 attribute EventListener onseeking; | |
237 attribute EventListener onselect; | |
238 attribute EventListener onstalled; | |
239 attribute EventListener onstorage; | |
240 attribute EventListener onsubmit; | |
241 attribute EventListener onsuspend; | |
242 attribute EventListener ontimeupdate; | |
243 attribute EventListener onunload; | |
244 attribute EventListener onvolumechange; | |
245 attribute EventListener onwaiting; | |
246 | |
247 // Not implemented yet. | |
248 // attribute EventListener onafterprint; | |
249 // attribute EventListener onbeforeprint; | |
250 // attribute EventListener onreadystatechange; | |
251 // attribute EventListener onredo; | |
252 // attribute EventListener onshow; | |
253 // attribute EventListener onundo; | |
254 | |
255 // Webkit extensions | |
256 attribute EventListener onreset; | |
257 attribute EventListener onsearch; | |
258 attribute EventListener onwebkitanimationend; | |
259 attribute EventListener onwebkitanimationiteration; | |
260 attribute EventListener onwebkitanimationstart; | |
261 attribute EventListener onwebkittransitionend; | |
262 attribute EventListener ontransitionend; | |
263 #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS | |
264 attribute EventListener onorientationchange; | |
265 #endif | |
266 [EnabledAtRuntime=touch] attribute EventListener ontouchstart; | |
267 [EnabledAtRuntime=touch] attribute EventListener ontouchmove; | |
268 [EnabledAtRuntime=touch] attribute EventListener ontouchend; | |
269 [EnabledAtRuntime=touch] attribute EventListener ontouchcancel; | |
270 | |
271 [EnabledAtRuntime=deviceMotion] attribute EventListener ondevicemotion; | |
272 [EnabledAtRuntime=deviceOrientation] attribute EventListener ondeviceorienta
tion; | |
273 | |
274 // EventTarget interface | |
275 [Custom] void addEventListener(DOMString type, | |
276 EventListener listener, | |
277 optional boolean useCapture); | |
278 [Custom] void removeEventListener(DOMString type, | |
279 EventListener listener, | |
280 optional boolean useCapture); | |
281 [RaisesException] boolean dispatchEvent(Event evt); | |
282 | |
283 // Additional constructors. | |
284 attribute TransitionEventConstructor WebKitTransitionEvent; | |
285 [CustomConstructor] attribute HTMLImageElementConstructorConstructor Image;
// Usable with new operator | |
286 // Mozilla has a separate XMLDocument object for XML documents. | |
287 // We just use Document for this. | |
288 attribute DocumentConstructor XMLDocument; | |
289 attribute URLConstructor webkitURL; // FIXME: deprecate this. | |
290 attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add
metrics to determine when we can remove this. | |
291 attribute IDBCursorConstructor webkitIDBCursor; | |
292 attribute IDBDatabaseConstructor webkitIDBDatabase; | |
293 attribute IDBFactoryConstructor webkitIDBFactory; | |
294 attribute IDBIndexConstructor webkitIDBIndex; | |
295 attribute IDBKeyRangeConstructor webkitIDBKeyRange; | |
296 attribute IDBObjectStoreConstructor webkitIDBObjectStore; | |
297 attribute IDBRequestConstructor webkitIDBRequest; | |
298 attribute IDBTransactionConstructor webkitIDBTransaction; | |
299 | |
300 // Constructors whose name does not match the interface name. | |
301 // FIXME: Remove these once [ImplementedAs] is used and once constructor nam
es match interface names. | |
302 [EnabledAtRuntime=mediaStream] attribute MediaStreamConstructor webkitMediaS
tream; | |
303 [Conditional=WEB_AUDIO, EnabledAtRuntime=WebAudio] attribute AudioContextCon
structor webkitAudioContext; | |
304 [Conditional=WEB_AUDIO, EnabledAtRuntime=WebAudio] attribute OfflineAudioCon
textConstructor webkitOfflineAudioContext; | |
305 [EnabledAtRuntime=peerConnection] attribute RTCPeerConnectionConstructor web
kitRTCPeerConnection; | |
306 [EnabledAtRuntime=scriptedSpeech] attribute SpeechGrammarConstructor webkitS
peechGrammar; | |
307 [EnabledAtRuntime=scriptedSpeech] attribute SpeechGrammarListConstructor web
kitSpeechGrammarList; | |
308 [EnabledAtRuntime=scriptedSpeech] attribute SpeechRecognitionConstructor web
kitSpeechRecognition; | |
309 [EnabledAtRuntime=scriptedSpeech] attribute SpeechRecognitionErrorConstructo
r webkitSpeechRecognitionError; | |
310 [EnabledAtRuntime=scriptedSpeech] attribute SpeechRecognitionEventConstructo
r webkitSpeechRecognitionEvent; | |
311 attribute ShadowRootConstructor WebKitShadowRoot; | |
312 [Conditional=WEB_AUDIO] attribute PannerNodeConstructor webkitAudioPannerNod
e; | |
313 | |
314 // window.toString() requires special handling in V8 | |
315 [DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString t
oString(); | |
316 | |
317 [ImplementedAs=anonymousIndexedGetter, NotEnumerable] getter Window(unsigned
long index); | |
318 [Custom, NotEnumerable] getter Window (DOMString name); | |
319 }; | |
320 | |
OLD | NEW |