Package org.mozilla.javascript

Examples of org.mozilla.javascript.ContextFactory$GlobalSetter


            }
            stmt.addBatch(query);
        }

        if (callback != null) {
            final ContextFactory factory = cx.getFactory();
            final ExecutorService es = Executors.newSingleThreadExecutor();
            es.submit(new Callable() {
                public Object call() throws Exception {
                    Context ctx = RhinoEngine.enterContext(factory);
                    try {
View Full Code Here


  private Context context;
  private ScriptableObject globalScope;

  @BeforeClass
  public static void classInit() {
      contextFactory = new ContextFactory();
  }
View Full Code Here

    // TODO: consider a cleaner solution
    wrapFactory.engine = this;

    // Produce a ContextFactory that only redirects calls to RhinoEngine,
    // so they can be overridden easily in inherited classes.
    ContextFactory contextFactory = new ContextFactory() {
      protected boolean hasFeature(Context cx, int feature) {
        return RhinoEngine.this.hasFeature(cx,
            feature, super.hasFeature(cx, feature));
      }

      protected Context makeContext() {
        Context context = super.makeContext();
        RhinoEngine.this.enter(context);
        return context;
      }

      protected void observeInstructionCount(Context cx,
          int instructionCount) {
        RhinoEngine.this.observeInstructionCount(cx, instructionCount);
      }
    };

    ContextFactory.initGlobal(contextFactory);

    // The debugger needs to be created before the context, otherwise
    // notification won't work
    String rhinoDebug = System.getProperty("rhino.debug");
    if (rhinoDebug != null) {
      try {
        debugger = new RhinoDebugger(rhinoDebug);
        debugger.start();
        contextFactory.addListener(debugger);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    context = contextFactory.enterContext();
    topLevel = this.makeTopLevel(context);
  }
View Full Code Here

  private Context cx = null;
  private Scriptable scope = null;
  private List<JavascriptRunnerListener> listeners = new Vector<JavascriptRunnerListener>();
 
  public JavascriptRunner() {
    ContextFactory factory = new ContextFactory();
    cx = factory.enterContext();
    scope = cx.initStandardObjects();
  }
View Full Code Here

     * @see org.relaxng.datatype.Datatype#checkValid(java.lang.String, org.relaxng.datatype.ValidationContext)
     */
    public void checkValid(CharSequence literal)
            throws DatatypeException {
        // TODO find out what kind of thread concurrency guarantees are made
        ContextFactory cf = new ContextFactory();
        Context cx = cf.enterContext();
        RegExpImpl rei = new RegExpImpl();
        String anchoredRegex = "^(?:" + literal + ")$";
        try {
            rei.compileRegExp(cx, anchoredRegex, "");
        } catch (EcmaError ee) {
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

TOP

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

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.