Examples of compileReader()


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

    final String fileToInspect = new String(filename);
    boolean goodExecution = false;
    try {
      final Reader buildFile = new FileReader(new File(fileToInspect));
      final Script sc = cx.compileReader(buildFile, fileToInspect, 1, null);

      final NativeObject window = new NativeObject();
      ScriptableObject.putProperty(scope, "window", window);
      final NativeObject htmlelement = new NativeObject();
      ScriptableObject.putProperty(scope, "HTMLElement", htmlelement);
View Full Code Here

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

            // compile it and store it for future use.

            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) {
                            // Should never happen: we are using a string
View Full Code Here

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

            // compile it and store it for future use.

            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) {
                            // Should never happen: we are using a string
View Full Code Here

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

        if (script == null) {
            // this script has not been compiled yet or has been fogotten
            // since the compilation:
            // compile it and store it for future use.
            try {
                script = ctx.compileReader(globalObject,
                                           new StringReader(scriptstr),
                                           "<SVG>",
                                           1, null);
            } catch (IOException io) {
                // can't happen because we use a String...
View Full Code Here

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

    public static void main(String[] args) throws Exception {
        //VTCollection input = new VTCollection();
        Object[] input = {new Integer(4), new Integer(5)};
        Context cx = Context.enter();
        Scriptable scope = cx.initStandardObjects();
        Script sc = cx.compileReader(new FileReader("functions/sum.js"), "sum",
                1, null);
        ScriptableObject.putProperty(scope, "args", Context.javaToJS(input, scope));
        Object o = sc.exec(cx, scope);
        System.out.println(o);
    }
View Full Code Here

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

        if (script == null) {
            // this script has not been compiled yet or has been fogotten
            // since the compilation:
            // compile it and store it for future use.
            try {
                script = ctx.compileReader(globalObject,
                                           new StringReader(scriptstr),
                                           "<SVG>",
                                           1, rhinoClassLoader);
            } catch (IOException io) {
                // can't happen because we use a String...
View Full Code Here

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

            String filename = (String) get(RhinoScriptEngine.FILENAME);
            if (filename == null) {
                filename = "<Unknown Source>";
            }
           
            Script scr = cx.compileReader(preProcessScriptSource(script), filename, 1, null);
            ret = new RhinoCompiledScript(this, scr);
        } catch (Exception e) {
            if (DEBUG) e.printStackTrace();
            throw new ScriptException(e);
        } finally {
View Full Code Here

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()

                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()

                        // File, URL and URLClassLoader will be frequently used by scripts.
                        new NativeJavaPackage("java.net", loader),
                        new NativeJavaPackage("java.io", loader),
                    },
                    null);
            Script scriptObject = cx.compileReader(scope, getScriptReader(), "javascript", 1, null);
            scriptObject.exec(cx, scope);
            Object pico = scope.get("pico", scope);

            if (pico == null) {
                throw new NanoContainerMarkupException("The script must define a variable named 'pico'");
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.