com.meterware.httpunit.javascript
Class ScriptingEngineImpl

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.meterware.httpunit.javascript.ScriptingEngineImpl
All Implemented Interfaces:
ScriptingEngine, ScriptingEventHandler, ScriptingHandler, java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
Direct Known Subclasses:
AbstractDomComponent, JavaScript.Control, JavaScript.Document, JavaScript.HTMLElement, JavaScript.Location, JavaScript.Navigator, JavaScript.Option, JavaScript.Options, JavaScript.Screen, JavaScript.Style, JavaScript.Window

public abstract class ScriptingEngineImpl
extends org.mozilla.javascript.ScriptableObject
implements ScriptingEngine

Author:
Russell Gold
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
ScriptingEngineImpl()
           
 
Method Summary
static void clearErrorMessages()
           
protected  void discardDocumentWriteBuffer()
           
 boolean doEvent(java.lang.String eventScript)
          Deprecated. since 1.7 - use doEventScript instead
 boolean doEventScript(java.lang.String eventScript)
          handle the event that has the given script attached by compiling the eventScript as a function and executing it
 java.lang.Object evaluateExpression(java.lang.String expression)
          Evaluates the specified string as JavaScript.
protected  java.lang.String getDocumentWriteBuffer()
           
static java.lang.String[] getErrorMessages()
           
 boolean handleEvent(java.lang.String eventName)
          get the event Handler script for the event e.g.
static void handleScriptException(java.lang.Exception e, java.lang.String badScript)
          handle Exceptions
 java.lang.String runScript(java.lang.String language, java.lang.String script)
          run the given script
 boolean supportsScriptLanguage(java.lang.String language)
           
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.meterware.httpunit.scripting.ScriptingEngine
clearCaches, newScriptingEngine
 

Constructor Detail

ScriptingEngineImpl

public ScriptingEngineImpl()
Method Detail

clearErrorMessages

public static void clearErrorMessages()

getErrorMessages

public static java.lang.String[] getErrorMessages()

handleScriptException

public static void handleScriptException(java.lang.Exception e,
                                         java.lang.String badScript)
handle Exceptions

Parameters:
e - - the exception to handle
badScript - - the script that caused the problem

supportsScriptLanguage

public boolean supportsScriptLanguage(java.lang.String language)
Specified by:
supportsScriptLanguage in interface ScriptingHandler

runScript

public java.lang.String runScript(java.lang.String language,
                                  java.lang.String script)
run the given script

Specified by:
runScript in interface ScriptingHandler
Parameters:
language - - the language of the script
script - - the script to run

doEvent

public boolean doEvent(java.lang.String eventScript)
Deprecated. since 1.7 - use doEventScript instead

handle the event that has the given script attached by compiling the eventScript as a function and executing it

Specified by:
doEvent in interface ScriptingEventHandler
Parameters:
eventScript - - the script to use
Returns:
true if the script is empty or the result of the script

doEventScript

public boolean doEventScript(java.lang.String eventScript)
handle the event that has the given script attached by compiling the eventScript as a function and executing it

Specified by:
doEventScript in interface ScriptingEventHandler
Parameters:
eventScript - - the script to use
Returns:
true if the script is empty or the result of the script

handleEvent

public boolean handleEvent(java.lang.String eventName)
get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup execute the script if it's assigned by calling doEvent for the script

Specified by:
handleEvent in interface ScriptingEventHandler
Parameters:
eventName -
Returns:

evaluateExpression

public java.lang.Object evaluateExpression(java.lang.String expression)
Evaluates the specified string as JavaScript. Will return null if the script has no return value.

Specified by:
evaluateExpression in interface ScriptingHandler
Parameters:
expression - - the expression to evaluate

getDocumentWriteBuffer

protected java.lang.String getDocumentWriteBuffer()

discardDocumentWriteBuffer

protected void discardDocumentWriteBuffer()


Copyright © 2011. All Rights Reserved.