Package org.mozilla.javascript

Examples of org.mozilla.javascript.ContextFactory$Listener


            return super.doTopCall(callable, cx, scope, thisObj, args);
        }
    }

    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


        super(classpathReference);
    }

    public void initializeRhino() {

        rhinoContextFactory = new ContextFactory();
        if (System.getProperty("cxf.jsdebug") != null && !rhinoDebuggerUp) {
            Main.mainEmbedded(rhinoContextFactory, rhinoScope, "Debug embedded JavaScript.");
            rhinoDebuggerUp = true;
        }
View Full Code Here

        super(classpathReference);
    }

    public void initializeRhino() {

        rhinoContextFactory = new ContextFactory();
        if (System.getProperty("cxf.jsdebug") != null && !rhinoDebuggerUp) {
            try {
                Class<?> debuggerMain =
                            ClassLoaderUtils.loadClass("org.mozilla.javascript.tools.debugger.Main",
                                                                   getClass());
View Full Code Here

    else
      moduleCompiler = new ScriptCompiler(preludeLoader.getPreludeScope());
  }
 
  private void enableDynamicScope() {
    ContextFactory.initGlobal(new ContextFactory() {
      @Override
      protected boolean hasFeature(Context cx, int featureIndex) {
        if(featureIndex == Context.FEATURE_DYNAMIC_SCOPE)
          return true;
        else
View Full Code Here

            setName("RhinoInterpreterThread");
        }

        @Override
        public void run() {
            ContextFactory contextFactory = new ContextFactory();
            RhinoInterpreter.this.global = new Global();
            RhinoInterpreter.this.global.init(contextFactory);
            RhinoInterpreter.this.cx = contextFactory.enterContext();
            while (!finished) {
                try {
                    ICommand cmd = queue.take();
                    if (cmd instanceof DisposeCommand) {
                        finished = true;
View Full Code Here

        cx.evaluateString(top, script, "script", 0, null);
        return null;
      }
    };

    final ContextFactory contextFactory = new ContextFactory() {
      @Override
      protected boolean hasFeature(final Context cx, final int featureIndex) {
        if (Context.FEATURE_STRICT_MODE == featureIndex) {
          return !acceptWriteReadOnly;
        }
        return super.hasFeature(cx, featureIndex);
      }
    };
    contextFactory.call(action);
  }
View Full Code Here

        return "string[]";
    }

    @Test
    public void callOverloadedFunction() {
        new ContextFactory().call(new ContextAction() {
            public Object run(Context cx) {
                cx.getWrapFactory().setJavaPrimitiveWrap(false);
                Assert.assertEquals("string[]", cx.evaluateString(
                        cx.initStandardObjects(),
                        "new org.mozilla.javascript.tests.Bug496585Test().method('one', 'two', 'three')",
View Full Code Here

        assertTrue("success".equals(result));
        System.out.println("passed");
    }

    public void runJsTests(File[] tests) throws IOException {
        ContextFactory factory = ContextFactory.getGlobal();
        Context cx = factory.enterContext();
        try {
            cx.setOptimizationLevel(this.optimizationLevel);
            Scriptable shared = cx.initStandardObjects();
            for (File f : tests) {
                int length = (int) f.length(); // don't worry about very long
View Full Code Here

  public void testSetNullForScriptableSetter() throws Exception {

    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

  /**
   * Runs the provided action at the given optimization level
   */
  public static void runWithOptimizationLevel(final ContextAction action, final int optimizationLevel)
  {
    runWithOptimizationLevel(new ContextFactory(), action, optimizationLevel);
  }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ContextFactory$Listener

Copyright © 2018 www.massapicom. 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.