private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, final URL url, final String charset) throws FailingHttpStatusCodeException, IOException { final HtmlPage page; if (webWindow instanceof FrameWindow) { final FrameWindow frameWindow = (FrameWindow) webWindow; page = frameWindow.getEnclosingPage(); } else { Page currentPage = webWindow.getEnclosedPage(); if (currentPage == null) { // Starting with a JavaScript URL; quickly fill an "about:blank". currentPage = getPage(webWindow, new WebRequestSettings(WebClient.URL_ABOUT_BLANK)); } page = (HtmlPage) currentPage; } final ScriptResult r = page.executeJavaScriptIfPossible(url.toExternalForm(), "JavaScript URL", 1); if ((r != null && r.getJavaScriptResult() == null) || ScriptResult.isUndefined(r)) { // No new WebResponse to produce. return webWindow.getEnclosedPage().getWebResponse(); } final String contentString = r.getJavaScriptResult().toString(); return new StringWebResponse(contentString, charset, url); }
private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, final URL url, final String charset) throws FailingHttpStatusCodeException, IOException { final HtmlPage page; if (webWindow instanceof FrameWindow) { final FrameWindow frameWindow = (FrameWindow) webWindow; page = frameWindow.getEnclosingPage(); } else { Page currentPage = webWindow.getEnclosedPage(); if (currentPage == null) { // Starting with a JavaScript URL; quickly fill an "about:blank". currentPage = getPage(webWindow, new WebRequestSettings(WebClient.URL_ABOUT_BLANK)); } page = (HtmlPage) currentPage; } final ScriptResult r = page.executeJavaScriptIfPossible(url.toExternalForm(), "JavaScript URL", 1); if ((r != null && r.getJavaScriptResult() == null) || ScriptResult.isUndefined(r)) { // No new WebResponse to produce. return webWindow.getEnclosedPage().getWebResponse(); } final String contentString = r.getJavaScriptResult().toString(); return new StringWebResponse(contentString, charset, url); }
private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, final URL url, final String charset) throws FailingHttpStatusCodeException, IOException { final HtmlPage page; if (webWindow instanceof FrameWindow) { final FrameWindow frameWindow = (FrameWindow) webWindow; page = frameWindow.getEnclosingPage(); } else { Page currentPage = webWindow.getEnclosedPage(); if (currentPage == null) { // Starting with a JavaScript URL; quickly fill an "about:blank". currentPage = getPage(webWindow, new WebRequestSettings(WebClient.URL_ABOUT_BLANK)); } page = (HtmlPage) currentPage; } final ScriptResult r = page.executeJavaScriptIfPossible(url.toExternalForm(), "JavaScript URL", 1); if ((r != null && r.getJavaScriptResult() == null) || ScriptResult.isUndefined(r)) { // No new WebResponse to produce. return webWindow.getEnclosedPage().getWebResponse(); } final String contentString = r.getJavaScriptResult().toString(); return new StringWebResponse(contentString, charset, url); }
private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, final URL url, final Charset charset) throws FailingHttpStatusCodeException, IOException { HtmlPage page = null; if (webWindow instanceof FrameWindow) { final FrameWindow frameWindow = (FrameWindow) webWindow; page = (HtmlPage) frameWindow.getEnclosedPage(); } else { final Page currentPage = webWindow.getEnclosedPage(); if (currentPage instanceof HtmlPage) { page = (HtmlPage) currentPage; } } if (page == null) { page = getPage(webWindow, new WebRequest(WebClient.URL_ABOUT_BLANK)); } final ScriptResult r = page.executeJavaScript(url.toExternalForm(), "JavaScript URL", 1); if (r.getJavaScriptResult() == null || ScriptResult.isUndefined(r)) { // No new WebResponse to produce. return webWindow.getEnclosedPage().getWebResponse(); } final String contentString = r.getJavaScriptResult().toString(); final StringWebResponse response = new StringWebResponse(contentString, charset, url); response.setFromJavascript(true); return response; }
private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, final URL url, final Charset charset) throws FailingHttpStatusCodeException, IOException { HtmlPage page = null; if (webWindow instanceof FrameWindow) { final FrameWindow frameWindow = (FrameWindow) webWindow; page = (HtmlPage) frameWindow.getEnclosedPage(); } else { final Page currentPage = webWindow.getEnclosedPage(); if (currentPage instanceof HtmlPage) { page = (HtmlPage) currentPage; } } if (page == null) { page = getPage(webWindow, new WebRequest(WebClient.URL_ABOUT_BLANK)); } final ScriptResult r = page.executeJavaScript(url.toExternalForm(), "JavaScript URL", 1); if (r.getJavaScriptResult() == null || ScriptResult.isUndefined(r)) { // No new WebResponse to produce. return webWindow.getEnclosedPage().getWebResponse(); } final String contentString = r.getJavaScriptResult().toString(); final StringWebResponse response = new StringWebResponse(contentString, charset, url); response.setFromJavascript(true); return response; }
if (newResult != null && !ScriptResult.isUndefined(newResult)) { jsResult = newResult.getJavaScriptResult();
if (newResult != null && !ScriptResult.isUndefined(newResult)) { jsResult = newResult.getJavaScriptResult();
if (newResult != null && !ScriptResult.isUndefined(newResult)) { jsResult = newResult.getJavaScriptResult();
page.executeJavaScriptFunction(function, thisObject, args, node); if (isPropertyHandler && !ScriptResult.isUndefined(result)) { event.handlePropertyHandlerReturnValue(result.getJavaScriptResult());
page.executeJavaScriptFunction(function, thisObject, args, node); if (isPropertyHandler && !ScriptResult.isUndefined(result)) { event.handlePropertyHandlerReturnValue(result.getJavaScriptResult());