Examples of compileReader()


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

        String sourceName = DomHelper.getSystemIdLocation(element);

        Context ctx = Context.enter();
        Script script;
        try {
            script = ctx.compileReader(
                getRootScope(), //scope
                new StringReader(jsText), // in
                sourceName == null ? "<unknown>" : sourceName, // sourceName
                DomHelper.getLineLocation(element), // lineNo
                null // securityDomain
View Full Code Here

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

            context.setOptimizationLevel(-1);

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Compiling script " + file);
            }
            script = context.compileReader(global, new FileReader(file), file.toString(), 1, null);
        } catch (Exception e) {
            compileError = e;
        } finally {
            Context.exit();
        }
View Full Code Here

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

                script = (Script)AccessController.doPrivileged
                    (new PrivilegedAction() {
                            public Object run() {
                                try {
                                    return ctx.compileReader
                                        (globalObject,
                                         new StringReader(scriptstr),
                                         SOURCE_NAME_SVG,
                                         1, rhinoClassLoader);
                                } catch (IOException io) {
View Full Code Here

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

        String jsText = DomHelper.getElementText(element);
       
        String sourceName = DomHelper.getSystemIdLocation(element);
       
        Context ctx = Context.enter();
        Script script = ctx.compileReader(
            JavaScriptWidgetListener.getRootScope(), //scope
            new StringReader(jsText), // in
            sourceName == null ? "<unknown>" : sourceName, // sourceName
            DomHelper.getLineLocation(element), // lineNo
            null // securityDomain
View Full Code Here

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

                script = (Script)AccessController.doPrivileged
                    (new PrivilegedAction() {
                            public Object run() {
                                try {
                                    return ctx.compileReader
                                        (globalObject,
                                         new StringReader(scriptstr),
                                         SOURCE_NAME_SVG,
                                         1, rhinoClassLoader);
                                } catch (IOException io) {
View Full Code Here

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

   
    public void testJsApi() throws Exception {
        Context cx = Context.enter();
        try {
            cx.setOptimizationLevel(-1);
            Script script = cx.compileReader(new InputStreamReader(
                    Bug482203Test.class.getResourceAsStream("Bug482203.js")),
                    "", 1, null);
            Scriptable scope = cx.initStandardObjects();
            script.exec(cx, scope);
            int counter = 0;
View Full Code Here

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

   
    public void testJavaApi() throws Exception {
        Context cx = Context.enter();
        try {
            cx.setOptimizationLevel(-1);
            Script script = cx.compileReader(new InputStreamReader(
                    Bug482203Test.class.getResourceAsStream("Bug482203.js")),
                    "", 1, null);
            Scriptable scope = cx.initStandardObjects();
            cx.executeScriptWithContinuations(script, scope);
            int counter = 0;
View Full Code Here

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

          streams.add(lesscJs.openConnection().getInputStream());
         
          InputStreamReader reader = new InputStreamReader(new SequenceInputStream(Collections.enumeration(streams)));
           
          // Load the streams into a function we can run
            compiler = (Function) cx.compileReader(reader, lessJs.toString(), 1, null);           
                   
        }
        catch (Exception e) {
            String message = "Failed to initialize LESS compiler.";
            logger.error(message, e);
View Full Code Here

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

            String source =
                ((String) rhinospace.get("javax.script.filename") != null)
                ? (String) rhinospace.get("javax.script.filename")
                : "<unknown>";
               
                script = cx.compileReader(reader, source, 0, null);
               
        } catch (Throwable throwable) {
            errorHandler(throwable);
        } finally {
            Context.exit();
View Full Code Here

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

    private void compile() {
        Context ctx = Context.enter();
        try {
            // Note: used compileReader instead of compileString to work with the older Rhino in C2.1
            this.script = ctx.compileReader(TemplateObjectModelHelper.getScope(), new StringReader(getExpression()), "", 1, null);
        } catch (Exception e) {
            // Note: this catch block is only needed for the Rhino in C2.1 where the older
            //       Rhino does not throw RuntimeExceptions
            if (e instanceof RuntimeException)
                throw (RuntimeException)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.