Package org.mozilla.javascript

Examples of org.mozilla.javascript.Context.initStandardObjects()


  @Test
  @Ignore
  public void testCommentFromFile() {
    String pathName = "war/test/com/antonytrupe/hex/testSource.js";
    final Context cx = Context.enter();
    final Scriptable scope = cx.initStandardObjects();

    Object result = null;
    try {

      Scanner s = new Scanner(new File(pathName));
View Full Code Here


        "/html/lib/treeTTL.js",
        "/html/lib/emitter.js");
             
      try {
        Context cx = ContextFactory.getGlobal().enterContext();
        Scriptable scope = cx.initStandardObjects();
        Object wrappedOut = Context.javaToJS(System.out, scope);
        ScriptableObject.putProperty(scope, "out", wrappedOut);

        Object result = null;
       
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

      boolean result = false;

      // now evaluate the condition using JavaScript
      Context cx = Context.enter();
      try {
          Scriptable scope = cx.initStandardObjects(null);
          Object cxResultObject =
            cx.evaluateString(scope, cond
          /*** conditionString ***/
          , "<cmd>", 1, null);
          resultStr = Context.toString(cxResultObject);
View Full Code Here

    private static Scriptable getRootScope() {
        if (_rootScope == null) {
            // Create it if never used up to now
            Context ctx = Context.enter();
            try {
                _rootScope = ctx.initStandardObjects(null);
            } finally {
                Context.exit();
            }
        }
       
View Full Code Here

      Reader dustJsHelperReader = new InputStreamReader(dustHelperJsStream, encoding);

      Context context = Context.enter();
      context.setOptimizationLevel(9);

      globalScope = context.initStandardObjects();
      context.evaluateReader(globalScope, dustJsReader, dustJsFilePath, dustJsStream.available(), null);
      context.evaluateReader(globalScope, dustJsHelperReader, dustJsHelperFilePath,
          dustHelperJsStream.available(), null);
    } catch (Exception e) {
      logger.error("thrown exception when initialize step!", e);
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.