Package org.mozilla.javascript.tools.shell

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


        System.setIn(main.getIn());
        System.setOut(main.getOut());
        System.setErr(main.getErr());

        Global global = org.mozilla.javascript.tools.shell.Main.getGlobal();
        global.setIn(main.getIn());
        global.setOut(main.getOut());
        global.setErr(main.getErr());

        main.attachTo(
            org.mozilla.javascript.tools.shell.Main.shellContextFactory);

        main.setScope(global);
View Full Code Here


     * created {@link Global} object.  No I/O redirection is performed
     * as with {@link #main(String[])}.
     */
    public static Main mainEmbedded(String title) {
        ContextFactory factory = ContextFactory.getGlobal();
        Global global = new Global();
        global.init(factory);
        return mainEmbedded(factory, global, title);
    }
View Full Code Here

        if (scopeProvider instanceof ScopeProvider) {
            main.setScopeProvider((ScopeProvider)scopeProvider);
        } else {
            Scriptable scope = (Scriptable)scopeProvider;
            if (scope instanceof Global) {
                Global global = (Global)scope;
                global.setIn(main.getIn());
                global.setOut(main.getOut());
                global.setErr(main.getErr());
            }
            main.setScope(scope);
        }

        main.pack();
View Full Code Here

        try {
          Context cx = Context.enter();
          //cx.setOptimizationLevel(-1);
          cx.setLanguageVersion(Context.VERSION_1_7);
         
          Global global = new Global();
          global.init(cx);          
          scope = cx.initStandardObjects(global);
            scope.put("logger", scope, Context.toObject(logger, scope));
           
            out = new ByteArrayOutputStream();
            global.setOut(new PrintStream(out));
           
            // Combine all of the streams (less, custom, lessc) into one big stream
            List<InputStream> streams = new ArrayList<InputStream>();
           
            // less should be first
View Full Code Here

    try {
      final Context cx = Context.enter();
      cx.setOptimizationLevel(-1);
      cx.setLanguageVersion(Context.VERSION_1_7);

      final Global global = new Global();
      global.init(cx);

      scope = cx.initStandardObjects(global);

      final List<URL> jsUrls = new ArrayList<URL>(2 + customJs.size());
      jsUrls.add(envJs);
View Full Code Here

  protected void compress() throws IOException {
    URL cssmin = getClass().getClassLoader().getResource(
        "META-INF/cssmin.js");
    Context cx = Context.enter();
    cx.setOptimizationLevel(9);
    Global global = new Global();
    global.init(cx);
    Scriptable scope = cx.initStandardObjects(global);
    cx.evaluateString(scope, "var exports = {};", "exports", 1, null);
    cx.evaluateReader(scope, new InputStreamReader(cssmin.openConnection()
        .getInputStream()), cssmin.getFile(), 1, null);
    Scriptable exports = (Scriptable) scope.get("exports", scope);
View Full Code Here

        JXPathIntrospector.registerDynamicClass(org.mozilla.javascript.Scriptable.class,
                                                ScriptablePropertyHandler.class);
        JXPathContextReferenceImpl.addNodePointerFactory(new ScriptablePointerFactory());

        try {
            scope = new Global(context);
            // Access to Cocoon internal objects
            FOM_Cocoon.init(scope);
            errorReporter = new JSErrorReporter(getLogger());
        }
        catch (Exception e) {
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

      context = Context.enter();
      context.setOptimizationLevel(-1);
      context.setErrorReporter(new ToolErrorReporter(false));
      context.setLanguageVersion(Context.VERSION_1_8);

      Global global = new Global();
      global.init(context);

      Scriptable scope = context.initStandardObjects(global);

      return task.run(global, context, scope);
    } finally {
View Full Code Here

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

      // initialize the global context sharing object
      Global global = new Global();
      global.init(context);

      // create the scope
      this.scope = context.initStandardObjects(global);

      // load the scripts and evaluate them in the Rhino context
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.