Package org.mozilla.javascript

Examples of org.mozilla.javascript.Script.exec()


  private Object runScript(final String scriptSourceText) {
    return contextFactory.call(new ContextAction() {
      public Object run(Context context) {
        Script script = context.compileString(scriptSourceText, "", 1, null);
        return script.exec(context, global);
      }
    });
  }
}
View Full Code Here


    final Context cx = ContextFactory.getGlobal().enterContext();
    try {
            Scriptable topScope = cx.initStandardObjects();
        topScope.put("javaNameGetter", topScope, new JavaNameGetter());
        Script script = cx.compileString(scriptCode, "myScript", 1, null);
        script.exec(cx, topScope);
    } finally {
        Context.exit();
    }
  }
}
View Full Code Here

  private Object runScript(final String scriptSourceText) {
    return this.contextFactory.call(new ContextAction() {
      public Object run(Context context) {
        Script script = context.compileString(scriptSourceText, "", 1, null);
        return script.exec(context, global);
      }
    });
 
}
View Full Code Here

      */
     
      ScriptableObject.putConstProperty(topScope, "arguments", test);
     
      // Exec the build script.
      script.exec(cx, topScope);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
 
View Full Code Here

      // Pretend these arguments came from the command line by stuffing them into the top context,
      // module loader expects to read them from here.
      ScriptableObject.putConstProperty(topScope, "arguments", getBuildScriptArguments());
     
      // Execute the build system scripts to generate optimised dojo builds
      moduleLoader.exec(cx, topScope)
    } catch (Exception buildError) {
      buildCompleted = false;
      this.buildError = buildError;
    }   
   
View Full Code Here

    private Object[] compileScript(Context cx, String scriptStr, Scriptable scriptScope, File f) {
        int opt = cx.getOptimizationLevel();
        cx.setOptimizationLevel(-1);
        Script script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        Object[] ids = scriptScope.getIds();
        cx.setOptimizationLevel(opt);
        script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        return ids;
View Full Code Here

        Script script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        Object[] ids = scriptScope.getIds();
        cx.setOptimizationLevel(opt);
        script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        return ids;
    }

    static class RhinoContextFactory extends ContextFactory {
        public boolean hasFeature(Context cx, int feature) {
View Full Code Here

     // TODO: broken with the way the tuscany launcher now uses class loaders
     //           cx.setApplicationClassLoader(cl);
            }
            this.scriptScope = new ImporterTopLevel(cx, true);
            Script compiledScript = cx.compileString(scriptCode, fileName, 1, null);
            compiledScript.exec(cx, scriptScope);
            addContexts(scriptScope, context);

        } finally {
            Context.exit();
        }
View Full Code Here

    private Object[] compileScript(Context cx, String scriptStr, Scriptable scriptScope, File f) {
        int opt = cx.getOptimizationLevel();
        cx.setOptimizationLevel(-1);
        Script script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        Object[] ids = scriptScope.getIds();
        cx.setOptimizationLevel(opt);
        script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        return ids;
View Full Code Here

        Script script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        Object[] ids = scriptScope.getIds();
        cx.setOptimizationLevel(opt);
        script = cx.compileString(scriptStr, f.getName(), 1, null);
        script.exec(cx, scriptScope);
        return ids;
    }

    static class RhinoContextFactory extends ContextFactory {
        public boolean hasFeature(Context cx, int feature) {
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.