/** * Returns the domain name of the server that served the document, or {@code null} if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ @JsxGetter({CHROME, IE}) public String getDomain() { if (domain_ == null && getPage().getWebResponse() != null) { URL url = getPage().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getUrl(); } else { return null; } } domain_ = url.getHost().toLowerCase(Locale.ROOT); } return domain_; }
/** * Returns the domain name of the server that served the document, or {@code null} if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ @JsxGetter({CHROME, IE}) public String getDomain() { if (domain_ == null && getPage().getWebResponse() != null) { URL url = getPage().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getUrl(); } else { return null; } } domain_ = url.getHost().toLowerCase(Locale.ROOT); } return domain_; }
if (ww instanceof FrameWindow && WebClient.ABOUT_BLANK.equals(getPage().getUrl().toExternalForm())) { final URL enclosingUrl = ((FrameWindow) ww).getEnclosingPage().getUrl(); getPage().getWebResponse().getWebRequest().setUrl(enclosingUrl);
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); }
if (window instanceof FrameWindow && !HtmlPage.READY_STATE_COMPLETE.equals( ((FrameWindow) window).getEnclosingPage().getDocumentElement().getReadyState())) {
if (ww instanceof FrameWindow && WebClient.ABOUT_BLANK.equals(getPage().getUrl().toExternalForm())) { final URL enclosingUrl = ((FrameWindow) ww).getEnclosingPage().getUrl(); getPage().getWebResponse().getWebRequest().setUrl(enclosingUrl);
if (window instanceof FrameWindow && !HtmlPage.READY_STATE_COMPLETE.equals( ((FrameWindow) window).getEnclosingPage().getDocumentElement().getReadyState())) {
if (window instanceof FrameWindow && !HtmlPage.READY_STATE_COMPLETE.equals( ((FrameWindow) window).getEnclosingPage().getDocumentElement().getReadyState())) {
/** * Returns the domain name of the server that served the document, or <tt>null</tt> if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ public String jsxGet_domain() { if (domain_ == null) { URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getWebResponse().getRequestSettings().getUrl(); } else { return null; } } domain_ = url.getHost(); final BrowserVersion browser = getBrowserVersion(); if (browser.isFirefox()) { domain_ = domain_.toLowerCase(); } } return domain_; }
/** * Returns the domain name of the server that served the document, or <tt>null</tt> if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ public String jsxGet_domain() { if (domain_ == null) { URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getWebResponse().getRequestSettings().getUrl(); } else { return null; } } domain_ = url.getHost(); final BrowserVersion browser = getBrowserVersion(); if (browser.isFirefox()) { domain_ = domain_.toLowerCase(); } } return domain_; }
/** * Returns the domain name of the server that served the document, or <tt>null</tt> if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ public String jsxGet_domain() { if (domain_ == null) { URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getWebResponse().getRequestSettings().getUrl(); } else { return null; } } domain_ = url.getHost(); final BrowserVersion browser = getBrowserVersion(); if (browser.isFirefox()) { domain_ = domain_.toLowerCase(); } } return domain_; }
final String enclosingPageState = fw.getEnclosingPage().getDocumentElement().getReadyState(); final URL frameUrl = fw.getEnclosedPage().getUrl(); if (!DomNode.READY_STATE_COMPLETE.equals(enclosingPageState) || frameUrl == URL_ABOUT_BLANK) {
final String enclosingPageState = fw.getEnclosingPage().getDocumentElement().getReadyState(); final URL frameUrl = fw.getEnclosedPage().getUrl(); if (!DomNode.READY_STATE_COMPLETE.equals(enclosingPageState) || frameUrl == URL_ABOUT_BLANK) {