michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is: michael@0: * http://www.whatwg.org/specs/web-apps/current-work/ michael@0: * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html michael@0: * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html michael@0: * http://dev.w3.org/csswg/cssom/ michael@0: * http://dev.w3.org/csswg/cssom-view/ michael@0: * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html michael@0: * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html michael@0: * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html michael@0: * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html michael@0: */ michael@0: michael@0: interface ApplicationCache; michael@0: interface IID; michael@0: interface MozFrameRequestCallback; michael@0: interface nsIBrowserDOMWindow; michael@0: interface nsIMessageBroadcaster; michael@0: interface nsIDOMCrypto; michael@0: typedef any Transferable; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: [Global, NeedNewResolve] michael@0: /*sealed*/ interface Window : EventTarget { michael@0: // the current browsing context michael@0: [Unforgeable, Throws, michael@0: CrossOriginReadable] readonly attribute WindowProxy window; michael@0: [Replaceable, Throws, michael@0: CrossOriginReadable] readonly attribute WindowProxy self; michael@0: [Unforgeable, StoreInSlot, Pure, Func="nsGlobalWindow::WindowOnWebIDL"] readonly attribute Document? document; michael@0: [Throws] attribute DOMString name; michael@0: [PutForwards=href, Unforgeable, Throws, michael@0: CrossOriginReadable, CrossOriginWritable] readonly attribute Location? location; michael@0: [Throws] readonly attribute History history; michael@0: [Replaceable, Throws] readonly attribute BarProp locationbar; michael@0: [Replaceable, Throws] readonly attribute BarProp menubar; michael@0: [Replaceable, Throws] readonly attribute BarProp personalbar; michael@0: [Replaceable, Throws] readonly attribute BarProp scrollbars; michael@0: [Replaceable, Throws] readonly attribute BarProp statusbar; michael@0: [Replaceable, Throws] readonly attribute BarProp toolbar; michael@0: [Throws] attribute DOMString status; michael@0: [Throws, CrossOriginCallable] void close(); michael@0: [Throws, CrossOriginReadable] readonly attribute boolean closed; michael@0: [Throws] void stop(); michael@0: [Throws, CrossOriginCallable] void focus(); michael@0: [Throws, CrossOriginCallable] void blur(); michael@0: michael@0: // other browsing contexts michael@0: [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy frames; michael@0: [Replaceable, CrossOriginReadable] readonly attribute unsigned long length; michael@0: [Unforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy top; michael@0: [Throws, CrossOriginReadable] attribute any opener; michael@0: //[Throws] readonly attribute WindowProxy parent; michael@0: [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy? parent; michael@0: [Throws] readonly attribute Element? frameElement; michael@0: //[Throws] WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false); michael@0: [Throws] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", [TreatNullAs=EmptyString] optional DOMString features = ""); michael@0: // We think the indexed getter is a bug in the spec, it actually needs to live michael@0: // on the WindowProxy michael@0: //getter WindowProxy (unsigned long index); michael@0: //getter object (DOMString name); michael@0: michael@0: // the user agent michael@0: [Throws] readonly attribute Navigator navigator; michael@0: #ifdef HAVE_SIDEBAR michael@0: [Replaceable, Throws] readonly attribute External external; michael@0: #endif michael@0: [Throws] readonly attribute ApplicationCache applicationCache; michael@0: michael@0: // user prompts michael@0: [Throws] void alert(optional DOMString message = ""); michael@0: [Throws] boolean confirm(optional DOMString message = ""); michael@0: [Throws] DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); michael@0: [Throws] void print(); michael@0: //[Throws] any showModalDialog(DOMString url, optional any argument); michael@0: [Throws] any showModalDialog(DOMString url, optional any argument, optional DOMString options = ""); michael@0: michael@0: [Throws, CrossOriginCallable] void postMessage(any message, DOMString targetOrigin, optional sequence transfer); michael@0: michael@0: // also has obsolete members michael@0: }; michael@0: Window implements GlobalEventHandlers; michael@0: Window implements WindowEventHandlers; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: [NoInterfaceObject] michael@0: interface WindowTimers { michael@0: [Throws] long setTimeout(Function handler, optional long timeout = 0, any... arguments); michael@0: [Throws] long setTimeout(DOMString handler, optional long timeout = 0, any... unused); michael@0: [Throws] void clearTimeout(optional long handle = 0); michael@0: [Throws] long setInterval(Function handler, optional long timeout, any... arguments); michael@0: [Throws] long setInterval(DOMString handler, optional long timeout, any... unused); michael@0: [Throws] void clearInterval(optional long handle = 0); michael@0: }; michael@0: Window implements WindowTimers; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: [NoInterfaceObject] michael@0: interface WindowBase64 { michael@0: [Throws] DOMString btoa(DOMString btoa); michael@0: [Throws] DOMString atob(DOMString atob); michael@0: }; michael@0: Window implements WindowBase64; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: [NoInterfaceObject] michael@0: interface WindowSessionStorage { michael@0: //[Throws] readonly attribute Storage sessionStorage; michael@0: [Throws] readonly attribute Storage? sessionStorage; michael@0: }; michael@0: Window implements WindowSessionStorage; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: [NoInterfaceObject] michael@0: interface WindowLocalStorage { michael@0: [Throws] readonly attribute Storage? localStorage; michael@0: }; michael@0: Window implements WindowLocalStorage; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: partial interface Window { michael@0: void captureEvents(); michael@0: void releaseEvents(); michael@0: }; michael@0: michael@0: // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html michael@0: partial interface Window { michael@0: //[Throws] Selection getSelection(); michael@0: [Throws] Selection? getSelection(); michael@0: }; michael@0: michael@0: // https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html michael@0: Window implements IDBEnvironment; michael@0: michael@0: // http://dev.w3.org/csswg/cssom/ michael@0: partial interface Window { michael@0: //[NewObject, Throws] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt = ""); michael@0: [NewObject, Throws] CSSStyleDeclaration? getComputedStyle(Element elt, optional DOMString pseudoElt = ""); michael@0: }; michael@0: michael@0: // http://dev.w3.org/csswg/cssom-view/ michael@0: enum ScrollBehavior { "auto", "instant", "smooth" }; michael@0: michael@0: dictionary ScrollOptions { michael@0: ScrollBehavior behavior = "auto"; michael@0: }; michael@0: michael@0: partial interface Window { michael@0: //[Throws,NewObject] MediaQueryList matchMedia(DOMString query); michael@0: [Throws,NewObject] MediaQueryList? matchMedia(DOMString query); michael@0: //[SameObject] michael@0: [Throws] readonly attribute Screen screen; michael@0: michael@0: // browsing context michael@0: //[Throws] void moveTo(double x, double y); michael@0: //[Throws] void moveBy(double x, double y); michael@0: //[Throws] void resizeTo(double x, double y); michael@0: //[Throws] void resizeBy(double x, double y); michael@0: [Throws] void moveTo(long x, long y); michael@0: [Throws] void moveBy(long x, long y); michael@0: [Throws] void resizeTo(long x, long y); michael@0: [Throws] void resizeBy(long x, long y); michael@0: michael@0: // viewport michael@0: //[Throws] readonly attribute double innerWidth; michael@0: //[Throws] readonly attribute double innerHeight; michael@0: [Throws] attribute long innerWidth; michael@0: [Throws] attribute long innerHeight; michael@0: michael@0: // viewport scrolling michael@0: //[Throws] readonly attribute double scrollX; michael@0: //[Throws] readonly attribute double pageXOffset; michael@0: //[Throws] readonly attribute double scrollY; michael@0: //[Throws] readonly attribute double pageYOffset; michael@0: //void scroll(double x, double y, optional ScrollOptions options); michael@0: //void scrollTo(double x, double y, optional ScrollOptions options); michael@0: //void scrollBy(double x, double y, optional ScrollOptions options); michael@0: [Replaceable, Throws] readonly attribute long scrollX; michael@0: [Throws] readonly attribute long pageXOffset; michael@0: [Replaceable, Throws] readonly attribute long scrollY; michael@0: [Throws] readonly attribute long pageYOffset; michael@0: void scroll(long x, long y); michael@0: void scrollTo(long x, long y); michael@0: void scrollBy(long x, long y); michael@0: michael@0: // client michael@0: //[Throws] readonly attribute double screenX; michael@0: //[Throws] readonly attribute double screenY; michael@0: //[Throws] readonly attribute double outerWidth; michael@0: //[Throws] readonly attribute double outerHeight; michael@0: [Throws] attribute long screenX; michael@0: [Throws] attribute long screenY; michael@0: [Throws] attribute long outerWidth; michael@0: [Throws] attribute long outerHeight; michael@0: }; michael@0: michael@0: // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html michael@0: partial interface Window { michael@0: [Throws] long requestAnimationFrame(FrameRequestCallback callback); michael@0: [Throws] void cancelAnimationFrame(long handle); michael@0: }; michael@0: callback FrameRequestCallback = void (DOMHighResTimeStamp time); michael@0: michael@0: // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html michael@0: partial interface Window { michael@0: [Replaceable, Throws] readonly attribute Performance? performance; michael@0: }; michael@0: michael@0: // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html michael@0: partial interface Window { michael@0: //[Throws] readonly attribute Crypto crypto; michael@0: [Throws] readonly attribute nsIDOMCrypto crypto; michael@0: }; michael@0: michael@0: #ifdef MOZ_WEBSPEECH michael@0: // http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html michael@0: [NoInterfaceObject] michael@0: interface SpeechSynthesisGetter { michael@0: [Throws, Pref="media.webspeech.synth.enabled"] readonly attribute SpeechSynthesis speechSynthesis; michael@0: }; michael@0: michael@0: Window implements SpeechSynthesisGetter; michael@0: #endif michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/ michael@0: [NoInterfaceObject] michael@0: interface WindowModal { michael@0: [Throws, Func="nsGlobalWindow::IsModalContentWindow"] readonly attribute any dialogArguments; michael@0: [Throws, Func="nsGlobalWindow::IsModalContentWindow"] attribute any returnValue; michael@0: }; michael@0: Window implements WindowModal; michael@0: michael@0: // Mozilla-specific stuff michael@0: partial interface Window { michael@0: //[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = ""); michael@0: [NewObject, Throws] CSSStyleDeclaration? getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = ""); michael@0: michael@0: [Throws] long mozRequestAnimationFrame(MozFrameRequestCallback aCallback); michael@0: michael@0: /** michael@0: * Cancel a refresh callback. michael@0: */ michael@0: [Throws] void mozCancelAnimationFrame(long aHandle); michael@0: // Backwards-compat shim for now to make Google maps work michael@0: [Throws] void mozCancelRequestAnimationFrame(long aHandle); michael@0: michael@0: /** michael@0: * The current animation start time in milliseconds since the epoch. michael@0: */ michael@0: [Throws] readonly attribute long long mozAnimationStartTime; michael@0: michael@0: // Mozilla extensions michael@0: /** michael@0: * Method for scrolling this window by a number of lines. michael@0: */ michael@0: void scrollByLines(long numLines); michael@0: michael@0: /** michael@0: * Method for scrolling this window by a number of pages. michael@0: */ michael@0: void scrollByPages(long numPages); michael@0: michael@0: /** michael@0: * Method for sizing this window to the content in the window. michael@0: */ michael@0: [Throws] void sizeToContent(); michael@0: michael@0: // XXX Shouldn't this be in nsIDOMChromeWindow? michael@0: [ChromeOnly, Replaceable, Throws] readonly attribute MozControllers controllers; michael@0: michael@0: [Throws] readonly attribute float mozInnerScreenX; michael@0: [Throws] readonly attribute float mozInnerScreenY; michael@0: [Throws] readonly attribute float devicePixelRatio; michael@0: michael@0: /* The maximum offset that the window can be scrolled to michael@0: (i.e., the document width/height minus the scrollport width/height) */ michael@0: [Replaceable, Throws] readonly attribute long scrollMaxX; michael@0: [Replaceable, Throws] readonly attribute long scrollMaxY; michael@0: michael@0: [Throws] attribute boolean fullScreen; michael@0: michael@0: [Throws, ChromeOnly] void back(); michael@0: [Throws, ChromeOnly] void forward(); michael@0: [Throws, ChromeOnly] void home(); michael@0: michael@0: // XXX Should this be in nsIDOMChromeWindow? michael@0: void updateCommands(DOMString action); michael@0: michael@0: /* Find in page. michael@0: * @param str: the search pattern michael@0: * @param caseSensitive: is the search caseSensitive michael@0: * @param backwards: should we search backwards michael@0: * @param wrapAround: should we wrap the search michael@0: * @param wholeWord: should we search only for whole words michael@0: * @param searchInFrames: should we search through all frames michael@0: * @param showDialog: should we show the Find dialog michael@0: */ michael@0: [Throws] boolean find(optional DOMString str = "", michael@0: optional boolean caseSensitive = false, michael@0: optional boolean backwards = false, michael@0: optional boolean wrapAround = false, michael@0: optional boolean wholeWord = false, michael@0: optional boolean searchInFrames = false, michael@0: optional boolean showDialog = false); michael@0: michael@0: /** michael@0: * Returns the number of times this document for this window has michael@0: * been painted to the screen. michael@0: */ michael@0: [Throws] readonly attribute unsigned long long mozPaintCount; michael@0: michael@0: [Pure] michael@0: attribute EventHandler onwheel; michael@0: michael@0: attribute EventHandler ondevicemotion; michael@0: attribute EventHandler ondeviceorientation; michael@0: attribute EventHandler ondeviceproximity; michael@0: attribute EventHandler onuserproximity; michael@0: attribute EventHandler ondevicelight; michael@0: michael@0: #ifdef MOZ_B2G michael@0: attribute EventHandler onmoztimechange; michael@0: attribute EventHandler onmoznetworkupload; michael@0: attribute EventHandler onmoznetworkdownload; michael@0: #endif michael@0: michael@0: void dump(DOMString str); michael@0: michael@0: /** michael@0: * This method is here for backwards compatibility with 4.x only, michael@0: * its implementation is a no-op michael@0: */ michael@0: void setResizable(boolean resizable); michael@0: michael@0: /** michael@0: * This is the scriptable version of michael@0: * nsIDOMWindow::openDialog() that takes 3 optional michael@0: * arguments, plus any additional arguments are passed on as michael@0: * arguments on the dialog's window object (window.arguments). michael@0: */ michael@0: [Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "", michael@0: optional DOMString name = "", michael@0: optional DOMString options = "", michael@0: any... extraArguments); michael@0: michael@0: [Replaceable, Throws] readonly attribute object? content; michael@0: michael@0: [ChromeOnly, Throws] readonly attribute object? __content; michael@0: michael@0: [Throws, ChromeOnly] any getInterface(IID iid); michael@0: }; michael@0: michael@0: Window implements TouchEventHandlers; michael@0: michael@0: Window implements OnErrorEventHandlerForWindow; michael@0: michael@0: // ConsoleAPI michael@0: partial interface Window { michael@0: [Replaceable, GetterThrows] michael@0: readonly attribute Console console; michael@0: }; michael@0: michael@0: #ifdef HAVE_SIDEBAR michael@0: // Mozilla extension michael@0: partial interface Window { michael@0: [Replaceable, Throws] michael@0: readonly attribute (External or WindowProxy) sidebar; michael@0: }; michael@0: #endif michael@0: michael@0: [Func="IsChromeOrXBL"] michael@0: interface ChromeWindow { michael@0: [Func="nsGlobalWindow::IsChromeWindow"] michael@0: const unsigned short STATE_MAXIMIZED = 1; michael@0: [Func="nsGlobalWindow::IsChromeWindow"] michael@0: const unsigned short STATE_MINIMIZED = 2; michael@0: [Func="nsGlobalWindow::IsChromeWindow"] michael@0: const unsigned short STATE_NORMAL = 3; michael@0: [Func="nsGlobalWindow::IsChromeWindow"] michael@0: const unsigned short STATE_FULLSCREEN = 4; michael@0: michael@0: [Func="nsGlobalWindow::IsChromeWindow"] michael@0: readonly attribute unsigned short windowState; michael@0: michael@0: /** michael@0: * browserDOMWindow provides access to yet another layer of michael@0: * utility functions implemented by chrome script. It will be null michael@0: * for DOMWindows not corresponding to browsers. michael@0: */ michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: attribute nsIBrowserDOMWindow? browserDOMWindow; michael@0: michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void getAttention(); michael@0: michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void getAttentionWithCycleCount(long aCycleCount); michael@0: michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void setCursor(DOMString cursor); michael@0: michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void maximize(); michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void minimize(); michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void restore(); michael@0: michael@0: /** michael@0: * Notify a default button is loaded on a dialog or a wizard. michael@0: * defaultButton is the default button. michael@0: */ michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void notifyDefaultButtonLoaded(Element defaultButton); michael@0: michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: readonly attribute nsIMessageBroadcaster messageManager; michael@0: michael@0: /** michael@0: * On some operating systems, we must allow the window manager to michael@0: * handle window dragging. This function tells the window manager to michael@0: * start dragging the window. This function will fail unless called michael@0: * while the left mouse button is held down, callers must check this. michael@0: * michael@0: * The optional panel argument should be set when moving a panel. michael@0: * michael@0: * Throws NS_ERROR_NOT_IMPLEMENTED if the OS doesn't support this. michael@0: */ michael@0: [Throws, Func="nsGlobalWindow::IsChromeWindow"] michael@0: void beginWindowMove(Event mouseDownEvent, optional Element? panel = null); michael@0: }; michael@0: michael@0: Window implements ChromeWindow;