Examples of enterContext()


Examples of org.mozilla.javascript.ContextFactory.enterContext()

        }
    }

    public void testCustomContextFactory() {
        ContextFactory factory = new MyFactory();
        Context cx = factory.enterContext();
        try {
            Scriptable globalScope = cx.initStandardObjects();
            // Test that FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME is enabled
            /* TODO(stevey): fix this functionality in parser
            Object result = cx.evaluateString(globalScope,
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

    }

    @Test
    public void runDoctest() throws Exception {
        ContextFactory factory = ContextFactory.getGlobal();
        Context cx = factory.enterContext();
        try {
            cx.setOptimizationLevel(optimizationLevel);
            Global global = new Global(cx);
            // global.runDoctest throws an exception on any failure
            int testsPassed = global.runDoctest(cx, global, source, name, 1);
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

        }
    }

    private void baseCase(int optimizationLevel, String source) {
        ContextFactory factory = new MyFactory();
        Context cx = factory.enterContext();
        cx.setOptimizationLevel(optimizationLevel);
        assertTrue(cx instanceof MyContext);
        try {
            Scriptable globalScope = cx.initStandardObjects();
            cx.evaluateString(globalScope,
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

   
    final String scriptCode = "foo.myProp = new Foo2();\n"
      + "foo.myProp = null;";

    final ContextFactory factory = new ContextFactory();
    final Context cx = factory.enterContext();

    try {
          final ScriptableObject topScope = cx.initStandardObjects();
          final Foo foo = new Foo();
 
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

        }
    }

    public void testCustomContextFactory() {
        ContextFactory factory = new MyFactory();
        Context cx = factory.enterContext();
        try {
            Scriptable globalScope = cx.initStandardObjects();
            // Test that FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME is enabled
            Object result = cx.evaluateString(globalScope,
                    "var obj = {};" +
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

    }

    @Test
    public void runDoctest() throws Exception {
        ContextFactory factory = ContextFactory.getGlobal();
        Context cx = factory.enterContext();
        try {
            cx.setOptimizationLevel(optimizationLevel);
            Global global = new Global(cx);
            Scriptable scope = cx.newObject(global);
            scope.setPrototype(global);
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

        }
    }

    private void baseCase(int optimizationLevel) {
        ContextFactory factory = new MyFactory();
        Context cx = factory.enterContext();
        cx.setOptimizationLevel(optimizationLevel);
        assertTrue(cx instanceof MyContext);
        try {
            Scriptable globalScope = cx.initStandardObjects();
            cx.evaluateString(globalScope,
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

      final String reset,
      final String combine
  )
  {
    final ContextFactory contextFactory = ContextFactory.getGlobal();
    Context context = contextFactory.enterContext();
    context.setOptimizationLevel(9);

    final ScriptableObject scope = context.initStandardObjects();

    final Function fnAggregate = context.compileFunction(scope, aggregate, "aggregate", 1, null);
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

      @Override
      public double aggregate(final double current, final ObjectColumnSelector[] selectorList)
      {
        Context cx = Context.getCurrentContext();
        if (cx == null) {
          cx = contextFactory.enterContext();

          // Disable primitive wrapping- we want Java strings and primitives to behave like JS entities.
          cx.getWrapFactory().setJavaPrimitiveWrap(false);
        }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory.enterContext()

public class JavascriptDimExtractionFn implements DimExtractionFn
{
  private static Function<String, String> compile(String function) {
    final ContextFactory contextFactory = ContextFactory.getGlobal();
    final Context context = contextFactory.enterContext();
    context.setOptimizationLevel(9);

    final ScriptableObject scope = context.initStandardObjects();

    final org.mozilla.javascript.Function fn = context.compileFunction(scope, function, "fn", 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.