Package net.sourceforge.htmlunit.corejs.javascript

Examples of net.sourceforge.htmlunit.corejs.javascript.Script.exec()


  @GlobalFunction
  public static void loadClass( Context cx, Scriptable thisObj, Object[] args, Function funObj ) throws IllegalAccessException, InstantiationException, InvocationTargetException {
    Class clazz = getClass( args );
    if ( !Script.class.isAssignableFrom( clazz ) ) { throw reportRuntimeError( "msg.must.implement.Script" ); }
    Script script = (Script) clazz.newInstance();
    script.exec( cx, thisObj );
  }

  private static Class getClass( Object[] args ) throws IllegalAccessException, InstantiationException, InvocationTargetException {
    if ( args.length == 0 ) { throw reportRuntimeError( "msg.expected.string.arg" ); }
    Object arg0 = args[ 0 ];
View Full Code Here


     * @return the evaluation result
     */
    public Object custom_eval(final String scriptCode) {
        final Context context = Context.getCurrentContext();
        final Script script = context.compileString(scriptCode, "eval body", 0, null);
        return script.exec(context, this);
    }

    /**
     * Returns the text from the status line.
     * @return the status line text
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.