Examples of initStandardObjects()


Examples of net.sourceforge.htmlunit.corejs.javascript.Context.initStandardObjects()

     */
    public static String evaluate(final String content, final URL url) {
        final Context cx = ContextFactory.getGlobal().enterContext();
        try {
            final ProxyAutoConfig config = new ProxyAutoConfig();
            final Scriptable scope = cx.initStandardObjects();

            config.defineMethod("isPlainHostName", scope);
            config.defineMethod("dnsDomainIs", scope);
            config.defineMethod("localHostOrDomainIs", scope);
            config.defineMethod("isResolvable", scope);
View Full Code Here

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

        String scriptStr = sb.toString();

        Context cx = Context.enter();
        boolean providerFound = false;
        try {
            Scriptable scriptScope = cx.initStandardObjects(null, true);
            Object[] ids = compileScript(cx, scriptStr, scriptScope, f);
            if (ids.length > 0) {
                Service.Mode mode = Service.Mode.PAYLOAD;
                for (Object idObj : ids) {
                    if (!(idObj instanceof String)) {
View Full Code Here

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

    }

    try
    {
      final Context context = Context.enter();
      final Scriptable scope = context.initStandardObjects();
      initializeScope(scope);

      return context.evaluateString(scope, expression, getName(), 1, null);
    }
    finally
View Full Code Here

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

        boolean result = false;

        // now evaluate the condition using JavaScript
        Context cx = Context.enter();
        try {
            Scriptable scope = cx.initStandardObjects(null);
            Object cxResultObject = cx.evaluateString(scope, cond
            /** * conditionString ** */
            , "<cmd>", 1, null);
            resultStr = Context.toString(cxResultObject);

View Full Code Here

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

        String resultStr = "";

        Context cx = Context.enter();
        try {

            Scriptable scope = cx.initStandardObjects(null);

            // Set up some objects for the script to play with
            scope.put("log", scope, log); //$NON-NLS-1$
            scope.put("ctx", scope, jmctx); //$NON-NLS-1$
            scope.put("vars", scope, vars); //$NON-NLS-1$
View Full Code Here

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

  /** Execute supplied code against supplied data,
   *   see JavascriptEngineTest for examples */
  public String execute(String code, String jsonData) throws IOException {
        final String jsCode = "data=" + jsonData + ";\n" + code;
        final Context rhinoContext = Context.enter();
        final ScriptableObject scope = rhinoContext.initStandardObjects();

        // execute the script, out script variable maps to sw
        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw, true);
        ScriptableObject.putProperty(scope, "out", Context.javaToJS(pw, scope));
View Full Code Here

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

        if (rootScope == null) {

            final Context rhinoContext = Context.enter();
            try {

                Scriptable tmpScope = rhinoContext.initStandardObjects(
                    new ImporterTopLevel(), false);

                // default classes
                addHostObjects(tmpScope,
                    (Class<? extends ScriptableObject>[]) HOSTOBJECT_CLASSES);
View Full Code Here

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

        protected SlingWrapFactory wrapFactory;

        @Override
        public ScriptEngine getScriptEngine() {
            final Context rhinoContext = Context.enter();
            Scriptable scope = rhinoContext.initStandardObjects(new ImporterTopLevel(), false);
            return new RhinoJavaScriptEngine(this, scope);
        }

        @Override
        SlingWrapFactory getWrapFactory() {
View Full Code Here

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

        out = System.out;
      else if (sel.equals("System.err"))
        out = System.err;
      Object simStatus = app.find(myUi, "simStatus");
      try {
        ScriptableObject scope = cx.initStandardObjects();
        cx.evaluateString(scope, script, "<cmd>", 1, null);
        if (similarity != null) similarity.destroy();
        similarity = new CustomSimilarity(cx, scope, out);
        app.setCustomSimilarity(similarity);
        app.setString(simStatus, "text", "OK");
View Full Code Here

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

      try {

         context.setOptimizationLevel(-1);
         context.setLanguageVersion(Context.VERSION_1_6);

         Scriptable scope = context.initStandardObjects();

         String script = new StringBuilder(baseScript)
                  .append("lessToCss('")
                  .append(escape(less))
                  .append("');")
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.