Returns the result, if any, of executing the specified script.
Evaluates a script containing javascript commands in the context of the current document. If document-defined functions or properties are accessed by the script then this method should not be invoked until the document has finished loading (ProgressListener.completed()
gives notification of this).
If the script returns a value with a supported type then a java representation of the value is returned. The supported javascript -> java mappings are:
- javascript null or undefined ->
null
- javascript number ->
java.lang.Double
- javascript string ->
java.lang.String
- javascript boolean ->
java.lang.Boolean
- javascript array whose elements are all of supported types ->
java.lang.Object[]
An
SWTException
is thrown if the return value has an unsupported type, or if evaluating the script causes a javascript error to be thrown.
@param script the script with javascript commands
@return the return value, if any, of executing the script
@exception IllegalArgumentException
- ERROR_NULL_ARGUMENT - if the script is null
@exception SWTException
- ERROR_FAILED_EVALUATE when the script evaluation causes a javascript error to be thrown
- ERROR_INVALID_RETURN_VALUE when the script returns a value of unsupported type
- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
@see ProgressListener#completed(ProgressEvent)
@since 3.5