Package org.mozilla.javascript

Examples of org.mozilla.javascript.Context.newObject()


            Scriptable parentScope = getParentScope(objectModel);

            // Create a new local scope
            Scriptable scope;
            try {
                scope = ctx.newObject(parentScope);
            } catch (Exception e) {
                // Should normally not happen
                throw new RuntimeException("Cannot create script scope", e);
            }
            scope.setParentScope(parentScope);
View Full Code Here


                // we always add the viewData even it is null (see bug COCOON-1916)
                final Object viewData = FlowHelper.getContextObject(objectModel);
                // Create a new local scope to hold the view data
                final Scriptable newScope;
                try {
                    newScope = ctx.newObject(scope);
                } catch (Exception e) {
                    // Should normally not happen
                    throw new RuntimeException("Cannot create function scope", e);
                }
                newScope.setParentScope(scope);
View Full Code Here

    public DOMSource invoke(DOMSource request) {
        DOMSource response = new DOMSource();
        Context cx = ContextFactory.getGlobal().enterContext();
        try {
            Scriptable scope = cx.newObject(scriptScope);
            scope.setPrototype(scriptScope);
            scope.setParentScope(null);
            Node node = request.getNode();
            Object inDoc = null;
            if (isE4X) {
View Full Code Here

            Object inDoc = null;
            if (isE4X) {
                try {
                    inDoc = Context.toObject(node, scope);
                    Object[] args = {inDoc};
                    inDoc = cx.newObject(scope, "XML", args);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            } else {
                inDoc = Context.toObject(node, scope);
View Full Code Here

            Scriptable parentScope = getParentScope(request);
           
            // Create a new local scope for the event listener variables
            Scriptable scope;
            try {
                scope = ctx.newObject(parentScope);
            } catch (Exception e) {
                // Should normally not happen
                throw new CascadingRuntimeException("Cannont create script scope", e);
            }
           
View Full Code Here

   * @return Compiled HTML Markup(JavaScript Format)
   */
  public String compile(String source, String templateKey) {
    Context context = Context.enter();

    Scriptable compileScope = context.newObject(globalScope);
    compileScope.setParentScope(globalScope);

    compileScope.put("source", compileScope, source);
    compileScope.put("templateKey", compileScope, templateKey);

View Full Code Here

   * @param compiledSource load target HTML Markup
   */
  public void load(String compiledSource) {
    Context context = Context.enter();

    Scriptable compileScope = context.newObject(globalScope);
    compileScope.setParentScope(globalScope);

    compileScope.put("compiledSource", compileScope, compiledSource);

    try {
View Full Code Here

   * @param json
   */
  public void render(Writer writer, String templateKey, String json) {
    Context context = Context.enter();

    Scriptable renderScope = context.newObject(globalScope);
    renderScope.setParentScope(globalScope);

    try {
      renderScope.put("writer", renderScope, writer);
      renderScope.put("json", renderScope, json);
View Full Code Here

    options = new Options(optionArgs);

    Context context = Context.enter();
    try {
      Scriptable compileScope = context.newObject(globalScope);
      compileScope.setParentScope(globalScope);
      compileScope.put("coffeeScriptSource", compileScope, coffeeScriptSource);
      try {

        return (String) context.evaluateString(compileScope, String.format("CoffeeScript.compile(coffeeScriptSource, %s);", options.toJavaScript()),
View Full Code Here

    public DOMSource invoke(DOMSource request) {
        DOMSource response = new DOMSource();
        Context cx = ContextFactory.getGlobal().enterContext();
        try {
            Scriptable scope = cx.newObject(scriptScope);
            scope.setPrototype(scriptScope);
            scope.setParentScope(null);
            Node node = request.getNode();
            Object inDoc = null;
            if (isE4X) {
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.