Package org.mozilla.javascript

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


              XmlCursor cur = xo.newCursor();
              while (!cur.isStart()) {
                  if (cur.isEnddoc()) {
                            try {
                                Context cx = Context.enter();
                                return cx.evaluateString
                                    (scope, "<></>", "<script>", 1, null);
                            } finally {
                                Context.exit ();
                            }
                  }
View Full Code Here


      Scriptable proto = jsScope();
      Scriptable scope = cx.newObject (proto);
      scope.setPrototype (proto);
      scope.setParentScope (null);
   
      Object res = cx.evaluateString (scope, script, "<script>", 1, null);
      if (res instanceof Wrapper) {
    res = ((Wrapper)res).unwrap ();
            } else if (res instanceof XMLObject) {
                SAXEventBufferImpl seb = new SAXEventBufferImpl();
                if (((XMLObject)res).getClassName().equals("XMLList")) {
View Full Code Here

         
          this.current = (JSEncogCollection)cx.newObject(scope,"EncogCollection");
          this.current.setCollection(this.currentCollection);
          ScriptableObject.putProperty(scope, "current",this.current);
 
          cx.evaluateString(scope, script.getSource(), script.getName(), 1, null);
 
        } catch(EvaluatorException e) {
          throw new EncogScriptRuntimeError(e);
        } catch(EcmaError e) {
          throw new EncogScriptRuntimeError(e);
View Full Code Here

                scope.put("XSCRIPTCONTEXT", scope, jsCtxt);

                Scriptable jsArgs = Context.toObject(params, scope);
                scope.put("ARGUMENTS", scope, jsArgs);

                result = ctxt.evaluateString(scope,
                        source, "<stdin>", 1, null);
                result = ctxt.toString(result);
        return result;
            }
            catch (JavaScriptException jse) {
View Full Code Here

            // Previously mis-spelt as theadName
            scope.put("threadName", scope, Thread.currentThread().getName()); //$NON-NLS-1$
            scope.put("sampler", scope, currentSampler); //$NON-NLS-1$
            scope.put("sampleResult", scope, previousResult); //$NON-NLS-1$

            Object result = cx.evaluateString(scope, script, "<cmd>", 1, null); //$NON-NLS-1$

            resultStr = Context.toString(result);
            if (varName != null && vars != null) {// vars can be null if run from TestPlan
                vars.put(varName, resultStr);
            }
View Full Code Here

            // Previously mis-spelt as theadName
            scope.put("threadName", scope, Thread.currentThread().getName()); //$NON-NLS-1$
            scope.put("sampler", scope, currentSampler); //$NON-NLS-1$
            scope.put("sampleResult", scope, previousResult); //$NON-NLS-1$

            Object result = cx.evaluateString(scope, script, "<cmd>", 1, null); //$NON-NLS-1$

            resultStr = Context.toString(result);
            if (varName != null && vars != null) {// vars can be null if run from TestPlan
                vars.put(varName, resultStr);
            }
View Full Code Here

        // now evaluate the condition using JavaScript
        Context cx = Context.enter();
        try {
            Scriptable scope = cx.initStandardObjects(null);
            Object cxResultObject = cx.evaluateString(scope, cond
            /** * conditionString ** */
            , "<cmd>", 1, null);
            resultStr = Context.toString(cxResultObject);

            if (resultStr.equals("false")) { //$NON-NLS-1$
View Full Code Here

    globalScope.defineProperty(
        "test_toEscape", ImmutableList.copyOf(toEscape), ScriptableObject.DONTENUM);
    globalScope.defineProperty("test_output", output, ScriptableObject.DONTENUM);

    context.evaluateString(
        globalScope,
        Joiner.on('\n').join(
            "(function () {",
            "  if (typeof goog !== 'undefined') {",
            // Make sure we get the innocuous value from filters and not an exception.
View Full Code Here

        }
      } catch (IOException ex) {
        throw new AssertionError(ex);
      }

      NativeArray outputAsJsList = (NativeArray) context.evaluateString(
          globalScope,
          generatedJsExprsAsJsArray.toString(),
          getClass() + ":" + getName()// File name for JS traces.
          1,
          null);
View Full Code Here

        // now evaluate the condition using JavaScript
        Context cx = Context.enter();
        try {
            Scriptable scope = cx.initStandardObjects(null);
            Object cxResultObject = cx.evaluateString(scope, cond
            /** * conditionString ** */
            , "<cmd>", 1, null);
            resultStr = Context.toString(cxResultObject);

            if (resultStr.equals("false")) { //$NON-NLS-1$
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.