Package net.sourceforge.htmlunit.corejs.javascript

Examples of net.sourceforge.htmlunit.corejs.javascript.Function


      logger.log(TreeLogger.ERROR, "function " + methodName
          + " NOT FOUND, thisObj: " + jsThis + ", methodName: " + methodName);
      // TODO: see if this maps to QUIT
      return new ExceptionOrReturnValue(true, new Value(null));
    }
    Function jsFunction = (Function) functionObject;
    logger.log(TreeLogger.SPAM, "INVOKE: jsFunction: " + jsFunction);

    Object jsArgs[] = new Object[args.length];
    for (int i = 0; i < args.length; i++) {
      jsArgs[i] = makeJsvalFromValue(jsContext, args[i]);
View Full Code Here


      logger.log(TreeLogger.ERROR, "function " + methodName
          + " NOT FOUND, thisObj: " + jsThis + ", methodName: " + methodName);
      // TODO: see if this maps to QUIT
      return new ExceptionOrReturnValue(true, new Value(null));
    }
    Function jsFunction = (Function) functionObject;
    logger.log(TreeLogger.SPAM, "INVOKE: jsFunction: " + jsFunction);

    Object jsArgs[] = new Object[args.length];
    for (int i = 0; i < args.length; i++) {
      jsArgs[i] = makeJsvalFromValue(jsContext, args[i]);
View Full Code Here

      logger.log(TreeLogger.ERROR, "function " + methodName
          + " NOT FOUND, thisObj: " + jsThis + ", methodName: " + methodName);
      // TODO: see if this maps to QUIT
      return new ExceptionOrReturnValue(true, new Value(null));
    }
    Function jsFunction = (Function) functionObject;
    if (logger.isLoggable(TreeLogger.SPAM)) {
      logger.log(TreeLogger.SPAM, "INVOKE: jsFunction: " + jsFunction);
    }

    Object jsArgs[] = new Object[args.length];
View Full Code Here

      logger.log(TreeLogger.ERROR, "function " + methodName
          + " NOT FOUND, thisObj: " + jsThis + ", methodName: " + methodName);
      // TODO: see if this maps to QUIT
      return new ExceptionOrReturnValue(true, new Value(null));
    }
    Function jsFunction = (Function) functionObject;
    if (logger.isLoggable(TreeLogger.SPAM)) {
      logger.log(TreeLogger.SPAM, "INVOKE: jsFunction: " + jsFunction);
    }

    Object jsArgs[] = new Object[args.length];
View Full Code Here

      parameters[i] = parseArgumentIntoJavsacriptParameter(args[i]);
    }

    script = "function() {" + script + "};";
    ScriptResult result = page.executeJavaScript(script);
    Function func = (Function) result.getJavaScriptResult();

    result = page.executeJavaScriptFunctionIfPossible(
        func,
        (ScriptableObject) currentWindow.getScriptObject(),
        parameters,
View Full Code Here

        else if (onloadInvoked_) {
            return;
        }
        onloadInvoked_ = true;
        final HtmlPage htmlPage = (HtmlPage) getPage();
        final Function onload = getEventHandler("onload");
        if (onload != null) {
            // An onload handler is defined; we need to download the image and then call the onload handler.
            boolean ok;
            try {
                downloadImageIfNeeded();
View Full Code Here

            final Object [] args,
            final DomNode htmlElement) {

        final Scriptable scope = getScope(htmlPage, htmlElement);

        final Function function = (Function) javaScriptFunction;
        final ContextAction action = new HtmlUnitContextAction(scope, htmlPage) {
            @Override
            public Object doRun(final Context cx) {
                return callFunction(htmlPage, function, cx, scope, (Scriptable) thisObject, args);
            }
View Full Code Here

        try {
            final Object variant = METHOD_getProperty_.invoke(object_, name);
            return wrapIfNecessary(variant);
        }
        catch (final Exception e) {
            return new Function() {
                public Object call(final Context arg0, final Scriptable arg1, final Scriptable arg2,
                    final Object[] arg3) {
                    try {
                        final Object rv = METHOD_callN_.invoke(null, object_, name, arg3);
                        return wrapIfNecessary(rv);
View Full Code Here

            final String s = (String) code;
            final JavaScriptStringJob job = new JavaScriptStringJob(timeout, null, description, w, s);
            id = getWebWindow().getJobManager().addJob(job, page);
        }
        else if (code instanceof Function) {
            final Function f = (Function) code;
            final JavaScriptFunctionJob job = new JavaScriptFunctionJob(timeout, null, description, w, f);
            id = getWebWindow().getJobManager().addJob(job, page);
        }
        else {
            throw Context.reportRuntimeError("Unknown type for function.");
View Full Code Here

     * @param e the error that needs to be reported
     */
    public void triggerOnError(final ScriptException e) {
        final Object o = jsxGet_onerror();
        if (o instanceof Function) {
            final Function f = (Function) o;
            final String msg = e.getMessage();
            final String url = e.getPage().getWebResponse().getRequestSettings().getUrl().toExternalForm();
            final int line = e.getFailingLineNumber();
            final Object[] args = new Object[] {msg, url, line};
            f.call(Context.getCurrentContext(), this, this, args);
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.htmlunit.corejs.javascript.Function

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.