Package org.mozilla.javascript.tools.shell

Examples of org.mozilla.javascript.tools.shell.Global


    {
      ctx.setOptimizationLevel(1);
      ctx.setLanguageVersion(Context.VERSION_1_7);

      //
      Global global = new Global();
      global.init(ctx);

      this.global = global;
      this.ctx = ctx;
      this.scope = ctx.initStandardObjects(global);
      this.classCache = new HashMap<String, Class<?>>();
View Full Code Here


      URL cssmin = classLoader.getResource("META-INF/cssmin.js");
      Context cx = Context.enter();
      logger.debug("Using implementation version: "
          + cx.getImplementationVersion());
      cx.setOptimizationLevel(-1);
      Global global = new Global();
      global.init(cx);
      scope = cx.initStandardObjects(global);
      cx.evaluateReader(scope, new InputStreamReader(env.openConnection()
          .getInputStream()), env.getFile(), 1, null);
      Scriptable lessEnv = (Scriptable) scope.get("lessenv", scope);
      lessEnv.put("charset", lessEnv, options.getCharset());
View Full Code Here

   
    public CommonJSEngineFactory(List<String> modulePaths) {
        this.modulePaths = modulePaths;
        Context cx = CommonJSEngine.enterContext();
        try {
            global = new Global();
            global.initStandardObjects(cx, true);
            global.installRequire(cx, modulePaths, true);
        } finally {
            Context.exit();
        }
View Full Code Here

        if (filename == null) {
            filename = "<Unknown Source>";
        }
        Object result;
        EngineScope scope = new EngineScope(context);
        Global global = getGlobal();
        scope.setParentScope(global);
        scope.setPrototype(global);
        Context cx = enterContext();
        try {
            scope.put("exports", scope, cx.newObject(global));
View Full Code Here

     */
    public JavaScriptProcess(File algorithm) {
        myScript = algorithm;
        Context cx = Context.enter();
        try {
            scope = new Global(); // cx.initStandardObjects();
            scope.initStandardObjects(cx, true);
            scope.installRequire(cx, new java.util.ArrayList(), true);
            FileReader reader = new FileReader(myScript);
            /// Script script = cx.compileReader(reader, myScript.getName(), 1, null);
            /// script.exec(cx, scope);
View Full Code Here

  public RhinoCompiler(LessOptions options, ResourceLoader loader, URL less, URL env, URL engine, URL cssmin, URL sourceMap) throws IOException {
    Context cx = Context.enter();
    logger.debug("Using implementation version: "
        + cx.getImplementationVersion());
    cx.setOptimizationLevel(-1);
    Global global = new Global();
    global.init(cx);
    scope = cx.initStandardObjects(global);
    cx.evaluateReader(scope, new InputStreamReader(sourceMap
        .openConnection().getInputStream()), sourceMap.getFile(), 1,
        null);
    cx.evaluateReader(scope, new InputStreamReader(env.openConnection()
View Full Code Here

  public RhinoCompiler(LessOptions options, ResourceLoader loader, URL less, URL env, URL engine, URL cssmin, URL sourceMap) throws IOException {
    Context cx = Context.enter();
    logger.debug("Using implementation version: "
        + cx.getImplementationVersion());
    cx.setOptimizationLevel(-1);
    Global global = new Global();
    global.init(cx);
    scope = cx.initStandardObjects(global);
    cx.evaluateReader(scope, new InputStreamReader(sourceMap
        .openConnection().getInputStream()), sourceMap.getFile(), 1,
        null);
    cx.evaluateReader(scope, new InputStreamReader(env.openConnection()
View Full Code Here

         * if you step over from one script block, the debugger fails to kick in on the beginning of the next script block.
         * This makes it difficult to set a break point on arbitrary script block in the HTML page. We need to fix this
         * by tweaking {@link Dim.StackFrame#onLineChange(Context, int)}.
         */
        public Dim interactiveJavaScriptDebugger() {
            Global global = new Global();
            HtmlUnitContextFactory cf = getJavaScriptEngine().getContextFactory();
            global.init(cf);

            Dim dim = org.mozilla.javascript.tools.debugger.Main.mainEmbedded(cf, global, "Rhino debugger: " + getName());

            // break on exceptions. this catch most of the errors
            dim.setBreakOnExceptions(true);
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.tools.shell.Global

Copyright © 2018 www.massapicom. 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.