Examples of ContextAction


Examples of org.mozilla.javascript.ContextAction

    /**
     * To be used by <code>WindowWrapper</code>.
     */
    void callHandler(final Function handler, final ArgumentsBuilder ab) {
        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                Object[] args = ab.buildArguments();
                handler.call(cx, handler.getParentScope(), globalObject, args);
                return null;
            }
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

      @Override
      public double combine(final double a, final double b)
      {
        final Object res = contextFactory.call(
            new ContextAction()
            {
              @Override
              public Object run(final Context cx)
              {
                return fnCombine.call(cx, scope, scope, new Object[]{a, b});
              }
            }
        );
        return Context.toNumber(res);
      }

      @Override
      public double reset()
      {
        final Object res = contextFactory.call(
            new ContextAction()
            {
              @Override
              public Object run(final Context cx)
              {
                return fnReset.call(cx, scope, scope, new Object[]{});
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

    runScript(importClass + "new PrivateAccessClass(5)");
    runScript(importClass + "new PrivateAccessClass(5, \"foo\")");
  }
 
  private Object runScript(final String scriptSourceText) {
    return this.contextFactory.call(new ContextAction() {
      public Object run(Context context) {
        Script script = context.compileString(scriptSourceText, "", 1, null);
        return script.exec(context, global);
      }
    });
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

    }

    private void testWithTwoScopes(final String scriptScope1,
                                   final String scriptScope2)
    {
      final ContextAction action = new ContextAction()
      {
        public Object run(final Context cx)
        {
              final Scriptable scope1 = cx.initStandardObjects(
                  new MySimpleScriptableObject("scope1"));
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

      myObject.defineFunctionProperties(functionNames, MyObject.class,
          ScriptableObject.EMPTY);

      final String scriptScope1 = "String.prototype.foo = 'from 1'; scope2.f()";

      final ContextAction action = new ContextAction()
      {
          public Object run(final Context cx)
          {
              final Scriptable scope1 = cx.initStandardObjects(
                  new MySimpleScriptableObject("scope1"));
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

              Object[] _args)
          {
            return _args[0].getClass().getName();
          }
        };
    final ContextAction action = new ContextAction()
    {
      public Object run(final Context context)
      {
        final Scriptable scope = context.initStandardObjects();
        scope.put("myObj", scope, f);
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

    doTest("function", action);
  }

  private void testCustomizeTypeOf(final String expected, final Scriptable obj)
  {
    final ContextAction action = new ContextAction()
    {
      public Object run(final Context context)
      {
        final Scriptable scope = context.initStandardObjects();
        scope.put("myObj", scope, obj);
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

    doTest("object", "typeof /foo/;");
  }

  private void doTest(String expected, final String script)
  {
    final ContextAction action = new ContextAction()
    {
      public Object run(final Context context)
      {
        final Scriptable scope = context.initStandardObjects();
        return context.evaluateString(scope, script, "test script", 1, null);
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

    doTest(1, expected, action);
  }

  private void doTest(final int optimizationLevel, final String expected, final ContextAction action)
  {
    Object o = new ContextFactory().call(new ContextAction()
      {
        public Object run(final Context context)
        {
          context.setOptimizationLevel(optimizationLevel);
          return Context.toString(action.run(context));
View Full Code Here

Examples of org.mozilla.javascript.ContextAction

        Context.exit();
    }
  }

  private Object runScript(final String scriptSourceText) {
    return this.contextFactory.call(new ContextAction() {
      public Object run(Context context) {
          return context.evaluateString(global, scriptSourceText,
                  "test source", 1, null);
      }
    });
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.