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.

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

mercurial