Package org.mozilla.javascript

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


                    // this script has been compiled before,
                    // just update its index so it won't get deleted soon.
                    compiledScripts.addLast(entry);
                }

                return script.exec(cx, globalObject);
            }
        };
        try {
            return contextFactory.call(evalAction);
        } catch (InterpreterException ie) {
View Full Code Here


        try {
            logger.debug("Compiling source {}", source.getSource());
            Script script = compile(source);
            if (script != null) {
                logger.debug("Executing compiled script");
                Object result = script.exec(Context.getCurrentContext(), shellScope.get());
                logger.debug("Returned object [{}]", result);
                if(result instanceof Undefined) {
                    return null;
                }
                return result;
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

        throws Exception {
        org.mozilla.javascript.Context cx =
            org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();
        Script script = getInterpreter().compileScript(cx, filename);
        return script.exec( cx, scope );
    }

    /**
     * Setup an object so that it can access the information provided to regular components.
     * This is done by calling the various Avalon lifecycle interfaces implemented by the object, which
View Full Code Here

                ScriptSourceEntry entry =
                    (ScriptSourceEntry) compiledScripts.get(sourceURI);
                long lastMod = entry.getSource().getLastModified();
                Script script = entry.getScript(context, this.scope, false, this);
                if (lastExecTime == 0 || lastMod > lastExecTime) {
                    script.exec(context, thrScope);
                    thrScope.onExec();
                }
            }
        }
    }
View Full Code Here

        org.mozilla.javascript.Context cx =
            org.mozilla.javascript.Context.getCurrentContext();
        try {
            Scriptable scope = getParentScope();
            Script script = interpreter.compileScript(cx, environment, filename);
            return script.exec(cx, scope);
        } catch (JavaScriptException e) {
            throw e;
        } catch (Exception e) {
            throw new JavaScriptException(e);
        }
View Full Code Here

            org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();
        Script script = interpreter.compileScript( cx,
                                                   environment,
                                                   filename );
        return script.exec( cx, scope );
    }   
       
    public static class FOM_Request extends ScriptableObject {

        Request request;
View Full Code Here

                ScriptSourceEntry entry =
                    (ScriptSourceEntry) compiledScripts.get(sourceURI);
                long lastMod = entry.getSource().getLastModified();
                Script script = entry.getScript(context, this.scope, false, this);
                if (lastExecTime == 0 || lastMod > lastExecTime) {
                    script.exec(context, thrScope);
                    thrScope.onExec();
                }
            }
        }
    }
View Full Code Here

      Script compiledScript = ctx.compileReader(reader, spec, 0, null);
      compiled.add(compiledScript);
    }

    for (Script compiledScript : compiled) {
      compiledScript.exec(ctx, scope);
    }

  }

  /**
 
View Full Code Here

   * @param javascript
   */
  public void addScript(String javascript) {
    Script compileScript = ctx.compileString(javascript, "AdditionalJS", 0,
        null);
    compileScript.exec(ctx, scope);
  }

  /**
   * Get an ordered list of javascript resources from a feature sets.
   *
 
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.