|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.ScriptEngine
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine
public class JavaScriptEngine
A wrapper for the Rhino javascript engine
that provides browser specific features.
Like all classes in this package, this class is not intended for direct use
and may change without notice.
Field Summary | |
---|---|
static java.lang.String |
KEY_STARTING_SCOPE
Key used to place the scope in which the execution of some javascript code started as thread local attribute in current context. |
Constructor Summary | |
---|---|
JavaScriptEngine(WebClient webClient)
Create an instance for the specified webclient |
Method Summary | |
---|---|
java.lang.Object |
callFunction(HtmlPage htmlPage,
org.mozilla.javascript.Function function,
org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scope,
org.mozilla.javascript.Scriptable thisObject,
java.lang.Object[] args)
Calls the given function taking care of synchronisation issues. |
java.lang.Object |
callFunction(HtmlPage htmlPage,
java.lang.Object javaScriptFunction,
java.lang.Object thisObject,
java.lang.Object[] args,
DomNode htmlElement)
Call a JavaScript function and return the result. |
java.lang.Object |
execute(HtmlPage htmlPage,
java.lang.String sourceCode,
java.lang.String sourceName,
HtmlElement htmlElement)
Execute the specified javascript code in the context of a given html page. |
static long |
getTimeout()
Returns the number of milliseconds a script is allowed to execute before being terminated. |
void |
initialize(WebWindow webWindow)
perform initialization for the given webWindow |
boolean |
isScriptRunning()
Indicates if JavaScript is running in current thread. |
static void |
setTimeout(long timeout)
Set the number of milliseconds a script is allowed to execute before being terminated. |
Methods inherited from class com.gargoylesoftware.htmlunit.ScriptEngine |
---|
execute, getScriptEngineLog, getWebClient, preProcess |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String KEY_STARTING_SCOPE
Constructor Detail |
---|
public JavaScriptEngine(WebClient webClient)
webClient
- The webClient that will own this engine.Method Detail |
---|
public java.lang.Object callFunction(HtmlPage htmlPage, org.mozilla.javascript.Function function, org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Scriptable thisObject, java.lang.Object[] args)
htmlPage
- the html page that caused this script to executedfunction
- the js function to executecontext
- the context in which execution should occurscope
- the execution scopethisObject
- the 'this' objectargs
- the function's arguments
public java.lang.Object callFunction(HtmlPage htmlPage, java.lang.Object javaScriptFunction, java.lang.Object thisObject, java.lang.Object[] args, DomNode htmlElement)
callFunction
in class ScriptEngine
htmlPage
- The pagejavaScriptFunction
- The function to call.thisObject
- The this object for class method calls.args
- The list of arguments to pass to the function.htmlElement
- The html element that will act as the context.
public java.lang.Object execute(HtmlPage htmlPage, java.lang.String sourceCode, java.lang.String sourceName, HtmlElement htmlElement)
execute
in class ScriptEngine
htmlPage
- The page that the code will execute withinsourceCode
- The javascript code to execute.sourceName
- The name that will be displayed on error conditions.htmlElement
- The element that will be used as context.
public static long getTimeout()
public void initialize(WebWindow webWindow)
initialize
in class ScriptEngine
webWindow
- the web window to initialize forpublic boolean isScriptRunning()
isScriptRunning
in class ScriptEngine
true
if JavaScript is running.public static void setTimeout(long timeout)
timeout
- the timeout value
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |