Class JSScript

java.lang.Object
org.htmlunit.corejs.javascript.JSScript
All Implemented Interfaces:
Script, ScriptOrFn<JSScript>

public class JSScript extends Object implements Script, ScriptOrFn<JSScript>
Represents a script object built upon a JSDescriptor. This class does not support the Callable interface scripts do not support arguments or some other parts of a call operation.
  • Constructor Details

  • Method Details

    • getDescriptor

      public JSDescriptor<JSScript> getDescriptor()
      Specified by:
      getDescriptor in interface Script
      Specified by:
      getDescriptor in interface ScriptOrFn<JSScript>
    • getHomeObject

      public Scriptable getHomeObject()
      Specified by:
      getHomeObject in interface ScriptOrFn<JSScript>
    • exec

      public Object exec(Context cx, VarScope scope, Object thisObj)
      Description copied from interface: Script
      Execute the script.

      The script is executed in a particular runtime Context, which must be associated with the current thread. The script is executed relative to a scope--definitions and uses of global top-level variables and functions will access properties of the scope object. For compliant ECMA programs, the scope must be an object that has been initialized as a global object using Context.initStandardObjects.

      Specified by:
      exec in interface Script
      Parameters:
      cx - the Context associated with the current thread
      scope - the scope to execute relative to
      thisObj - the value "this" should be set to
      Returns:
      the result of executing the script
      See Also: