dom/webidl/Window.webidl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 4 * You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 5 *
michael@0 6 * The origin of this IDL file is:
michael@0 7 * http://www.whatwg.org/specs/web-apps/current-work/
michael@0 8 * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
michael@0 9 * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
michael@0 10 * http://dev.w3.org/csswg/cssom/
michael@0 11 * http://dev.w3.org/csswg/cssom-view/
michael@0 12 * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
michael@0 13 * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
michael@0 14 * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
michael@0 15 * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
michael@0 16 */
michael@0 17
michael@0 18 interface ApplicationCache;
michael@0 19 interface IID;
michael@0 20 interface MozFrameRequestCallback;
michael@0 21 interface nsIBrowserDOMWindow;
michael@0 22 interface nsIMessageBroadcaster;
michael@0 23 interface nsIDOMCrypto;
michael@0 24 typedef any Transferable;
michael@0 25
michael@0 26 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 27 [Global, NeedNewResolve]
michael@0 28 /*sealed*/ interface Window : EventTarget {
michael@0 29 // the current browsing context
michael@0 30 [Unforgeable, Throws,
michael@0 31 CrossOriginReadable] readonly attribute WindowProxy window;
michael@0 32 [Replaceable, Throws,
michael@0 33 CrossOriginReadable] readonly attribute WindowProxy self;
michael@0 34 [Unforgeable, StoreInSlot, Pure, Func="nsGlobalWindow::WindowOnWebIDL"] readonly attribute Document? document;
michael@0 35 [Throws] attribute DOMString name;
michael@0 36 [PutForwards=href, Unforgeable, Throws,
michael@0 37 CrossOriginReadable, CrossOriginWritable] readonly attribute Location? location;
michael@0 38 [Throws] readonly attribute History history;
michael@0 39 [Replaceable, Throws] readonly attribute BarProp locationbar;
michael@0 40 [Replaceable, Throws] readonly attribute BarProp menubar;
michael@0 41 [Replaceable, Throws] readonly attribute BarProp personalbar;
michael@0 42 [Replaceable, Throws] readonly attribute BarProp scrollbars;
michael@0 43 [Replaceable, Throws] readonly attribute BarProp statusbar;
michael@0 44 [Replaceable, Throws] readonly attribute BarProp toolbar;
michael@0 45 [Throws] attribute DOMString status;
michael@0 46 [Throws, CrossOriginCallable] void close();
michael@0 47 [Throws, CrossOriginReadable] readonly attribute boolean closed;
michael@0 48 [Throws] void stop();
michael@0 49 [Throws, CrossOriginCallable] void focus();
michael@0 50 [Throws, CrossOriginCallable] void blur();
michael@0 51
michael@0 52 // other browsing contexts
michael@0 53 [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy frames;
michael@0 54 [Replaceable, CrossOriginReadable] readonly attribute unsigned long length;
michael@0 55 [Unforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy top;
michael@0 56 [Throws, CrossOriginReadable] attribute any opener;
michael@0 57 //[Throws] readonly attribute WindowProxy parent;
michael@0 58 [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy? parent;
michael@0 59 [Throws] readonly attribute Element? frameElement;
michael@0 60 //[Throws] WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
michael@0 61 [Throws] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", [TreatNullAs=EmptyString] optional DOMString features = "");
michael@0 62 // We think the indexed getter is a bug in the spec, it actually needs to live
michael@0 63 // on the WindowProxy
michael@0 64 //getter WindowProxy (unsigned long index);
michael@0 65 //getter object (DOMString name);
michael@0 66
michael@0 67 // the user agent
michael@0 68 [Throws] readonly attribute Navigator navigator;
michael@0 69 #ifdef HAVE_SIDEBAR
michael@0 70 [Replaceable, Throws] readonly attribute External external;
michael@0 71 #endif
michael@0 72 [Throws] readonly attribute ApplicationCache applicationCache;
michael@0 73
michael@0 74 // user prompts
michael@0 75 [Throws] void alert(optional DOMString message = "");
michael@0 76 [Throws] boolean confirm(optional DOMString message = "");
michael@0 77 [Throws] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
michael@0 78 [Throws] void print();
michael@0 79 //[Throws] any showModalDialog(DOMString url, optional any argument);
michael@0 80 [Throws] any showModalDialog(DOMString url, optional any argument, optional DOMString options = "");
michael@0 81
michael@0 82 [Throws, CrossOriginCallable] void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
michael@0 83
michael@0 84 // also has obsolete members
michael@0 85 };
michael@0 86 Window implements GlobalEventHandlers;
michael@0 87 Window implements WindowEventHandlers;
michael@0 88
michael@0 89 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 90 [NoInterfaceObject]
michael@0 91 interface WindowTimers {
michael@0 92 [Throws] long setTimeout(Function handler, optional long timeout = 0, any... arguments);
michael@0 93 [Throws] long setTimeout(DOMString handler, optional long timeout = 0, any... unused);
michael@0 94 [Throws] void clearTimeout(optional long handle = 0);
michael@0 95 [Throws] long setInterval(Function handler, optional long timeout, any... arguments);
michael@0 96 [Throws] long setInterval(DOMString handler, optional long timeout, any... unused);
michael@0 97 [Throws] void clearInterval(optional long handle = 0);
michael@0 98 };
michael@0 99 Window implements WindowTimers;
michael@0 100
michael@0 101 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 102 [NoInterfaceObject]
michael@0 103 interface WindowBase64 {
michael@0 104 [Throws] DOMString btoa(DOMString btoa);
michael@0 105 [Throws] DOMString atob(DOMString atob);
michael@0 106 };
michael@0 107 Window implements WindowBase64;
michael@0 108
michael@0 109 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 110 [NoInterfaceObject]
michael@0 111 interface WindowSessionStorage {
michael@0 112 //[Throws] readonly attribute Storage sessionStorage;
michael@0 113 [Throws] readonly attribute Storage? sessionStorage;
michael@0 114 };
michael@0 115 Window implements WindowSessionStorage;
michael@0 116
michael@0 117 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 118 [NoInterfaceObject]
michael@0 119 interface WindowLocalStorage {
michael@0 120 [Throws] readonly attribute Storage? localStorage;
michael@0 121 };
michael@0 122 Window implements WindowLocalStorage;
michael@0 123
michael@0 124 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 125 partial interface Window {
michael@0 126 void captureEvents();
michael@0 127 void releaseEvents();
michael@0 128 };
michael@0 129
michael@0 130 // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
michael@0 131 partial interface Window {
michael@0 132 //[Throws] Selection getSelection();
michael@0 133 [Throws] Selection? getSelection();
michael@0 134 };
michael@0 135
michael@0 136 // https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
michael@0 137 Window implements IDBEnvironment;
michael@0 138
michael@0 139 // http://dev.w3.org/csswg/cssom/
michael@0 140 partial interface Window {
michael@0 141 //[NewObject, Throws] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt = "");
michael@0 142 [NewObject, Throws] CSSStyleDeclaration? getComputedStyle(Element elt, optional DOMString pseudoElt = "");
michael@0 143 };
michael@0 144
michael@0 145 // http://dev.w3.org/csswg/cssom-view/
michael@0 146 enum ScrollBehavior { "auto", "instant", "smooth" };
michael@0 147
michael@0 148 dictionary ScrollOptions {
michael@0 149 ScrollBehavior behavior = "auto";
michael@0 150 };
michael@0 151
michael@0 152 partial interface Window {
michael@0 153 //[Throws,NewObject] MediaQueryList matchMedia(DOMString query);
michael@0 154 [Throws,NewObject] MediaQueryList? matchMedia(DOMString query);
michael@0 155 //[SameObject]
michael@0 156 [Throws] readonly attribute Screen screen;
michael@0 157
michael@0 158 // browsing context
michael@0 159 //[Throws] void moveTo(double x, double y);
michael@0 160 //[Throws] void moveBy(double x, double y);
michael@0 161 //[Throws] void resizeTo(double x, double y);
michael@0 162 //[Throws] void resizeBy(double x, double y);
michael@0 163 [Throws] void moveTo(long x, long y);
michael@0 164 [Throws] void moveBy(long x, long y);
michael@0 165 [Throws] void resizeTo(long x, long y);
michael@0 166 [Throws] void resizeBy(long x, long y);
michael@0 167
michael@0 168 // viewport
michael@0 169 //[Throws] readonly attribute double innerWidth;
michael@0 170 //[Throws] readonly attribute double innerHeight;
michael@0 171 [Throws] attribute long innerWidth;
michael@0 172 [Throws] attribute long innerHeight;
michael@0 173
michael@0 174 // viewport scrolling
michael@0 175 //[Throws] readonly attribute double scrollX;
michael@0 176 //[Throws] readonly attribute double pageXOffset;
michael@0 177 //[Throws] readonly attribute double scrollY;
michael@0 178 //[Throws] readonly attribute double pageYOffset;
michael@0 179 //void scroll(double x, double y, optional ScrollOptions options);
michael@0 180 //void scrollTo(double x, double y, optional ScrollOptions options);
michael@0 181 //void scrollBy(double x, double y, optional ScrollOptions options);
michael@0 182 [Replaceable, Throws] readonly attribute long scrollX;
michael@0 183 [Throws] readonly attribute long pageXOffset;
michael@0 184 [Replaceable, Throws] readonly attribute long scrollY;
michael@0 185 [Throws] readonly attribute long pageYOffset;
michael@0 186 void scroll(long x, long y);
michael@0 187 void scrollTo(long x, long y);
michael@0 188 void scrollBy(long x, long y);
michael@0 189
michael@0 190 // client
michael@0 191 //[Throws] readonly attribute double screenX;
michael@0 192 //[Throws] readonly attribute double screenY;
michael@0 193 //[Throws] readonly attribute double outerWidth;
michael@0 194 //[Throws] readonly attribute double outerHeight;
michael@0 195 [Throws] attribute long screenX;
michael@0 196 [Throws] attribute long screenY;
michael@0 197 [Throws] attribute long outerWidth;
michael@0 198 [Throws] attribute long outerHeight;
michael@0 199 };
michael@0 200
michael@0 201 // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
michael@0 202 partial interface Window {
michael@0 203 [Throws] long requestAnimationFrame(FrameRequestCallback callback);
michael@0 204 [Throws] void cancelAnimationFrame(long handle);
michael@0 205 };
michael@0 206 callback FrameRequestCallback = void (DOMHighResTimeStamp time);
michael@0 207
michael@0 208 // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
michael@0 209 partial interface Window {
michael@0 210 [Replaceable, Throws] readonly attribute Performance? performance;
michael@0 211 };
michael@0 212
michael@0 213 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
michael@0 214 partial interface Window {
michael@0 215 //[Throws] readonly attribute Crypto crypto;
michael@0 216 [Throws] readonly attribute nsIDOMCrypto crypto;
michael@0 217 };
michael@0 218
michael@0 219 #ifdef MOZ_WEBSPEECH
michael@0 220 // http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
michael@0 221 [NoInterfaceObject]
michael@0 222 interface SpeechSynthesisGetter {
michael@0 223 [Throws, Pref="media.webspeech.synth.enabled"] readonly attribute SpeechSynthesis speechSynthesis;
michael@0 224 };
michael@0 225
michael@0 226 Window implements SpeechSynthesisGetter;
michael@0 227 #endif
michael@0 228
michael@0 229 // http://www.whatwg.org/specs/web-apps/current-work/
michael@0 230 [NoInterfaceObject]
michael@0 231 interface WindowModal {
michael@0 232 [Throws, Func="nsGlobalWindow::IsModalContentWindow"] readonly attribute any dialogArguments;
michael@0 233 [Throws, Func="nsGlobalWindow::IsModalContentWindow"] attribute any returnValue;
michael@0 234 };
michael@0 235 Window implements WindowModal;
michael@0 236
michael@0 237 // Mozilla-specific stuff
michael@0 238 partial interface Window {
michael@0 239 //[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
michael@0 240 [NewObject, Throws] CSSStyleDeclaration? getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
michael@0 241
michael@0 242 [Throws] long mozRequestAnimationFrame(MozFrameRequestCallback aCallback);
michael@0 243
michael@0 244 /**
michael@0 245 * Cancel a refresh callback.
michael@0 246 */
michael@0 247 [Throws] void mozCancelAnimationFrame(long aHandle);
michael@0 248 // Backwards-compat shim for now to make Google maps work
michael@0 249 [Throws] void mozCancelRequestAnimationFrame(long aHandle);
michael@0 250
michael@0 251 /**
michael@0 252 * The current animation start time in milliseconds since the epoch.
michael@0 253 */
michael@0 254 [Throws] readonly attribute long long mozAnimationStartTime;
michael@0 255
michael@0 256 // Mozilla extensions
michael@0 257 /**
michael@0 258 * Method for scrolling this window by a number of lines.
michael@0 259 */
michael@0 260 void scrollByLines(long numLines);
michael@0 261
michael@0 262 /**
michael@0 263 * Method for scrolling this window by a number of pages.
michael@0 264 */
michael@0 265 void scrollByPages(long numPages);
michael@0 266
michael@0 267 /**
michael@0 268 * Method for sizing this window to the content in the window.
michael@0 269 */
michael@0 270 [Throws] void sizeToContent();
michael@0 271
michael@0 272 // XXX Shouldn't this be in nsIDOMChromeWindow?
michael@0 273 [ChromeOnly, Replaceable, Throws] readonly attribute MozControllers controllers;
michael@0 274
michael@0 275 [Throws] readonly attribute float mozInnerScreenX;
michael@0 276 [Throws] readonly attribute float mozInnerScreenY;
michael@0 277 [Throws] readonly attribute float devicePixelRatio;
michael@0 278
michael@0 279 /* The maximum offset that the window can be scrolled to
michael@0 280 (i.e., the document width/height minus the scrollport width/height) */
michael@0 281 [Replaceable, Throws] readonly attribute long scrollMaxX;
michael@0 282 [Replaceable, Throws] readonly attribute long scrollMaxY;
michael@0 283
michael@0 284 [Throws] attribute boolean fullScreen;
michael@0 285
michael@0 286 [Throws, ChromeOnly] void back();
michael@0 287 [Throws, ChromeOnly] void forward();
michael@0 288 [Throws, ChromeOnly] void home();
michael@0 289
michael@0 290 // XXX Should this be in nsIDOMChromeWindow?
michael@0 291 void updateCommands(DOMString action);
michael@0 292
michael@0 293 /* Find in page.
michael@0 294 * @param str: the search pattern
michael@0 295 * @param caseSensitive: is the search caseSensitive
michael@0 296 * @param backwards: should we search backwards
michael@0 297 * @param wrapAround: should we wrap the search
michael@0 298 * @param wholeWord: should we search only for whole words
michael@0 299 * @param searchInFrames: should we search through all frames
michael@0 300 * @param showDialog: should we show the Find dialog
michael@0 301 */
michael@0 302 [Throws] boolean find(optional DOMString str = "",
michael@0 303 optional boolean caseSensitive = false,
michael@0 304 optional boolean backwards = false,
michael@0 305 optional boolean wrapAround = false,
michael@0 306 optional boolean wholeWord = false,
michael@0 307 optional boolean searchInFrames = false,
michael@0 308 optional boolean showDialog = false);
michael@0 309
michael@0 310 /**
michael@0 311 * Returns the number of times this document for this window has
michael@0 312 * been painted to the screen.
michael@0 313 */
michael@0 314 [Throws] readonly attribute unsigned long long mozPaintCount;
michael@0 315
michael@0 316 [Pure]
michael@0 317 attribute EventHandler onwheel;
michael@0 318
michael@0 319 attribute EventHandler ondevicemotion;
michael@0 320 attribute EventHandler ondeviceorientation;
michael@0 321 attribute EventHandler ondeviceproximity;
michael@0 322 attribute EventHandler onuserproximity;
michael@0 323 attribute EventHandler ondevicelight;
michael@0 324
michael@0 325 #ifdef MOZ_B2G
michael@0 326 attribute EventHandler onmoztimechange;
michael@0 327 attribute EventHandler onmoznetworkupload;
michael@0 328 attribute EventHandler onmoznetworkdownload;
michael@0 329 #endif
michael@0 330
michael@0 331 void dump(DOMString str);
michael@0 332
michael@0 333 /**
michael@0 334 * This method is here for backwards compatibility with 4.x only,
michael@0 335 * its implementation is a no-op
michael@0 336 */
michael@0 337 void setResizable(boolean resizable);
michael@0 338
michael@0 339 /**
michael@0 340 * This is the scriptable version of
michael@0 341 * nsIDOMWindow::openDialog() that takes 3 optional
michael@0 342 * arguments, plus any additional arguments are passed on as
michael@0 343 * arguments on the dialog's window object (window.arguments).
michael@0 344 */
michael@0 345 [Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "",
michael@0 346 optional DOMString name = "",
michael@0 347 optional DOMString options = "",
michael@0 348 any... extraArguments);
michael@0 349
michael@0 350 [Replaceable, Throws] readonly attribute object? content;
michael@0 351
michael@0 352 [ChromeOnly, Throws] readonly attribute object? __content;
michael@0 353
michael@0 354 [Throws, ChromeOnly] any getInterface(IID iid);
michael@0 355 };
michael@0 356
michael@0 357 Window implements TouchEventHandlers;
michael@0 358
michael@0 359 Window implements OnErrorEventHandlerForWindow;
michael@0 360
michael@0 361 // ConsoleAPI
michael@0 362 partial interface Window {
michael@0 363 [Replaceable, GetterThrows]
michael@0 364 readonly attribute Console console;
michael@0 365 };
michael@0 366
michael@0 367 #ifdef HAVE_SIDEBAR
michael@0 368 // Mozilla extension
michael@0 369 partial interface Window {
michael@0 370 [Replaceable, Throws]
michael@0 371 readonly attribute (External or WindowProxy) sidebar;
michael@0 372 };
michael@0 373 #endif
michael@0 374
michael@0 375 [Func="IsChromeOrXBL"]
michael@0 376 interface ChromeWindow {
michael@0 377 [Func="nsGlobalWindow::IsChromeWindow"]
michael@0 378 const unsigned short STATE_MAXIMIZED = 1;
michael@0 379 [Func="nsGlobalWindow::IsChromeWindow"]
michael@0 380 const unsigned short STATE_MINIMIZED = 2;
michael@0 381 [Func="nsGlobalWindow::IsChromeWindow"]
michael@0 382 const unsigned short STATE_NORMAL = 3;
michael@0 383 [Func="nsGlobalWindow::IsChromeWindow"]
michael@0 384 const unsigned short STATE_FULLSCREEN = 4;
michael@0 385
michael@0 386 [Func="nsGlobalWindow::IsChromeWindow"]
michael@0 387 readonly attribute unsigned short windowState;
michael@0 388
michael@0 389 /**
michael@0 390 * browserDOMWindow provides access to yet another layer of
michael@0 391 * utility functions implemented by chrome script. It will be null
michael@0 392 * for DOMWindows not corresponding to browsers.
michael@0 393 */
michael@0 394 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 395 attribute nsIBrowserDOMWindow? browserDOMWindow;
michael@0 396
michael@0 397 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 398 void getAttention();
michael@0 399
michael@0 400 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 401 void getAttentionWithCycleCount(long aCycleCount);
michael@0 402
michael@0 403 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 404 void setCursor(DOMString cursor);
michael@0 405
michael@0 406 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 407 void maximize();
michael@0 408 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 409 void minimize();
michael@0 410 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 411 void restore();
michael@0 412
michael@0 413 /**
michael@0 414 * Notify a default button is loaded on a dialog or a wizard.
michael@0 415 * defaultButton is the default button.
michael@0 416 */
michael@0 417 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 418 void notifyDefaultButtonLoaded(Element defaultButton);
michael@0 419
michael@0 420 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 421 readonly attribute nsIMessageBroadcaster messageManager;
michael@0 422
michael@0 423 /**
michael@0 424 * On some operating systems, we must allow the window manager to
michael@0 425 * handle window dragging. This function tells the window manager to
michael@0 426 * start dragging the window. This function will fail unless called
michael@0 427 * while the left mouse button is held down, callers must check this.
michael@0 428 *
michael@0 429 * The optional panel argument should be set when moving a panel.
michael@0 430 *
michael@0 431 * Throws NS_ERROR_NOT_IMPLEMENTED if the OS doesn't support this.
michael@0 432 */
michael@0 433 [Throws, Func="nsGlobalWindow::IsChromeWindow"]
michael@0 434 void beginWindowMove(Event mouseDownEvent, optional Element? panel = null);
michael@0 435 };
michael@0 436
michael@0 437 Window implements ChromeWindow;

mercurial