Examples of compileString()


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

 
  public void testErrorOnEvalCall() {
      Context cx = Context.enter();
      try {
          cx.setOptimizationLevel(-1); // must use interpreter mode
          Script script = cx.compileString("eval('myObject.f(3);');",
                  "test source", 1, null);
          cx.executeScriptWithContinuations(script, globalScope);
          fail("Should throw IllegalStateException");
      } catch (WrappedException we) {
          Throwable t = we.getWrappedException();
View Full Code Here

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

 
  public void testScriptWithContinuations() {
      Context cx = Context.enter();
      try {
          cx.setOptimizationLevel(-1); // must use interpreter mode
          Script script = cx.compileString("myObject.f(3) + 1;",
                  "test source", 1, null);
          cx.executeScriptWithContinuations(script, globalScope);
          fail("Should throw ContinuationPending");
      } catch (ContinuationPending pending) {
View Full Code Here

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

  public void testScriptWithMultipleContinuations() {
      Context cx = Context.enter();
      try {
          cx.setOptimizationLevel(-1); // must use interpreter mode
          Script script = cx.compileString("myObject.f(3) + myObject.g(3) + 2;",
                  "test source", 1, null);
          cx.executeScriptWithContinuations(script, globalScope);
          fail("Should throw ContinuationPending");
      } catch (ContinuationPending pending) {
          try {
View Full Code Here

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

            Script script = scriptCacheMap.get(string);
            if (script == null) {
                Context ctx = Context.enter();
                try {
                    ctx.setOptimizationLevel(-1);
                    script = ctx.compileString(string, "", 0, null);
                } catch (Exception e) {
                    Exceptions.printStackTrace(e);
                } finally {
                    Context.exit();
                }
View Full Code Here

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

    try {
      String scriptContents = FileUtils.readFileToString(new File("/Users/james/IBM/Code/dwb/src/main/webapp/js/build/amd_loader/dojo.js"));
   
      scriptContents = "djConfig = {buildReference: false, packages:[{name:'build', lib:'.', location:'/Users/james/IBM/Code/dwb/src/main/webapp/js/build/bdbuild'}]};" + scriptContents;
     
      Script script = cx.compileString(scriptContents, "testing", 1, null);
   
      String[] test = {
          "load=build",
          "baseUrl=/Users/james/Code/JavaScript/Libraries/DTK/gh/dojo",
          "action=release",
View Full Code Here

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

    // Rhino may throw a number of exceptions due to a variety of the build errors, use generic catch to
    // get details and store for access.
    try {
      String moduleLoaderScript = readModuleLoaderSource();     
      Script moduleLoader = cx.compileString(moduleLoaderScript, "moduleLoader", 1, null);
     
      // Pretend these arguments came from the command line by stuffing them into the top context,
      // module loader expects to read them from here.
      ScriptableObject.putConstProperty(topScope, "arguments", getBuildScriptArguments());
     
View Full Code Here

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

            if (cl != null) {
     // TODO: broken with the way the tuscany launcher now uses class loaders
     //           cx.setApplicationClassLoader(cl);
            }
            this.scriptScope = new ImporterTopLevel(cx, true);
            Script compiledScript = cx.compileString(scriptCode, fileName, 1, null);
            compiledScript.exec(cx, scriptScope);
            addContexts(scriptScope, context);

        } finally {
            Context.exit();
View Full Code Here

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

                + "myDate.set(Calendar.YEAR, searchyear);\n"
                + "searchwkday.value = myDate.get(Calendar.DAY_OF_WEEK);";
        Script script;
        Context context = factory.enterContext();
        try {
            script = context.compileString(scriptSource, "testScript", 1, null);
            return script;
        } finally {
            Context.exit();
        }
    }
View Full Code Here

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

      }
     
      context.setErrorReporter(new ErrorReporterImpl());
      context.initStandardObjects();
     
      context.compileString(
          new String(HTMLUtil.readStream(file.getContents()), file.getCharset()),
          file.getName(), 1, null);
     
    } catch(EvaluatorException ex){
      // ignore
View Full Code Here

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

  public void testScriptWithContinuations() {
      Context cx = Context.enter();
      try {
          cx.setOptimizationLevel(-1); // must use interpreter mode
          Script script = cx.compileString("myObject.f(3) + 1;",
                  "test source", 1, null);
          cx.executeScriptWithContinuations(script, globalScope);
          fail("Should throw ContinuationPending");
      } catch (ContinuationPending pending) {
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.