Examples of enterContext()


Examples of com.sk89q.worldedit.scripting.RhinoContextFactory.enterContext()

    private ScriptEngineFactory factory;
    private Context cx;

    public RhinoScriptEngine() {
        RhinoContextFactory factory = new RhinoContextFactory(3000);
        factory.enterContext();
    }

    @Override
    public Bindings createBindings() {
        return new SimpleBindings();
View Full Code Here

Examples of org.jaggeryjs.scriptengine.engine.RhinoEngine.enterContext()

        RhinoEngine engine = null;
        ServletContext servletContext = request.getServletContext();

        try {
            engine = CommonManager.getInstance().getEngine();
            cx = engine.enterContext();
            String scriptPath = getScriptPath(request);
            OutputStream out = response.getOutputStream();
            context = createJaggeryContext(cx, out, scriptPath, request, response);
            context.addProperty(FileHostObject.JAVASCRIPT_FILE_MANAGER,
                    new WebAppFileManager(request.getServletContext()));
View Full Code Here

Examples of org.jaggeryjs.scriptengine.engine.RhinoEngine.enterContext()

        if (arr != null) {
            try {
                JaggeryContext sharedContext = WebAppManager.sharedJaggeryContext(context.getServletContext());
                CommonManager.setJaggeryContext(sharedContext);
                RhinoEngine engine = sharedContext.getEngine();
                org.mozilla.javascript.Context cx = engine.enterContext();
                ServletContext servletContext = (ServletContext) sharedContext.getProperty(
                        org.jaggeryjs.hostobjects.web.Constants.SERVLET_CONTEXT);

                List<String> jsListeners = new ArrayList<String>();
View Full Code Here

Examples of org.jaggeryjs.scriptengine.engine.RhinoEngine.enterContext()

        if (arr != null) {
            try {
                JaggeryContext sharedContext = WebAppManager.sharedJaggeryContext(context.getServletContext());
                CommonManager.setJaggeryContext(sharedContext);
                RhinoEngine engine = sharedContext.getEngine();
                org.mozilla.javascript.Context cx = engine.enterContext();
                ServletContext servletContext = (ServletContext) sharedContext.getProperty(
                        org.jaggeryjs.hostobjects.web.Constants.SERVLET_CONTEXT);

                List<String> jsListeners = new ArrayList<String>();
View Full Code Here

Examples of org.jaggeryjs.scriptengine.engine.RhinoEngine.enterContext()

        if (arr != null) {
            try {
                JaggeryContext sharedContext = WebAppManager.sharedJaggeryContext(context.getServletContext());
                CommonManager.setJaggeryContext(sharedContext);
                RhinoEngine engine = sharedContext.getEngine();
                org.mozilla.javascript.Context cx = engine.enterContext();
                ServletContext servletContext = (ServletContext) sharedContext.getProperty(
                        org.jaggeryjs.hostobjects.web.Constants.SERVLET_CONTEXT);
                ScriptableObject sharedScope = sharedContext.getScope();

                Object[] scripts = arr.toArray();
View Full Code Here

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

        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

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

    LegacyDataRowWrapper wrapper = null;
    try
    {
      final ContextFactory contextFactory = new ContextFactory();
      final Context context = contextFactory.enterContext();
      final Scriptable scope = context.initStandardObjects();
      wrapper = initializeScope(scope);

      final Object o = context.evaluateString(scope, expression, getName(), 1, null);
      if (o instanceof NativeJavaObject)
View Full Code Here

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

    public double apply(final Object[] args);
  }

  private static Function 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

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

      public double apply(Object[] args)
      {
        // ideally we need a close() function to discard the context once it is not used anymore
        Context cx = Context.getCurrentContext();
        if (cx == null) {
          cx = contextFactory.enterContext();
        }

        return Context.toNumber(fn.call(cx, scope, scope, args));
      }
    };
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
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.