Examples of defineProperty()


Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

  private <T> T runInContext(
      Context context, Map<String, ?> actuals, Class<T> expectedResultType)
      throws AbnormalExitException {
    ScriptableObject globalScope = context.initStandardObjects();
    try {
      globalScope.defineProperty(
          "scriptEngine___", new ScriptPowerBox(context, globalScope),
          ScriptableObject.DONTENUM);
      Object eval = actuals.remove("eval___");
      ScriptableObject.putProperty(globalScope, "eval___", eval);
      for (Map.Entry<String, ?> e : actuals.entrySet()) {
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

          "scriptEngine___", new ScriptPowerBox(context, globalScope),
          ScriptableObject.DONTENUM);
      Object eval = actuals.remove("eval___");
      ScriptableObject.putProperty(globalScope, "eval___", eval);
      for (Map.Entry<String, ?> e : actuals.entrySet()) {
        globalScope.defineProperty(
            e.getKey(),
            Context.javaToJS(e.getValue(), globalScope),
            ScriptableObject.DONTENUM);
      }
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

    childList.add(childList.size(), text);
  }
 
  protected void postRenderView() throws Exception {
    ScriptableObject scriptableObject = (ScriptableObject) this.page.executeJavaScript("window.LOG").getJavaScriptResult();
    scriptableObject.defineProperty("out", systemOut, ScriptableObject.READONLY);
  }

  private static final ScriptableObject systemOut = new ScriptableObject() {

    /**
 
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

        // This property is weird -- it's a property of the Buffer class, which Rhino doesn't
        // handle through annotations. But we are multi-tenant so it can't be a static. So, the
        // "exported" object, which is a singleton per script, will hold it and we'll use a thread-local to find it.
        ScriptableObject buf = (ScriptableObject)export.get(BufferImpl.CLASS_NAME, export);
        buf.defineProperty("_charsWritten", export, Utils.findMethod(BufferModuleImpl.class, "getCharsWritten"),
                           null, 0);
        // In our implementation, SlowBuffer is exactly the same as buffer
        export.put("SlowBuffer", export, buf);
        return export;
    }
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

      // to make sure new value can be set
      ScriptableObject scriptable = (ScriptableObject) scope;
      if (scriptable.has(name, scriptable))
        scriptable.setAttributes(name, ScriptableObject.EMPTY);
      if (readOnly) {
        scriptable.defineProperty(name, value,
            ScriptableObject.READONLY);
        return prev;
      }
    }
    scope.put(name, scope, value);
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

            options.add("-x");
          }
         
            Scriptable argsObj = cx.newArray(compileScope, options.toArray(new Object[options.size()]));
            //Scriptable argsObj = cx.newArray(compileScope, new Object[] {"-ru", "c.less"});
            compileScope.defineProperty("arguments", argsObj, ScriptableObject.DONTENUM);
           
            // invoke the compiler - we don't pass arguments here because its a script not a real function
            // and we don't care about the result because its written to the output stream (out)
            compiler.call(cx, compileScope, null, new Object[] {});         
         
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

    top.setPrototype(getObjectPrototype(scope));
    top.setParentScope(scope);
    // It's safe to downcast here since initStandardObjects takes
    // a ScriptableObject.
    ScriptableObject global = (ScriptableObject) scope;
    global.defineProperty("Packages", top, ScriptableObject.DONTENUM);
    for (int i = 0; i != TopLevel.topPackages.length; i += 2) {
      String name = TopLevel.topPackages[i];
      if (!name.equals("Packages"))
        global.defineProperty(name, top.get(name, top), ScriptableObject.DONTENUM);
    }
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

    ScriptableObject global = (ScriptableObject) scope;
    global.defineProperty("Packages", top, ScriptableObject.DONTENUM);
    for (int i = 0; i != TopLevel.topPackages.length; i += 2) {
      String name = TopLevel.topPackages[i];
      if (!name.equals("Packages"))
        global.defineProperty(name, top.get(name, top), ScriptableObject.DONTENUM);
    }
  }
}
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

    protected void postRenderView() throws Exception {
        ScriptableObject scriptableObject =
                (ScriptableObject) this.page.executeJavaScript("window.LOG").getJavaScriptResult();

        scriptableObject.defineProperty("out", systemOut, ScriptableObject.READONLY);
    }

    protected HtmlPage renderView(String viewId) throws Exception {
        buildView(viewId);
        preRenderView();
View Full Code Here

Examples of org.mozilla.javascript.ScriptableObject.defineProperty()

  private <T> T runInContext(
      Context context, Map<String, ?> actuals, Class<T> expectedResultType)
      throws AbnormalExitException {
    ScriptableObject globalScope = context.initStandardObjects();
    try {
      globalScope.defineProperty(
          "scriptEngine___", new ScriptPowerBox(context, globalScope),
          ScriptableObject.DONTENUM);
      Object eval = actuals.remove("eval___");
      ScriptableObject.putProperty(globalScope, "eval___", eval);
      for (Map.Entry<String, ?> e : actuals.entrySet()) {
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.