Package com.gargoylesoftware.htmlunit.javascript

Examples of com.gargoylesoftware.htmlunit.javascript.PostponedAction


            if (!jsEngine.isScriptRunning() || attributeValue.startsWith("javascript:")) {
                loadInnerPageIfPossible(attributeValue);
            }
            else {
                final String src = attributeValue;
                final PostponedAction action = new PostponedAction(getPage()) {
                    @Override
                    public void execute() throws Exception {
                        if (getSrcAttribute().equals(src)) {
                            loadInnerPage();
                        }
View Full Code Here


            }
            // If the download was a success, trigger the onload handler.
            if (ok) {
                final Event event = new Event(this, Event.TYPE_LOAD);
                final Node scriptObject = (Node) getScriptObject();
                final PostponedAction action = new PostponedAction(getPage()) {
                    @Override
                    public void execute() throws Exception {
                        scriptObject.executeEvent(event);
                    }
                };
View Full Code Here

            return;
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Script node added: " + asXml());
        }
        final PostponedAction action = new PostponedAction(getPage()) {
            @Override
            public void execute() {
                final boolean ie = getPage().getWebClient().getBrowserVersion().isIE();
                if (ie) {
                    if (!isDeferred()) {
                        if (!getSrcAttribute().equals("//:")) {
                            setAndExecuteReadyState(READY_STATE_LOADING);
                            executeScriptIfNeeded(true);
                            setAndExecuteReadyState(READY_STATE_LOADED);
                        }
                        else {
                            setAndExecuteReadyState(READY_STATE_COMPLETE);
                            executeScriptIfNeeded(true);
                        }
                    }
                }
                else {
                    executeScriptIfNeeded(true);
                }
            }
        };
        if (postponed && getTextContent().length() == 0) {
            final JavaScriptEngine engine = getPage().getWebClient().getJavaScriptEngine();
            engine.addPostponedAction(action);
        }
        else {
            try {
                action.execute();
            }
            catch (final Exception e) {
                if (e instanceof RuntimeException) {
                    throw (RuntimeException) e;
                }
View Full Code Here

    private void scheduleImplicitClose() {
        if (!closePostponedAction_) {
            closePostponedAction_ = true;
            final HtmlPage page = getDomNodeOrDie();
            page.getWebClient().getJavaScriptEngine().addPostponedAction(new PostponedAction(page) {
                @Override
                public void execute() throws Exception {
                    if (writeBuffer_.length() > 0) {
                        jsxFunction_close();
                    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.javascript.PostponedAction

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.