com.gargoylesoftware.htmlunit.javascript.host
Class Window

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Window
All Implemented Interfaces:
ScriptableWithFallbackGetter, Serializable, Cloneable, Map, net.sourceforge.htmlunit.corejs.javascript.Callable, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Function, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class Window
extends SimpleScriptable
implements ScriptableWithFallbackGetter, net.sourceforge.htmlunit.corejs.javascript.Function

A JavaScript object for a Window.

Version:
$Revision: 5864 $
Author:
Mike Bowler, Chen Jun, David K. Taylor, Christian Sell, Darrell DeBoer, Marc Guillemot, Dierk Koenig, Daniel Gredler, David D. Kilzer, Chris Erskine, Ahmed Ashour
See Also:
MSDN documentation, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static int WINDOW_HEIGHT
          HtmlUnit's "window" height, in pixels.
static int WINDOW_WIDTH
          HtmlUnit's "window" width, in pixels.
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
Window()
          Creates an instance.
 
Method Summary
 Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
          
 net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, Object[] args)
          
 Object custom_eval(String scriptCode)
          Executes the specified script code in the scope of this window.
 Object get(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
          
 Object get(String name, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
          Gets a named property from the object.
 Event getCurrentEvent()
          Returns the current event (used internally regardless of the emulation mode).
 HTMLDocument getDocument()
          Returns the window's current document.
 EventListenersContainer getEventListenersContainer()
          Gets the container for event listeners.
 net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(Class<? extends SimpleScriptable> jsClass)
          Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope.
static WindowProxy getProxy(WebWindow w)
          Returns the proxy for the specified window.
 Selection getSelection()
          Returns the current selection.
 WebWindow getWebWindow()
          Returns the WebWindow associated with this Window.
 Object getWithFallback(String name)
          Fallback called when no configured property is found with the given name on the Scriptable object.
 void initialize()
          Initializes the object.
 void initialize(Page enclosedPage)
          Initialize the object.
 void initialize(WebWindow webWindow)
          Initializes this window.
 void jsxFunction_addEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener, boolean useCapture)
          Allows the registration of event listeners on the event target.
 void jsxFunction_alert(Object message)
          The JavaScript function "alert()".
 String jsxFunction_atob(String encodedData)
          Decodes a string of data which has been encoded using base-64 encoding..
 boolean jsxFunction_attachEvent(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener)
          Allows the registration of event listeners on the event target.
 void jsxFunction_blur()
          Removes focus from this element.
 String jsxFunction_btoa(String stringToEncode)
          Creates a base-64 encoded ASCII string from a string of binary data.
 void jsxFunction_captureEvents(String type)
          Does nothing special anymore...
 void jsxFunction_clearInterval(int intervalID)
          Cancels the interval previously started using the setInterval method.
 void jsxFunction_clearTimeout(int timeoutId)
          Cancels a time-out previously set with the setTimeout method.
 void jsxFunction_close()
          Closes this window.
 void jsxFunction_CollectGarbage()
          An undocumented IE function.
 boolean jsxFunction_confirm(String message)
          The JavaScript function "confirm()".
 Popup jsxFunction_createPopup()
          Creates a popup window.
 void jsxFunction_detachEvent(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener)
          Allows the removal of event listeners on the event target.
 void jsxFunction_execScript(String script, Object language)
          Executes the specified script code as long as the language is JavaScript or JScript.
 void jsxFunction_focus()
          Sets the focus to this element.
 ComputedCSSStyleDeclaration jsxFunction_getComputedStyle(HTMLElement element, String pseudo)
          Returns computed style of the element.
 Selection jsxFunction_getSelection()
          Returns the current selection.
 void jsxFunction_moveBy(int x, int y)
          Does nothing.
 void jsxFunction_moveTo(int x, int y)
          Does nothing.
 WindowProxy jsxFunction_open(Object url, Object name, Object features, Object replace)
          Opens a new window.
 void jsxFunction_print()
          Prints the current page.
 String jsxFunction_prompt(String message)
          The JavaScript function "prompt()".
 void jsxFunction_removeEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener, boolean useCapture)
          Allows the removal of event listeners on the event target.
 void jsxFunction_resizeBy(int width, int height)
          Does nothing.
 void jsxFunction_resizeTo(int width, int height)
          Does nothing.
 String jsxFunction_ScriptEngine()
          Gets the name of the scripting engine.
 int jsxFunction_ScriptEngineBuildVersion()
          Gets the build version of the scripting engine.
 int jsxFunction_ScriptEngineMajorVersion()
          Gets the major version of the scripting engine.
 int jsxFunction_ScriptEngineMinorVersion()
          Gets the minor version of the scripting engine.
 void jsxFunction_scroll(int x, int y)
          Scrolls to the specified location on the page.
 void jsxFunction_scrollBy(int x, int y)
          Scrolls the window content the specified distance.
 void jsxFunction_scrollByLines(int lines)
          Scrolls the window content down by the specified number of lines.
 void jsxFunction_scrollByPages(int pages)
          Scrolls the window content down by the specified number of pages.
 void jsxFunction_scrollTo(int x, int y)
          Scrolls to the specified location on the page.
 int jsxFunction_setInterval(Object code, int timeout, Object language)
          Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed.
 int jsxFunction_setTimeout(Object code, int timeout, Object language)
          Sets a chunk of JavaScript to be invoked at some specified time later.
 Object jsxFunction_showModalDialog(String url, Object arguments, String features)
          Creates a modal dialog box that displays the specified HTML document.
 Object jsxFunction_showModelessDialog(String url, Object arguments, String features)
          Creates a modeless dialog box that displays the specified HTML document.
 void jsxFunction_stop()
          Should implement the stop() function on the window object.
 OfflineResourceList jsxGet_applicationCache()
          Returns the application cache.
 Navigator jsxGet_clientInformation()
          Returns the JavaScript property "clientInformation".
 ClipboardData jsxGet_clipboardData()
          Returns the JavaScript property "clipboardData".
 boolean jsxGet_closed()
          Indicates if this window is closed.
 Object jsxGet_controllers()
          Gets the controllers.
 HTMLDocumentProxy jsxGet_document()
          Returns the JavaScript property "document".
 Object jsxGet_event()
          Returns the current event (used by JavaScript only when emulating IE).
 External jsxGet_external()
          Returns the "external" property.
 Object jsxGet_frameElement()
          Returns the (i)frame in which the window is contained.
 WindowProxy jsxGet_frames()
          Returns the value of the frames property.
 StorageList jsxGet_globalStorage()
          Returns the globalStorage property.
 History jsxGet_history()
          Returns the "history" property.
 int jsxGet_innerHeight()
          Returns the innerHeight.
 int jsxGet_innerWidth()
          Returns the innerWidth.
 int jsxGet_length()
          Returns the number of frames contained by this window.
 Storage jsxGet_localStorage()
          Returns the localStorage property.
 Location jsxGet_location()
          Returns the location property.
 String jsxGet_name()
          Returns the value of the window's name property.
 Navigator jsxGet_navigator()
          Returns the JavaScript property "navigator".
 Object jsxGet_onbeforeunload()
          Returns the value of the window's onbeforeunload property.
 Object jsxGet_onclick()
          Returns the onclick property (caution this is not necessary a function if something else has been set).
 Object jsxGet_ondblclick()
          Returns the ondblclick property (caution this is not necessary a function if something else has been set).
 Object jsxGet_onerror()
          Returns the value of the window's onerror property.
 Object jsxGet_onload()
          Returns the onload property.
 Object jsxGet_opener()
          Returns the value of the opener property.
 int jsxGet_outerHeight()
          Returns the outer height.
 int jsxGet_outerWidth()
          Returns the outerWidth.
 int jsxGet_pageXOffset()
          Returns the value of "pageXOffset" property.
 int jsxGet_pageYOffset()
          Returns the value of "pageYOffset" property.
 WindowProxy jsxGet_parent()
          Returns the value of the parent property.
 Screen jsxGet_screen()
          Returns the "screen" property.
 int jsxGet_scrollX()
          Returns the value of "scrollX" property.
 int jsxGet_scrollY()
          Returns the value of "scrollY" property.
 WindowProxy jsxGet_self()
          Returns the "self" property.
 Storage jsxGet_sessionStorage()
          Returns the sessionStorage property.
 String jsxGet_status()
          Returns the text from the status line.
 WindowProxy jsxGet_top()
          Returns the value of the top property.
 WindowProxy jsxGet_window()
          Returns the window property.
 void jsxSet_controllers(Object value)
          Sets the controllers.
 void jsxSet_location(String newLocation)
          Sets the location property.
 void jsxSet_name(String name)
          Sets the value of the window's name property.
 void jsxSet_onbeforeunload(Object onbeforeunload)
          Sets the value of the window's onbeforeunload property.
 void jsxSet_onclick(Object newOnload)
          Sets the value of the onclick event handler.
 void jsxSet_ondblclick(Object newHandler)
          Sets the value of the ondblclick event handler.
 void jsxSet_onerror(Object onerror)
          Sets the value of the window's onerror property.
 void jsxSet_onload(Object newOnload)
          Sets the value of the onload event handler.
 void jsxSet_opener(Object newValue)
          Sets the opener property.
 void jsxSet_status(String message)
          Sets the text from the status line.
 void setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map)
          Sets the prototypes for HtmlUnit host classes.
 void triggerOnError(ScriptException e)
          Triggers the onerror handler, if one has been set.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, clear, containsKey, containsValue, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, entrySet, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, keySet, preventExtensions, put, put, put, putAll, putConst, putConstProperty, putProperty, putProperty, redefineProperty, remove, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
delete, delete, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

WINDOW_WIDTH

public static final int WINDOW_WIDTH
HtmlUnit's "window" width, in pixels.

See Also:
Constant Field Values

WINDOW_HEIGHT

public static final int WINDOW_HEIGHT
HtmlUnit's "window" height, in pixels.

See Also:
Constant Field Values
Constructor Detail

Window

public Window()
Creates an instance.

Method Detail

getPrototype

public net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(Class<? extends SimpleScriptable> jsClass)
Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope.

Overrides:
getPrototype in class SimpleScriptable
Parameters:
jsClass - the class whose prototype is to be returned
Returns:
the prototype object corresponding to the specified class inside the specified scope

setPrototypes

public void setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map)
Sets the prototypes for HtmlUnit host classes.

Parameters:
map - a Map of (Class, Scriptable)

jsxFunction_alert

public void jsxFunction_alert(Object message)
The JavaScript function "alert()".

Parameters:
message - the message

jsxFunction_btoa

public String jsxFunction_btoa(String stringToEncode)
Creates a base-64 encoded ASCII string from a string of binary data.

Parameters:
stringToEncode - string to encode
Returns:
the encoded string

jsxFunction_atob

public String jsxFunction_atob(String encodedData)
Decodes a string of data which has been encoded using base-64 encoding..

Parameters:
encodedData - the encoded string
Returns:
the decoded value

jsxFunction_confirm

public boolean jsxFunction_confirm(String message)
The JavaScript function "confirm()".

Parameters:
message - the message
Returns:
true if ok was pressed, false if cancel was pressed

jsxFunction_prompt

public String jsxFunction_prompt(String message)
The JavaScript function "prompt()".

Parameters:
message - the message
Returns:
true if ok was pressed, false if cancel was pressed

jsxGet_document

public HTMLDocumentProxy jsxGet_document()
Returns the JavaScript property "document".

Returns:
the document

getDocument

public HTMLDocument getDocument()
Returns the window's current document.

Returns:
the window's current document

jsxGet_applicationCache

public OfflineResourceList jsxGet_applicationCache()
Returns the application cache.

Returns:
the application cache

jsxGet_event

public Object jsxGet_event()
Returns the current event (used by JavaScript only when emulating IE).

Returns:
the current event, or null if no event is currently available

getCurrentEvent

public Event getCurrentEvent()
Returns the current event (used internally regardless of the emulation mode).

Returns:
the current event, or null if no event is currently available

jsxFunction_open

public WindowProxy jsxFunction_open(Object url,
                                    Object name,
                                    Object features,
                                    Object replace)
Opens a new window.

Parameters:
url - when a new document is opened, url is a String that specifies a MIME type for the document. When a new window is opened, url is a String that specifies the URL to render in the new window
name - the name
features - the features
replace - whether to replace in the history list or no
Returns:
the newly opened window, or null if popup windows have been disabled
See Also:
WebClient.isPopupBlockerEnabled(), MSDN documentation

jsxFunction_createPopup

public Popup jsxFunction_createPopup()
Creates a popup window.

Returns:
the created popup
See Also:
MSDN documentation

jsxFunction_setTimeout

public int jsxFunction_setTimeout(Object code,
                                  int timeout,
                                  Object language)
Sets a chunk of JavaScript to be invoked at some specified time later. The invocation occurs only if the window is opened after the delay and does not contain an other page than the one that originated the setTimeout.

Parameters:
code - specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed
timeout - specifies the number of milliseconds
language - specifies language
Returns:
the id of the created timer

jsxFunction_clearTimeout

public void jsxFunction_clearTimeout(int timeoutId)
Cancels a time-out previously set with the setTimeout method.

Parameters:
timeoutId - identifier for the timeout to clear (returned by setTimeout)

jsxGet_navigator

public Navigator jsxGet_navigator()
Returns the JavaScript property "navigator".

Returns:
the navigator

jsxGet_clientInformation

public Navigator jsxGet_clientInformation()
Returns the JavaScript property "clientInformation".

Returns:
the client information

jsxGet_clipboardData

public ClipboardData jsxGet_clipboardData()
Returns the JavaScript property "clipboardData".

Returns:
the ClipboardData

jsxGet_window

public WindowProxy jsxGet_window()
Returns the window property. This is a synonym for "self".

Returns:
the window property (a reference to this)

jsxGet_self

public WindowProxy jsxGet_self()
Returns the "self" property.

Returns:
this

jsxGet_localStorage

public Storage jsxGet_localStorage()
Returns the localStorage property.

Returns:
the localStorage property

jsxGet_sessionStorage

public Storage jsxGet_sessionStorage()
Returns the sessionStorage property.

Returns:
the sessionStorage property

jsxGet_globalStorage

public StorageList jsxGet_globalStorage()
Returns the globalStorage property.

Returns:
the globalStorage property

jsxGet_location

public Location jsxGet_location()
Returns the location property.

Returns:
the location property

jsxSet_location

public void jsxSet_location(String newLocation)
                     throws IOException
Sets the location property. This will cause a reload of the window.

Parameters:
newLocation - the URL of the new content
Throws:
IOException - when location loading fails

jsxGet_screen

public Screen jsxGet_screen()
Returns the "screen" property.

Returns:
the screen property

jsxGet_history

public History jsxGet_history()
Returns the "history" property.

Returns:
the "history" property

jsxGet_external

public External jsxGet_external()
Returns the "external" property.

Returns:
the "external" property

initialize

public void initialize(WebWindow webWindow)
Initializes this window.

Parameters:
webWindow - the web window corresponding to this window

initialize

public void initialize(Page enclosedPage)
Initialize the object.

Parameters:
enclosedPage - the page containing the JavaScript

initialize

public void initialize()
Initializes the object. Only called for Windows with no contents.


jsxGet_top

public WindowProxy jsxGet_top()
Returns the value of the top property.

Returns:
the value of "top"

jsxGet_parent

public WindowProxy jsxGet_parent()
Returns the value of the parent property.

Returns:
the value of window.parent

jsxGet_opener

public Object jsxGet_opener()
Returns the value of the opener property.

Returns:
the value of window.opener, null for a top level window

jsxSet_opener

public void jsxSet_opener(Object newValue)
Sets the opener property.

Parameters:
newValue - the new value

jsxGet_frameElement

public Object jsxGet_frameElement()
Returns the (i)frame in which the window is contained.

Returns:
null for a top level window

jsxGet_frames

public WindowProxy jsxGet_frames()
Returns the value of the frames property.

Returns:
the value of the frames property

jsxGet_length

public int jsxGet_length()
Returns the number of frames contained by this window.

Returns:
the number of frames contained by this window

getWebWindow

public WebWindow getWebWindow()
Returns the WebWindow associated with this Window.

Returns:
the WebWindow

jsxFunction_focus

public void jsxFunction_focus()
Sets the focus to this element.


jsxFunction_blur

public void jsxFunction_blur()
Removes focus from this element.


jsxFunction_close

public void jsxFunction_close()
Closes this window.


jsxGet_closed

public boolean jsxGet_closed()
Indicates if this window is closed.

Returns:
true if this window is closed

jsxFunction_moveTo

public void jsxFunction_moveTo(int x,
                               int y)
Does nothing.

Parameters:
x - the horizontal position
y - the vertical position

jsxFunction_moveBy

public void jsxFunction_moveBy(int x,
                               int y)
Does nothing.

Parameters:
x - the horizontal position
y - the vertical position

jsxFunction_resizeBy

public void jsxFunction_resizeBy(int width,
                                 int height)
Does nothing.

Parameters:
width - the width offset
height - the height offset

jsxFunction_resizeTo

public void jsxFunction_resizeTo(int width,
                                 int height)
Does nothing.

Parameters:
width - the width of the Window in pixel after resize
height - the height of the Window in pixel after resize

jsxFunction_scroll

public void jsxFunction_scroll(int x,
                               int y)
Scrolls to the specified location on the page.

Parameters:
x - the horizontal position to scroll to
y - the vertical position to scroll to

jsxFunction_scrollBy

public void jsxFunction_scrollBy(int x,
                                 int y)
Scrolls the window content the specified distance.

Parameters:
x - the horizontal distance to scroll by
y - the vertical distance to scroll by

jsxFunction_scrollByLines

public void jsxFunction_scrollByLines(int lines)
Scrolls the window content down by the specified number of lines.

Parameters:
lines - the number of lines to scroll down

jsxFunction_scrollByPages

public void jsxFunction_scrollByPages(int pages)
Scrolls the window content down by the specified number of pages.

Parameters:
pages - the number of pages to scroll down

jsxFunction_scrollTo

public void jsxFunction_scrollTo(int x,
                                 int y)
Scrolls to the specified location on the page.

Parameters:
x - the horizontal position to scroll to
y - the vertical position to scroll to

jsxSet_onload

public void jsxSet_onload(Object newOnload)
Sets the value of the onload event handler.

Parameters:
newOnload - the new handler

jsxSet_onclick

public void jsxSet_onclick(Object newOnload)
Sets the value of the onclick event handler.

Parameters:
newOnload - the new handler

jsxGet_onclick

public Object jsxGet_onclick()
Returns the onclick property (caution this is not necessary a function if something else has been set).

Returns:
the onclick property

jsxSet_ondblclick

public void jsxSet_ondblclick(Object newHandler)
Sets the value of the ondblclick event handler.

Parameters:
newHandler - the new handler

jsxGet_ondblclick

public Object jsxGet_ondblclick()
Returns the ondblclick property (caution this is not necessary a function if something else has been set).

Returns:
the ondblclick property

jsxGet_onload

public Object jsxGet_onload()
Returns the onload property. Note that this is not necessarily a function if something else has been set.

Returns:
the onload property

getEventListenersContainer

public EventListenersContainer getEventListenersContainer()
Gets the container for event listeners.

Returns:
the container (newly created if needed)

jsxFunction_attachEvent

public boolean jsxFunction_attachEvent(String type,
                                       net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the registration of event listeners on the event target.

Parameters:
type - the event type to listen for (like "load")
listener - the event listener
Returns:
true if the listener has been added
See Also:
MSDN documentation

jsxFunction_addEventListener

public void jsxFunction_addEventListener(String type,
                                         net.sourceforge.htmlunit.corejs.javascript.Function listener,
                                         boolean useCapture)
Allows the registration of event listeners on the event target.

Parameters:
type - the event type to listen for (like "onload")
listener - the event listener
useCapture - If true, indicates that the user wishes to initiate capture (not yet implemented)
See Also:
Mozilla documentation

jsxFunction_detachEvent

public void jsxFunction_detachEvent(String type,
                                    net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the removal of event listeners on the event target.

Parameters:
type - the event type to listen for (like "onload")
listener - the event listener
See Also:
MSDN documentation

jsxFunction_removeEventListener

public void jsxFunction_removeEventListener(String type,
                                            net.sourceforge.htmlunit.corejs.javascript.Function listener,
                                            boolean useCapture)
Allows the removal of event listeners on the event target.

Parameters:
type - the event type to listen for (like "load")
listener - the event listener
useCapture - If true, indicates that the user wishes to initiate capture (not yet implemented)
See Also:
Mozilla documentation

jsxGet_name

public String jsxGet_name()
Returns the value of the window's name property.

Returns:
the value of the window's name property

jsxSet_name

public void jsxSet_name(String name)
Sets the value of the window's name property.

Parameters:
name - the value of the window's name property

jsxGet_onbeforeunload

public Object jsxGet_onbeforeunload()
Returns the value of the window's onbeforeunload property.

Returns:
the value of the window's onbeforeunload property

jsxSet_onbeforeunload

public void jsxSet_onbeforeunload(Object onbeforeunload)
Sets the value of the window's onbeforeunload property.

Parameters:
onbeforeunload - the value of the window's onbeforeunload property

jsxGet_onerror

public Object jsxGet_onerror()
Returns the value of the window's onerror property.

Returns:
the value of the window's onerror property

jsxSet_onerror

public void jsxSet_onerror(Object onerror)
Sets the value of the window's onerror property.

Parameters:
onerror - the value of the window's onerror property

triggerOnError

public void triggerOnError(ScriptException e)
Triggers the onerror handler, if one has been set.

Parameters:
e - the error that needs to be reported

call

public Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                   net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
                   net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
                   Object[] args)

Specified by:
call in interface net.sourceforge.htmlunit.corejs.javascript.Callable
Specified by:
call in interface net.sourceforge.htmlunit.corejs.javascript.Function

construct

public net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                                                                       net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
                                                                       Object[] args)

Specified by:
construct in interface net.sourceforge.htmlunit.corejs.javascript.Function

getWithFallback

public Object getWithFallback(String name)
Fallback called when no configured property is found with the given name on the Scriptable object.

Specified by:
getWithFallback in interface ScriptableWithFallbackGetter
Parameters:
name - the name of the requested property
Returns:
the object value, Scriptable.NOT_FOUND if nothing is found

get

public Object get(int index,
                  net.sourceforge.htmlunit.corejs.javascript.Scriptable start)

Specified by:
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
Overrides:
get in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject

get

public Object get(String name,
                  net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Gets a named property from the object. Normally HtmlUnit objects don't need to overwrite this method as properties are defined on the prototypes from the XML configuration. In some cases where "content" of object has priority compared to the properties consider using utility SimpleScriptable.getWithPreemption(String). For fallback case just implement ScriptableWithFallbackGetter.

Specified by:
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
Overrides:
get in class SimpleScriptable

getProxy

public static WindowProxy getProxy(WebWindow w)
Returns the proxy for the specified window.

Parameters:
w - the window whose proxy is to be returned
Returns:
the proxy for the specified window

jsxFunction_execScript

public void jsxFunction_execScript(String script,
                                   Object language)
Executes the specified script code as long as the language is JavaScript or JScript. Does nothing if the language specified is VBScript. Note: MSDN doc says that the function returns null but in fact this is undefined.

Parameters:
script - the script code to execute
language - the language of the specified code ("JavaScript", "JScript" or "VBScript")
See Also:
MSDN documentation

custom_eval

public Object custom_eval(String scriptCode)
Executes the specified script code in the scope of this window. This is used only when eval() is called on a Window other than the starting scope

Parameters:
scriptCode - some JavaScript code
Returns:
the evaluation result

jsxGet_status

public String jsxGet_status()
Returns the text from the status line.

Returns:
the status line text

jsxSet_status

public void jsxSet_status(String message)
Sets the text from the status line.

Parameters:
message - the status line text

jsxFunction_setInterval

public int jsxFunction_setInterval(Object code,
                                   int timeout,
                                   Object language)
Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed.

Parameters:
code - specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed
timeout - specifies the number of milliseconds
language - specifies language
Returns:
the id of the created interval
See Also:
MSDN documentation

jsxFunction_clearInterval

public void jsxFunction_clearInterval(int intervalID)
Cancels the interval previously started using the setInterval method. Current implementation does nothing.

Parameters:
intervalID - specifies the interval to cancel as returned by the setInterval method
See Also:
MSDN documentation

jsxGet_innerWidth

public int jsxGet_innerWidth()
Returns the innerWidth.

Returns:
a dummy value
See Also:
Mozilla doc

jsxGet_outerWidth

public int jsxGet_outerWidth()
Returns the outerWidth.

Returns:
a dummy value
See Also:
Mozilla doc

jsxGet_innerHeight

public int jsxGet_innerHeight()
Returns the innerHeight.

Returns:
a dummy value
See Also:
Mozilla doc

jsxGet_outerHeight

public int jsxGet_outerHeight()
Returns the outer height.

Returns:
a dummy value
See Also:
Mozilla doc

jsxFunction_print

public void jsxFunction_print()
Prints the current page. The current implementation does nothing.

See Also:
Mozilla documentation, MSDN documentation

jsxFunction_captureEvents

public void jsxFunction_captureEvents(String type)
Does nothing special anymore... just like FF.

Parameters:
type - the type of events to capture
See Also:
Document.jsxFunction_captureEvents(String)

jsxFunction_CollectGarbage

public void jsxFunction_CollectGarbage()
An undocumented IE function.


jsxFunction_getComputedStyle

public ComputedCSSStyleDeclaration jsxFunction_getComputedStyle(HTMLElement element,
                                                                String pseudo)
Returns computed style of the element. Computed style represents the final computed values of all CSS properties for the element. This method's return value is of the same type as that of element.style, but the value returned by this method is read-only.

Parameters:
element - the element
pseudo - a string specifying the pseudo-element to match (may be null)
Returns:
the computed style

jsxFunction_getSelection

public Selection jsxFunction_getSelection()
Returns the current selection.

Returns:
the current selection

getSelection

public Selection getSelection()
Returns the current selection.

Returns:
the current selection

jsxFunction_showModalDialog

public Object jsxFunction_showModalDialog(String url,
                                          Object arguments,
                                          String features)
Creates a modal dialog box that displays the specified HTML document.

Parameters:
url - the URL of the document to load and display
arguments - object to be made available via window.dialogArguments in the dialog window
features - string that specifies the window ornaments for the dialog window
Returns:
the value of the returnValue property as set by the modal dialog's window
See Also:
MSDN Documentation, Mozilla Documentation

jsxFunction_showModelessDialog

public Object jsxFunction_showModelessDialog(String url,
                                             Object arguments,
                                             String features)
Creates a modeless dialog box that displays the specified HTML document.

Parameters:
url - the URL of the document to load and display
arguments - object to be made available via window.dialogArguments in the dialog window
features - string that specifies the window ornaments for the dialog window
Returns:
a reference to the new window object created for the modeless dialog
See Also:
MSDN Documentation

jsxGet_controllers

public Object jsxGet_controllers()
Gets the controllers. The result doesn't currently matter but it is important to return an object as some JavaScript libraries check it.

Returns:
some object
See Also:
Mozilla documentation

jsxSet_controllers

public void jsxSet_controllers(Object value)
Sets the controllers.

Parameters:
value - the new value

jsxFunction_ScriptEngine

public String jsxFunction_ScriptEngine()
Gets the name of the scripting engine.

Returns:
"JScript"
See Also:
MSDN doc

jsxFunction_ScriptEngineBuildVersion

public int jsxFunction_ScriptEngineBuildVersion()
Gets the build version of the scripting engine.

Returns:
the build version
See Also:
MSDN doc

jsxFunction_ScriptEngineMajorVersion

public int jsxFunction_ScriptEngineMajorVersion()
Gets the major version of the scripting engine.

Returns:
the major version
See Also:
MSDN doc

jsxFunction_ScriptEngineMinorVersion

public int jsxFunction_ScriptEngineMinorVersion()
Gets the minor version of the scripting engine.

Returns:
the minor version
See Also:
MSDN doc

jsxFunction_stop

public void jsxFunction_stop()
Should implement the stop() function on the window object. (currently empty implementation)

See Also:
window.stop

jsxGet_pageXOffset

public int jsxGet_pageXOffset()
Returns the value of "pageXOffset" property.

Returns:
the value of "pageXOffset" property

jsxGet_pageYOffset

public int jsxGet_pageYOffset()
Returns the value of "pageYOffset" property.

Returns:
the value of "pageYOffset" property

jsxGet_scrollX

public int jsxGet_scrollX()
Returns the value of "scrollX" property.

Returns:
the value of "scrollX" property

jsxGet_scrollY

public int jsxGet_scrollY()
Returns the value of "scrollY" property.

Returns:
the value of "scrollY" property


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.