Package com.gargoylesoftware.htmlunit.javascript

Examples of com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine


    }

    @Override
    protected void setupWebClient() {
        super.setupWebClient();
        webClient.setJavaScriptEngine(new JavaScriptEngine(webClient));
        webClient.setScriptPreProcessor(new UnescapingScriptPreprocessor());
        webClient.setThrowExceptionOnScriptError(true);
        webClient.setAlertHandler(new AlertHandler() {
            public void handleAlert(Page page, String message) {
                fail(message);
View Full Code Here


      }
    }

    protected void setupWebClient(WebClient webClient) {
      if (developmentMode) {
        JavaScriptEngine hostedEngine = new HostedJavaScriptEngine(webClient);
        webClient.setJavaScriptEngine(hostedEngine);
      }
    }
View Full Code Here

      }
    }

    protected void setupWebClient(WebClient webClient) {
      if (developmentMode) {
        JavaScriptEngine hostedEngine = new HostedJavaScriptEngine(webClient);
        webClient.setJavaScriptEngine(hostedEngine);
      }
    }
View Full Code Here

    webClient = fContext.getWebtest().getWebtestCustomizer().customizeWebClient(webClient);
    fContext.setWebClient(webClient);

    // catcher for JS background errors (as long as HtmlUnit doesn't provide a better solution to handle this)
      final Thread mainThread = Thread.currentThread();
        final JavaScriptEngine myEngine = new JavaScriptEngine(webClient) {
            private static final long serialVersionUID = 3410982366939766502L;

            protected void reportJavaScriptException(final ScriptException scriptException) {
        if (Thread.currentThread() != mainThread) {
                fContext.setBackgroundJSError(scriptException);
View Full Code Here

      }
    }

    protected void setupWebClient(WebClient webClient) {
      if (developmentMode) {
        JavaScriptEngine hostedEngine = new HostedJavaScriptEngine(webClient,
            treeLogger);
        webClient.setJavaScriptEngine(hostedEngine);
      }
      if (System.getProperty("gwt.htmlunit.debug") != null) {
        WebClientUtils.attachVisualDebugger(webClient);
View Full Code Here

  }
 
  @Override
  protected void setupWebClient() {
    super.setupWebClient();
    webClient.setJavaScriptEngine(new JavaScriptEngine(webClient));
    webClient.setScriptPreProcessor(new UnescapingScriptPreprocessor());
    webClient.setThrowExceptionOnScriptError(true);
    webClient.setAlertHandler(new AlertHandler() {

      public void handleAlert(Page page, String message) {
View Full Code Here

      }
    }

    protected void setupWebClient(WebClient webClient) {
      if (developmentMode) {
        JavaScriptEngine hostedEngine = new HostedJavaScriptEngine(webClient);
        webClient.setJavaScriptEngine(hostedEngine);
      }
    }
View Full Code Here

        }

        super.setAttributeNS(namespaceURI, qualifiedName, attributeValue);

        if (qualifiedName.equals("src")) {
            final JavaScriptEngine jsEngine = getPage().getWebClient().getJavaScriptEngine();
            // When src is set from a script, loading is postponed until script finishes
            // in fact this implementation is probably wrong: JavaScript URL should be
            // first evaluated and only loading, when any, should be postponed.
            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();
                        }
                    }
                };
                jsEngine.addPostponedAction(action);
            }
        }
    }
View Full Code Here

     *         may not be the same as the original page)
     */
    static Page executeOnChangeHandlerIfAppropriate(final HtmlElement htmlElement) {
        final SgmlPage page = htmlElement.getPage();

        final JavaScriptEngine engine = htmlElement.getPage().getWebClient().getJavaScriptEngine();
        if (engine.isScriptRunning()) {
            return page;
        }
        final ScriptResult scriptResult = htmlElement.fireEvent(Event.TYPE_CHANGE);

        if (page.getWebClient().getWebWindows().contains(page.getEnclosingWindow())) {
View Full Code Here

    private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) {
        homePage_ = "http://htmlunit.sf.net/";
        browserVersion_ = browserVersion;
        proxyConfig_ = proxyConfig;

        scriptEngine_ = new JavaScriptEngine(this);
        // The window must be constructed AFTER the script engine.
        addWebWindowListener(new CurrentWindowTracker());
        currentWindow_ = new TopLevelWindow("", this);
        fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null));
    }
View Full Code Here

TOP

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

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.