diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml
index 594e9878e8d..61afd4de5a2 100644
--- a/.github/workflows/checkstyle.yml
+++ b/.github/workflows/checkstyle.yml
@@ -22,12 +22,12 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 21
distribution: 'temurin'
cache: maven
- - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v0.20.1
+ - uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v0.20.1
name: Set up reviewdog
with:
reviewdog_version: latest
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index e0c5c1693ce..50c0767f714 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -24,12 +24,12 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ matrix.Java }}
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: ${{ matrix.Java }}
distribution: 'temurin'
cache: maven
- - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v0.20.1
+ - uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v0.20.1
name: Set up reviewdog
with:
reviewdog_version: latest
diff --git a/.github/workflows/pmd.yml b/.github/workflows/pmd.yml
index b5f1a3d3c9f..8e2105e7af5 100644
--- a/.github/workflows/pmd.yml
+++ b/.github/workflows/pmd.yml
@@ -20,12 +20,12 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
+ uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 21
distribution: 'temurin'
cache: maven
- - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v0.20.1
+ - uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v0.20.1
name: Set up reviewdog
with:
reviewdog_version: latest
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index 562589dacba..3536fd3b400 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -37,7 +37,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
- uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
+ uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
with:
results_file: results.sarif
results_format: sarif
@@ -59,7 +59,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF file
path: results.sarif
diff --git a/README.md b/README.md
index 393e8eea5ae..b61ad1fcc8b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# 
-Version 4.7.0 / November 29, 2024
+Version 4.12.0 / May 17, 2025
:heart: [Sponsor](https://github.com/sponsors/rbri)
@@ -13,11 +13,9 @@ Version 4.7.0 / November 29, 2024
### News
-**[Developer Blog][15]**
+**[Developer Blog](https://htmlunit.github.io/htmlunit-blog/)**
-[HtmlUnit@mastodon][13] | [HtmlUnit@Twitter][3]
-
-[HtmlUnit Kanban Board][6]
+[HtmlUnit@mastodon](https://fosstodon.org/@HtmlUnit) | [HtmlUnit@bsky](https://bsky.app/profile/htmlunit.bsky.social) | [HtmlUnit@Twitter](https://twitter.com/HtmlUnit)
> **Check out HtmlUnit [satellite projects](https://github.com/orgs/HtmlUnit/repositories)**,
such as:
@@ -53,7 +51,7 @@ Add to your `pom.xml`:
P getPage(final WebWindow webWindow, final WebRequest webReques
/**
* Convenient method to build a URL and load it into the current WebWindow as it would be done
* by {@link #getPage(WebWindow, WebRequest)}.
- * @param url the URL of the new content
+ * @param url the URL of the new content; in contrast to real browsers plain file url's are not supported.
+ * You have to use the 'file', 'data', 'blob', 'http' or 'https' protocol.
* @param the page type
* @return the new page
* @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
@@ -523,7 +532,8 @@ public P getPage(final String url) throws IOException, FailingH
/**
* Convenient method to load a URL into the current top WebWindow as it would be done
* by {@link #getPage(WebWindow, WebRequest)}.
- * @param url the URL of the new content
+ * @param url the URL of the new content; in contrast to real browsers plain file url's are not supported.
+ * You have to use the 'file', 'data', 'blob', 'http' or 'https' protocol.
* @param the page type
* @return the new page
* @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
@@ -534,7 +544,6 @@ public P getPage(final URL url) throws IOException, FailingHttp
final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader(),
getBrowserVersion().getAcceptEncodingHeader());
request.setCharset(UTF_8);
-
return getPage(getCurrentWindow().getTopWindow(), request);
}
@@ -589,7 +598,7 @@ public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow w
* @param webResponse the response that will be used to create the new page
* @param webWindow the window that the new page will be placed within
* @param forceAttachmentWithFilename if not {@code null}, handle this as an attachment with the specified name
- * or if an empty string ("") use the filename provided in the response
+ * or if an empty string ("") use the filename provided in the response
* @throws IOException if an IO error occurs
* @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
* {@link WebClientOptions#setThrowExceptionOnFailingStatusCode(boolean)} is set to true
@@ -1539,7 +1548,8 @@ private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, f
* @return the WebResponse
*/
public WebResponse loadWebResponse(final WebRequest webRequest) throws IOException {
- switch (webRequest.getUrl().getProtocol()) {
+ final String protocol = webRequest.getUrl().getProtocol();
+ switch (protocol) {
case UrlUtils.ABOUT:
return makeWebResponseForAboutUrl(webRequest);
@@ -1552,8 +1562,12 @@ public WebResponse loadWebResponse(final WebRequest webRequest) throws IOExcepti
case "blob":
return makeWebResponseForBlobUrl(webRequest);
- default:
+ case "http":
+ case "https":
return loadWebResponseFromWebConnection(webRequest, ALLOWED_REDIRECTIONS_SAME_URL);
+
+ default:
+ throw new IOException("Unsupported protocol '" + protocol + "'");
}
}
@@ -2080,7 +2094,7 @@ public void setClipboardHandler(final ClipboardHandler handler) {
/**
* Returns the current {@link PrintHandler}.
* @return the current {@link PrintHandler} or null if print
- * requests are ignored
+ * requests are ignored
*/
public PrintHandler getPrintHandler() {
return printHandler_;
@@ -2091,7 +2105,7 @@ public PrintHandler getPrintHandler() {
* (Printing Spec).
*
* @param handler the new {@link PrintHandler} or null if you like to
- * ignore print requests (default is null)
+ * ignore print requests (default is null)
*/
public void setPrintHandler(final PrintHandler handler) {
printHandler_ = handler;
@@ -2540,6 +2554,7 @@ private void readObject(final ObjectInputStream in) throws IOException, ClassNot
scriptEngine_ = new JavaScriptEngine(this);
jobManagers_ = Collections.synchronizedList(new ArrayList<>());
loadQueue_ = new ArrayList<>();
+ css3ParserPool_ = new CSS3ParserPool();
}
private static class LoadJob {
@@ -2589,13 +2604,12 @@ public boolean isOutdated() {
* @param target the name of the target window
* @param request the request to perform
* @param checkHash if true check for hashChenage
- * @param forceLoad if true always load the request even if there is already the same in the queue
* @param forceAttachmentWithFilename if not {@code null} the AttachmentHandler isAttachment() method is not called,
- * the response has to be handled as attachment in any case
+ * the response has to be handled as attachment in any case
* @param description information about the origin of the request. Useful for debugging.
*/
public void download(final WebWindow requestingWindow, final String target,
- final WebRequest request, final boolean checkHash, final boolean forceLoad,
+ final WebRequest request, final boolean checkHash,
final String forceAttachmentWithFilename, final String description) {
final WebWindow targetWindow = resolveWindow(requestingWindow, target);
@@ -2632,9 +2646,7 @@ public void download(final WebWindow requestingWindow, final String target,
final WebRequest otherRequest = otherLoadJob.request_;
final URL otherUrl = otherRequest.getUrl();
- // TODO: investigate but it seems that IE considers query string too but not FF
- if (!forceLoad
- && url.getPath().equals(otherUrl.getPath()) // fail fast
+ if (url.getPath().equals(otherUrl.getPath()) // fail fast
&& url.toString().equals(otherUrl.toString())
&& request.getRequestParameters().equals(otherRequest.getRequestParameters())
&& Objects.equals(request.getRequestBody(), otherRequest.getRequestBody())) {
@@ -2863,7 +2875,7 @@ public HtmlPage loadHtmlCodeIntoCurrentWindow(final String htmlCode) throws IOEx
final HtmlPage page = new HtmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(page);
- htmlParser.parse(webResponse, page, false, false);
+ htmlParser.parse(this, webResponse, page, false, false);
return page;
}
@@ -2884,15 +2896,34 @@ public XHtmlPage loadXHtmlCodeIntoCurrentWindow(final String xhtmlCode) throws I
final XHtmlPage page = new XHtmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(page);
- htmlParser.parse(webResponse, page, true, false);
+ htmlParser.parse(this, webResponse, page, true, false);
return page;
}
+ /**
+ * Creates a new {@link WebSocketAdapter}.
+ *
+ * @param webSocketListener the {@link WebSocketListener}
+ * @return a new {@link WebSocketAdapter}
+ */
+ public WebSocketAdapter buildWebSocketAdapter(final WebSocketListener webSocketListener) {
+ return webSocketAdapterFactory_.buildWebSocketAdapter(this, webSocketListener);
+ }
+
+ /**
+ * Defines a new factory method to create a new WebSocketAdapter.
+ *
+ * @param factory a {@link WebSocketAdapterFactory}
+ */
+ public void setWebSocketAdapter(final WebSocketAdapterFactory factory) {
+ webSocketAdapterFactory_ = factory;
+ }
+
/**
* INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. This property is transient (because KeyStore is not serializable)
*
* @param keyStore {@link KeyStore} to use
* @param keyStorePassword the keystore password
@@ -205,6 +209,7 @@ public void setSSLClientCertificateKeyStore(final KeyStore keyStore, final char[
* "sun.security.ssl.allowUnsafeRenegotiation" to true, as hinted in
*
* TLS Renegotiation Issue.
+ * This property is transient (because KeyStore is not serializable)
*
* @param keyStoreUrl the URL which locates the certificate {@link KeyStore}
* @param keyStorePassword the certificate {@link KeyStore} password
@@ -253,6 +258,8 @@ public void setSSLClientCertificateKeyStore(final InputStream keyStoreInputStrea
/**
* Gets the SSLClientCertificateStore.
+ * This property is transient (because KeyStore is not serializable)
+ *
* @return the KeyStore for use on SSL connections
*/
public KeyStore getSSLClientCertificateStore() {
@@ -541,8 +548,8 @@ public String getSSLInsecureProtocol() {
/**
* Sets the SSL server certificate trust store. All server certificates will be validated against
* this trust store.
- *
- * The needed parameters are used to construct a {@link java.security.KeyStore}.
+ * This property is transient (because KeyStore is not serializable)
+ * The needed parameters are used to construct a {@link java.security.KeyStore}.
*
* @param sslTrustStoreUrl the URL which locates the trust store
* @param sslTrustStorePassword the trust store password
@@ -564,6 +571,7 @@ void setSSLTrustStore(final KeyStore keyStore) {
/**
* Gets the SSL TrustStore.
+ * This property is transient (because KeyStore is not serializable)
* @return the SSL TrustStore for insecure SSL connections
*/
public KeyStore getSSLTrustStore() {
@@ -635,8 +643,8 @@ public int getHistoryPageCacheLimit() {
* entries in the history. For older entries only the url is saved; the page
* will be (re)retrieved on demand.
* @param historyPageCacheLimit maximum number of pages to cache in history
- * default is Integer.MAX_VALUE; negative values are having the same effect
- * as setting this to zero.
+ * default is Integer.MAX_VALUE; negative values are having the same effect
+ * as setting this to zero.
*/
public void setHistoryPageCacheLimit(final int historyPageCacheLimit) {
historyPageCacheLimit_ = historyPageCacheLimit;
@@ -720,6 +728,23 @@ public int getScreenHeight() {
return screenHeight_;
}
+ /**
+ * @return the Neko Html parser reader buffer size
+ */
+ public int getNekoReaderBufferSize() {
+ return nekoReaderBufferSize_;
+ }
+
+ /**
+ * Sets the Neko Html parser reader buffer size.
+ *
+ * @param nekoReaderBufferSize the new value
+ */
+ public void setNekoReaderBufferSize(final int nekoReaderBufferSize) {
+ nekoReaderBufferSize_ = nekoReaderBufferSize;
+ }
+
+
/**
* Enables/disables WebSocket support. By default, this property is enabled.
*
@@ -848,7 +873,10 @@ public void setGeolocation(final Geolocation geolocation) {
geolocation_ = geolocation;
}
- public static class Geolocation {
+ /**
+ * Support class for Geolocation.
+ */
+ public static class Geolocation implements Serializable {
private final double accuracy_;
private final double latitude_;
private final double longitude_;
diff --git a/src/main/java/org/htmlunit/WebConnection.java b/src/main/java/org/htmlunit/WebConnection.java
index 758d96744f6..956d3f41f93 100644
--- a/src/main/java/org/htmlunit/WebConnection.java
+++ b/src/main/java/org/htmlunit/WebConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/WebConsole.java b/src/main/java/org/htmlunit/WebConsole.java
index 8d3de6d1b90..1656f3bf7bf 100644
--- a/src/main/java/org/htmlunit/WebConsole.java
+++ b/src/main/java/org/htmlunit/WebConsole.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/WebRequest.java b/src/main/java/org/htmlunit/WebRequest.java
index 2ef4fd3857b..137225f8c17 100644
--- a/src/main/java/org/htmlunit/WebRequest.java
+++ b/src/main/java/org/htmlunit/WebRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,8 +54,12 @@
* @author Lai Quang Duong
* @author Kristof Neirynck
*/
+@SuppressWarnings("PMD.TooManyFields")
public class WebRequest implements Serializable {
+ /**
+ * Enum to configure request creation.
+ */
public enum HttpHint {
/** Force to include the charset. */
IncludeCharsetInContentTypeHeader,
@@ -456,7 +460,7 @@ public String getRequestBody() {
* Other request types result in {@link RuntimeException}.
* Should not be used in combination with {@link #setRequestParameters(List) request parameters}.
* @param requestBody the body content to be submitted if this is a {@code POST}, {@code PUT}
- * or {@code PATCH} request
+ * or {@code PATCH} request
* @throws RuntimeException if the request parameters have already been set
* or this is not a {@code POST}, {@code PUT} or {@code PATCH} request.
*/
@@ -556,17 +560,6 @@ public void setRefererHeader(final URL url) {
}
}
- /**
- * Sets the referer HTTP header - only if the provided url is valid.
- * @param url the url for the referer HTTP header
- *
- * @deprecated as of version 4.5.0; use {@link #setRefererHeader(URL)} instead
- */
- @Deprecated
- public void setRefererlHeader(final URL url) {
- setRefererHeader(url);
- }
-
/**
* Sets the specified name/value pair in the additional HTTP headers.
* @param name the name of the additional HTTP header
@@ -655,6 +648,10 @@ public void setDefaultResponseContentCharset(final Charset defaultResponseConten
this.defaultResponseContentCharset_ = Objects.requireNonNull(defaultResponseContentCharset);
}
+ /**
+ * @param hint the hint to check for
+ * @return true if the hint is enabled
+ */
public boolean hasHint(final HttpHint hint) {
if (httpHints_ == null) {
return false;
@@ -662,6 +659,10 @@ public boolean hasHint(final HttpHint hint) {
return httpHints_.contains(hint);
}
+ /**
+ * Enables the hint.
+ * @param hint the hint to add
+ */
public void addHint(final HttpHint hint) {
if (httpHints_ == null) {
httpHints_ = EnumSet.noneOf(HttpHint.class);
diff --git a/src/main/java/org/htmlunit/WebResponse.java b/src/main/java/org/htmlunit/WebResponse.java
index c54359fd360..4661bde6bb1 100644
--- a/src/main/java/org/htmlunit/WebResponse.java
+++ b/src/main/java/org/htmlunit/WebResponse.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -174,25 +174,6 @@ public Charset getHeaderContentCharset() {
return EncodingSniffer.extractEncodingFromContentType(contentType);
}
- /**
- * Returns the content charset specified explicitly in the header or in the content,
- * or {@code null} if none was specified.
- * @return the content charset specified explicitly in the header or in the content,
- * or {@code null} if none was specified
- *
- * @deprecated as of version 4.0.0; use {@link #getContentCharset()} instead
- */
- @Deprecated
- public Charset getContentCharsetOrNull() {
- try (InputStream is = getContentAsStream()) {
- return EncodingSniffer.sniffEncoding(getResponseHeaders(), is);
- }
- catch (final IOException e) {
- LOG.warn("Error trying to sniff encoding.", e);
- return null;
- }
- }
-
/**
* Returns the content charset for this response, even if no charset was specified explicitly.
*
@@ -257,9 +238,9 @@ public Charset getContentCharset() {
* For example, HTML meta-tag sniffing can be fooled by text that looks-like-a-meta-tag inside
* JavaScript code (false positive) or if the meta-tag is after the first 1024 bytes (false negative).
* @return {@code true} if the charset of the previous call to {@link #getContentCharset()} was
- * "tentative".
+ * "tentative".
* @see
- * https://html.spec.whatwg.org/multipage/parsing.html#concept-encoding-confidence
+ * https://html.spec.whatwg.org/multipage/parsing.html#concept-encoding-confidence
*/
public boolean wasContentCharsetTentative() {
return wasContentCharsetTentative_;
@@ -268,7 +249,7 @@ public boolean wasContentCharsetTentative() {
/**
* Returns the response content as a string, using the charset/encoding specified in the server response.
* @return the response content as a string, using the charset/encoding specified in the server response
- * or null if the content retrieval was failing
+ * or null if the content retrieval was failing
*/
public String getContentAsString() {
return getContentAsString(getContentCharset());
@@ -362,15 +343,6 @@ public void cleanUp() {
}
}
- /**
- * Mark this response for using UTF-8 as default charset.
- * @deprecated as of version 4.0.0; use {@link WebRequest#setDefaultResponseContentCharset(Charset)} instead
- */
- @Deprecated
- public void defaultCharsetUtf8() {
- getWebRequest().setDefaultResponseContentCharset(UTF_8);
- }
-
/**
* @return true if the 2xx
*/
diff --git a/src/main/java/org/htmlunit/WebResponseData.java b/src/main/java/org/htmlunit/WebResponseData.java
index bd9b11f9d5f..6f55e37a4ab 100644
--- a/src/main/java/org/htmlunit/WebResponseData.java
+++ b/src/main/java/org/htmlunit/WebResponseData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -113,7 +113,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
LOG.error("Reading gzip encodec content failed.", e);
stream.close();
stream = IOUtils.toInputStream(
- "\n"
+ "\n"
+ "
+ * Caution: Frames and also iFrames are handled as separate windows. Therefore the listener is also
+ * called for each and every containing (i)Frame when e.g. closing a {@link TopLevelWindow}.
+ * window.confirm()
is invoked.
*
* @author Mike Bowler
+ * @author Ronald Brill
*/
+@FunctionalInterface
public interface ConfirmHandler extends Serializable {
/**
diff --git a/src/main/java/org/htmlunit/CookieManager.java b/src/main/java/org/htmlunit/CookieManager.java
index ce71e3ae66b..063e3c417da 100644
--- a/src/main/java/org/htmlunit/CookieManager.java
+++ b/src/main/java/org/htmlunit/CookieManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/DefaultCredentialsProvider.java b/src/main/java/org/htmlunit/DefaultCredentialsProvider.java
index 59012821abe..b9c3478866e 100644
--- a/src/main/java/org/htmlunit/DefaultCredentialsProvider.java
+++ b/src/main/java/org/htmlunit/DefaultCredentialsProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public class DefaultCredentialsProvider implements CredentialsProvider, Serializ
/** The {@code null} value represents any host. */
public static final String ANY_HOST = null;
- /**The {@code -1} value represents any port. */
+ /** The {@code -1} value represents any port. */
public static final int ANY_PORT = -1;
/** The {@code null} value represents any realm. */
diff --git a/src/main/java/org/htmlunit/DefaultCssErrorHandler.java b/src/main/java/org/htmlunit/DefaultCssErrorHandler.java
index 6cb7c625360..ecbc2bbc23b 100644
--- a/src/main/java/org/htmlunit/DefaultCssErrorHandler.java
+++ b/src/main/java/org/htmlunit/DefaultCssErrorHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/DefaultPageCreator.java b/src/main/java/org/htmlunit/DefaultPageCreator.java
index 1b0f996d933..85aff6db4ca 100644
--- a/src/main/java/org/htmlunit/DefaultPageCreator.java
+++ b/src/main/java/org/htmlunit/DefaultPageCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -297,7 +297,7 @@ protected HtmlPage createHtmlPage(final WebResponse webResponse, final WebWindow
final HtmlPage page = new HtmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(page);
- HTML_PARSER.parse(webResponse, page, false, false);
+ HTML_PARSER.parse(webWindow.getWebClient(), webResponse, page, false, false);
return page;
}
@@ -313,7 +313,7 @@ protected XHtmlPage createXHtmlPage(final WebResponse webResponse, final WebWind
final XHtmlPage page = new XHtmlPage(webResponse, webWindow);
webWindow.setEnclosedPage(page);
- HTML_PARSER.parse(webResponse, page, true, false);
+ HTML_PARSER.parse(webWindow.getWebClient(), webResponse, page, true, false);
return page;
}
diff --git a/src/main/java/org/htmlunit/DialogWindow.java b/src/main/java/org/htmlunit/DialogWindow.java
index 571a691f723..12e5e0ac4a7 100644
--- a/src/main/java/org/htmlunit/DialogWindow.java
+++ b/src/main/java/org/htmlunit/DialogWindow.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/DownloadedContent.java b/src/main/java/org/htmlunit/DownloadedContent.java
index a3654cb8d20..29d6d2443dc 100644
--- a/src/main/java/org/htmlunit/DownloadedContent.java
+++ b/src/main/java/org/htmlunit/DownloadedContent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/ElementNotFoundException.java b/src/main/java/org/htmlunit/ElementNotFoundException.java
index 18341269852..3f178ad5159 100644
--- a/src/main/java/org/htmlunit/ElementNotFoundException.java
+++ b/src/main/java/org/htmlunit/ElementNotFoundException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/FailingHttpStatusCodeException.java b/src/main/java/org/htmlunit/FailingHttpStatusCodeException.java
index 1ccc2ff1089..98b652d6803 100644
--- a/src/main/java/org/htmlunit/FailingHttpStatusCodeException.java
+++ b/src/main/java/org/htmlunit/FailingHttpStatusCodeException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/FormEncodingType.java b/src/main/java/org/htmlunit/FormEncodingType.java
index d395c57c560..1033fef81f5 100644
--- a/src/main/java/org/htmlunit/FormEncodingType.java
+++ b/src/main/java/org/htmlunit/FormEncodingType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/FrameContentHandler.java b/src/main/java/org/htmlunit/FrameContentHandler.java
index 0bde91b58de..90917500cba 100644
--- a/src/main/java/org/htmlunit/FrameContentHandler.java
+++ b/src/main/java/org/htmlunit/FrameContentHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
*
* @author Ronald Brill
*/
+@FunctionalInterface
public interface FrameContentHandler {
/**
diff --git a/src/main/java/org/htmlunit/History.java b/src/main/java/org/htmlunit/History.java
index 6122e714716..15ac7a25907 100644
--- a/src/main/java/org/htmlunit/History.java
+++ b/src/main/java/org/htmlunit/History.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/HttpHeader.java b/src/main/java/org/htmlunit/HttpHeader.java
index d61c962bf34..b71be6f696c 100644
--- a/src/main/java/org/htmlunit/HttpHeader.java
+++ b/src/main/java/org/htmlunit/HttpHeader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/HttpMethod.java b/src/main/java/org/htmlunit/HttpMethod.java
index a77391a2234..36002469782 100644
--- a/src/main/java/org/htmlunit/HttpMethod.java
+++ b/src/main/java/org/htmlunit/HttpMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/HttpWebConnection.java b/src/main/java/org/htmlunit/HttpWebConnection.java
index 7f266d0ebb2..7a15b14943e 100644
--- a/src/main/java/org/htmlunit/HttpWebConnection.java
+++ b/src/main/java/org/htmlunit/HttpWebConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -426,7 +426,8 @@ private static Charset getCharset(final Charset charset, final ListNodeIterator
over the subtree rooted at the
* specified node.
* @param root The node which will be iterated together with its
- * children. The NodeIterator
is initially positioned
- * just before this node. The whatToShow
flags and the
- * filter, if any, are not considered when setting this position. The
- * root must not be null
.
+ * children. The NodeIterator
is initially positioned
+ * just before this node. The whatToShow
flags and the
+ * filter, if any, are not considered when setting this position. The
+ * root must not be null
.
* @param whatToShow This flag specifies which node types may appear in
- * the logical view of the tree presented by the
- * NodeIterator
. See the description of
- * NodeFilter
for the set of possible SHOW_
- * values.These flags can be combined using OR
.
+ * the logical view of the tree presented by the
+ * NodeIterator
. See the description of
+ * NodeFilter
for the set of possible SHOW_
+ * values.These flags can be combined using OR
.
* @param filter The NodeFilter
to be used with this
- * NodeIterator
, or null
to indicate no
- * filter.
+ * NodeIterator
, or null
to indicate no
+ * filter.
* @param entityReferenceExpansion The value of this flag determines
- * whether entity reference nodes are expanded.
+ * whether entity reference nodes are expanded.
* @return The newly created NodeIterator
.
* @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the specified root
is
- * null
.
+ * NOT_SUPPORTED_ERR: Raised if the specified root
is null
.
*/
public DomNodeIterator createNodeIterator(final Node root, final int whatToShow, final NodeFilter filter,
final boolean entityReferenceExpansion) throws DOMException {
diff --git a/src/main/java/org/htmlunit/SilentCssErrorHandler.java b/src/main/java/org/htmlunit/SilentCssErrorHandler.java
index 88d44bf8f9d..c7022d09a81 100644
--- a/src/main/java/org/htmlunit/SilentCssErrorHandler.java
+++ b/src/main/java/org/htmlunit/SilentCssErrorHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/SilentIncorrectnessListener.java b/src/main/java/org/htmlunit/SilentIncorrectnessListener.java
index fe95df873b2..e8e1dfa1995 100644
--- a/src/main/java/org/htmlunit/SilentIncorrectnessListener.java
+++ b/src/main/java/org/htmlunit/SilentIncorrectnessListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/StatusHandler.java b/src/main/java/org/htmlunit/StatusHandler.java
index f1a7a07c8d4..2ea5ff8be5b 100644
--- a/src/main/java/org/htmlunit/StatusHandler.java
+++ b/src/main/java/org/htmlunit/StatusHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/StorageHolder.java b/src/main/java/org/htmlunit/StorageHolder.java
index 73e4e970334..19b917817a7 100644
--- a/src/main/java/org/htmlunit/StorageHolder.java
+++ b/src/main/java/org/htmlunit/StorageHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/StringWebResponse.java b/src/main/java/org/htmlunit/StringWebResponse.java
index 5ac6e4e6464..0f1d0fbd791 100644
--- a/src/main/java/org/htmlunit/StringWebResponse.java
+++ b/src/main/java/org/htmlunit/StringWebResponse.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/TextPage.java b/src/main/java/org/htmlunit/TextPage.java
index fe21deaf77f..1c30e4c721d 100644
--- a/src/main/java/org/htmlunit/TextPage.java
+++ b/src/main/java/org/htmlunit/TextPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/ThreadedRefreshHandler.java b/src/main/java/org/htmlunit/ThreadedRefreshHandler.java
index b2925a38d2a..756f11401e8 100644
--- a/src/main/java/org/htmlunit/ThreadedRefreshHandler.java
+++ b/src/main/java/org/htmlunit/ThreadedRefreshHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/TopLevelWindow.java b/src/main/java/org/htmlunit/TopLevelWindow.java
index 99bf5c5dfa4..178006f2c30 100644
--- a/src/main/java/org/htmlunit/TopLevelWindow.java
+++ b/src/main/java/org/htmlunit/TopLevelWindow.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,7 +115,7 @@ public void close() {
*
* Closes this window.
* @param ignoreOnbeforeunloadAccepted if true the result of triggering the OnbeforeunloadAccepted event
- * will be ignored
+ * will be ignored
*/
public void close(final boolean ignoreOnbeforeunloadAccepted) {
final Page page = getEnclosedPage();
diff --git a/src/main/java/org/htmlunit/UnexpectedPage.java b/src/main/java/org/htmlunit/UnexpectedPage.java
index 2040e4afaf0..faa027e247d 100644
--- a/src/main/java/org/htmlunit/UnexpectedPage.java
+++ b/src/main/java/org/htmlunit/UnexpectedPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/Version.java b/src/main/java/org/htmlunit/Version.java
index d737e259004..dcb6d452021 100644
--- a/src/main/java/org/htmlunit/Version.java
+++ b/src/main/java/org/htmlunit/Version.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,6 +79,6 @@ public static String getProductVersion() {
* @return the copyright notice
*/
public static String getCopyright() {
- return "Copyright (c) 2002-2024 Gargoyle Software Inc. All rights reserved.";
+ return "Copyright (c) 2002-2025 Gargoyle Software Inc. All rights reserved.";
}
}
diff --git a/src/main/java/org/htmlunit/WaitingRefreshHandler.java b/src/main/java/org/htmlunit/WaitingRefreshHandler.java
index 91186fce65b..1d26563b47d 100644
--- a/src/main/java/org/htmlunit/WaitingRefreshHandler.java
+++ b/src/main/java/org/htmlunit/WaitingRefreshHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/WebAssert.java b/src/main/java/org/htmlunit/WebAssert.java
index ceaa25d46fd..612e444cc46 100644
--- a/src/main/java/org/htmlunit/WebAssert.java
+++ b/src/main/java/org/htmlunit/WebAssert.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/WebClient.java b/src/main/java/org/htmlunit/WebClient.java
index 08f92818e53..c17eedc9094 100644
--- a/src/main/java/org/htmlunit/WebClient.java
+++ b/src/main/java/org/htmlunit/WebClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -99,6 +99,10 @@
import org.htmlunit.util.MimeType;
import org.htmlunit.util.NameValuePair;
import org.htmlunit.util.UrlUtils;
+import org.htmlunit.websocket.JettyWebSocketAdapter.JettyWebSocketAdapterFactory;
+import org.htmlunit.websocket.WebSocketAdapter;
+import org.htmlunit.websocket.WebSocketAdapterFactory;
+import org.htmlunit.websocket.WebSocketListener;
import org.htmlunit.webstart.WebStartHandler;
/**
@@ -147,6 +151,7 @@
* @author René Schwietzke
* @author Sven Strickroth
*/
+@SuppressWarnings("PMD.TooManyFields")
public class WebClient implements Serializable, AutoCloseable {
/** Logging support. */
@@ -191,6 +196,7 @@ public class WebClient implements Serializable, AutoCloseable {
private transient WebConnection webConnection_;
private CredentialsProvider credentialsProvider_ = new DefaultCredentialsProvider();
private CookieManager cookieManager_ = new CookieManager();
+ private WebSocketAdapterFactory webSocketAdapterFactory_;
private transient AbstractJavaScriptEngine> scriptEngine_;
private transient List
*
* @return a CSS3Parser that will return to an internal pool for reuse if closed using the
- * try-with-resource concept
+ * try-with-resource concept
*/
public PooledCSS3Parser getCSS3Parser() {
return this.css3ParserPool_.get();
@@ -2919,7 +2950,7 @@ static class CSS3ParserPool {
* Our pool. We only hold data when it is available. In addition, synchronization against
* this deque is cheap.
*/
- private ConcurrentLinkedDequeContent Encoding Error
\n"
@@ -136,7 +136,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
LOG.error("Reading Brotli encodec content failed.", e);
stream.close();
stream = IOUtils.toInputStream(
- "\n"
+ "\n"
+ "Content Encoding Error
\n"
diff --git a/src/main/java/org/htmlunit/WebResponseFromCache.java b/src/main/java/org/htmlunit/WebResponseFromCache.java
index 1354fbaf09f..287d62fe213 100644
--- a/src/main/java/org/htmlunit/WebResponseFromCache.java
+++ b/src/main/java/org/htmlunit/WebResponseFromCache.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/WebWindow.java b/src/main/java/org/htmlunit/WebWindow.java
index b6b44ecb0b0..09612fd7ce4 100644
--- a/src/main/java/org/htmlunit/WebWindow.java
+++ b/src/main/java/org/htmlunit/WebWindow.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,7 +71,7 @@ public interface WebWindow extends Serializable {
* is a top level window, then return this window.
*
* @return the top level window that contains this window or this
- * window if there is no parent.
+ * window if there is no parent.
*/
WebWindow getTopWindow();
@@ -187,15 +187,15 @@ public interface WebWindow extends Serializable {
Screen getScreen();
/**
- * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
- *
+ * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
+ *
* Returns computed style of the element. Computed style represents the final computed values
* of all CSS properties for the element. This method's return value is of the same type as
* that of element.style
, but the value returned by this method is read-only.
*
* @param element the element
* @param pseudoElement a string specifying the pseudo-element to match (may be {@code null});
- * e.g. ':before'
+ * e.g. ':before'
* @return the computed style
*/
ComputedCssStyleDeclaration getComputedStyle(DomElement element, String pseudoElement);
diff --git a/src/main/java/org/htmlunit/WebWindowAdapter.java b/src/main/java/org/htmlunit/WebWindowAdapter.java
index c6f71d85dba..e23da1d128d 100644
--- a/src/main/java/org/htmlunit/WebWindowAdapter.java
+++ b/src/main/java/org/htmlunit/WebWindowAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/WebWindowEvent.java b/src/main/java/org/htmlunit/WebWindowEvent.java
index b1e440081a5..bbe17d7b1dc 100644
--- a/src/main/java/org/htmlunit/WebWindowEvent.java
+++ b/src/main/java/org/htmlunit/WebWindowEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -169,7 +169,9 @@ public String toString() {
return builder.toString();
}
- /** @return the event type */
+ /**
+ * @return the event type
+ */
public int getEventType() {
return type_;
}
diff --git a/src/main/java/org/htmlunit/WebWindowImpl.java b/src/main/java/org/htmlunit/WebWindowImpl.java
index 9d3f4fcb536..0fa11202ca0 100644
--- a/src/main/java/org/htmlunit/WebWindowImpl.java
+++ b/src/main/java/org/htmlunit/WebWindowImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,9 +15,10 @@
package org.htmlunit;
import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_COMPUTED_STYLE_PSEUDO_ACCEPT_WITHOUT_COLON;
-import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_136;
+import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_138;
import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_147;
import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_91;
+import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_93;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -88,8 +89,12 @@ public WebWindowImpl(final WebClient webClient) {
outerHeight_ = innerHeight_ + 91;
outerWidth_ = innerWidth_ + 12;
}
- else if (webClient.getBrowserVersion().hasFeature(JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_136)) {
- outerHeight_ = innerHeight_ + 136;
+ else if (webClient.getBrowserVersion().hasFeature(JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_93)) {
+ outerHeight_ = innerHeight_ + 93;
+ outerWidth_ = innerWidth_ + 16;
+ }
+ else if (webClient.getBrowserVersion().hasFeature(JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_138)) {
+ outerHeight_ = innerHeight_ + 138;
outerWidth_ = innerWidth_ + 24;
}
else if (webClient.getBrowserVersion().hasFeature(JS_WINDOW_OUTER_INNER_HEIGHT_DIFF_147)) {
diff --git a/src/main/java/org/htmlunit/WebWindowListener.java b/src/main/java/org/htmlunit/WebWindowListener.java
index 9c2752ef638..e111fc50c70 100644
--- a/src/main/java/org/htmlunit/WebWindowListener.java
+++ b/src/main/java/org/htmlunit/WebWindowListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,10 @@
* process. This implies, the initial window is already open at the time you attach this listener.
* Therefore you will receive no open event for this.
*
P click(final Event event,
* @param ctrlKey {@code true} if CTRL is pressed
*
* @return true if doClickFireEvent method has to be called later on (to signal,
- * that the value was changed)
+ * that the value was changed)
* @throws IOException if an IO error occurs
*/
protected boolean doClickStateUpdate(final boolean shiftKey, final boolean ctrlKey) throws IOException {
@@ -1184,11 +1203,9 @@ protected boolean doClickStateUpdate(final boolean shiftKey, final boolean ctrlK
}
/**
- * @see #doClickStateUpdate(boolean, boolean)
- * Usually the click is propagated to the parent. Overwrite if you
- * like to disable this.
- *
+ * Usually the click is propagated to the parent. Overwrite if you like to disable this.
* @return true or false
+ * @see #doClickStateUpdate(boolean, boolean)
*/
protected boolean propagateClickStateUpdateToParent() {
return true;
diff --git a/src/main/java/org/htmlunit/html/DomNamespaceNode.java b/src/main/java/org/htmlunit/html/DomNamespaceNode.java
index ebc04fb2fdc..5370245b195 100644
--- a/src/main/java/org/htmlunit/html/DomNamespaceNode.java
+++ b/src/main/java/org/htmlunit/html/DomNamespaceNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/DomNode.java b/src/main/java/org/htmlunit/html/DomNode.java
index 7cd051f2081..bf6b80f8724 100644
--- a/src/main/java/org/htmlunit/html/DomNode.java
+++ b/src/main/java/org/htmlunit/html/DomNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,6 @@
import org.htmlunit.html.serializer.HtmlSerializerVisibleText;
import org.htmlunit.html.xpath.XPathHelper;
import org.htmlunit.javascript.HtmlUnitScriptable;
-import org.htmlunit.javascript.JavaScriptEngine;
import org.htmlunit.javascript.host.event.Event;
import org.htmlunit.xpath.xml.utils.PrefixResolver;
import org.w3c.dom.DOMException;
@@ -208,7 +207,7 @@ public int getStartColumnNumber() {
/**
* Returns the line number in the source page where the DOM node ends.
* @return 0 if no information on the line number is available (for instance for nodes dynamically added),
- * -1 if the end tag has not yet been parsed (during page loading)
+ * -1 if the end tag has not yet been parsed (during page loading)
*/
public int getEndLineNumber() {
return endLineNumber_;
@@ -217,7 +216,7 @@ public int getEndLineNumber() {
/**
* Returns the column number in the source page where the DOM node ends.
* @return 0 if no information on the line number is available (for instance for nodes dynamically added),
- * -1 if the end tag has not yet been parsed (during page loading)
+ * -1 if the end tag has not yet been parsed (during page loading)
*/
public int getEndColumnNumber() {
return endColumnNumber_;
@@ -908,11 +907,11 @@ public
*
- * The following elements support the
+ * The following elements support the Please note: Although this method is public, it is not intended for
* general execution of JavaScript. Users of HtmlUnit should interact with the pages
* as a user would by clicking on buttons or links and having the JavaScript event
- * handlers execute as needed..
+ * handlers execute as needed.
* the page type
* @return the page contained in the current window as returned
- * by {@link org.htmlunit.WebClient#getCurrentWindow()}
+ * by {@link org.htmlunit.WebClient#getCurrentWindow()}
*/
public P setSelectedAttribute(final String optionValue, final boolean isSelected) {
return setSelectedAttribute(optionValue, isSelected, true);
@@ -292,7 +294,7 @@ public P setSelectedAttribute(final String optionValue, final b
* @param invokeOnFocus whether to set focus or not.
* @param the page type
* @return the page contained in the current window as returned
- * by {@link org.htmlunit.WebClient#getCurrentWindow()}
+ * by {@link org.htmlunit.WebClient#getCurrentWindow()}
*/
@SuppressWarnings("unchecked")
public P setSelectedAttribute(final String optionValue,
@@ -319,7 +321,7 @@ public P setSelectedAttribute(final String optionValue,
* @param selectedOption the value of the option that is to change
* @param the page type
* @return the page contained in the current window as returned
- * by {@link org.htmlunit.WebClient#getCurrentWindow()}
+ * by {@link org.htmlunit.WebClient#getCurrentWindow()}
*/
public P setSelectedAttribute(final HtmlOption selectedOption, final boolean isSelected) {
return setSelectedAttribute(selectedOption, isSelected, true, true, false, true);
@@ -341,7 +343,7 @@ public P setSelectedAttribute(final HtmlOption selectedOption,
* @param isClick is mouse clicked
* @param the page type
* @return the page contained in the current window as returned
- * by {@link org.htmlunit.WebClient#getCurrentWindow()}
+ * by {@link org.htmlunit.WebClient#getCurrentWindow()}
*/
@SuppressWarnings("unchecked")
public P setSelectedAttribute(final HtmlOption selectedOption, final boolean isSelected,
diff --git a/src/main/java/org/htmlunit/html/HtmlSelectableTextInput.java b/src/main/java/org/htmlunit/html/HtmlSelectableTextInput.java
index f6aeb79ac85..411df97eef4 100644
--- a/src/main/java/org/htmlunit/html/HtmlSelectableTextInput.java
+++ b/src/main/java/org/htmlunit/html/HtmlSelectableTextInput.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSlot.java b/src/main/java/org/htmlunit/html/HtmlSlot.java
index f2e59524748..0ebc751d2fe 100644
--- a/src/main/java/org/htmlunit/html/HtmlSlot.java
+++ b/src/main/java/org/htmlunit/html/HtmlSlot.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSmall.java b/src/main/java/org/htmlunit/html/HtmlSmall.java
index d7b8bb502e3..a8e2f616292 100644
--- a/src/main/java/org/htmlunit/html/HtmlSmall.java
+++ b/src/main/java/org/htmlunit/html/HtmlSmall.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSource.java b/src/main/java/org/htmlunit/html/HtmlSource.java
index 00ca3280eee..e554dc406f6 100644
--- a/src/main/java/org/htmlunit/html/HtmlSource.java
+++ b/src/main/java/org/htmlunit/html/HtmlSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSpan.java b/src/main/java/org/htmlunit/html/HtmlSpan.java
index f31e6496839..abf2243c018 100644
--- a/src/main/java/org/htmlunit/html/HtmlSpan.java
+++ b/src/main/java/org/htmlunit/html/HtmlSpan.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlStrike.java b/src/main/java/org/htmlunit/html/HtmlStrike.java
index 3c71ce763d0..6e1156424a2 100644
--- a/src/main/java/org/htmlunit/html/HtmlStrike.java
+++ b/src/main/java/org/htmlunit/html/HtmlStrike.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlStrong.java b/src/main/java/org/htmlunit/html/HtmlStrong.java
index a4de4d07819..7266e15bb6d 100644
--- a/src/main/java/org/htmlunit/html/HtmlStrong.java
+++ b/src/main/java/org/htmlunit/html/HtmlStrong.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlStyle.java b/src/main/java/org/htmlunit/html/HtmlStyle.java
index 3bd74f6bf04..d450ea6babc 100644
--- a/src/main/java/org/htmlunit/html/HtmlStyle.java
+++ b/src/main/java/org/htmlunit/html/HtmlStyle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSubmitInput.java b/src/main/java/org/htmlunit/html/HtmlSubmitInput.java
index 052fd7f0786..3c1067d3788 100644
--- a/src/main/java/org/htmlunit/html/HtmlSubmitInput.java
+++ b/src/main/java/org/htmlunit/html/HtmlSubmitInput.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSubscript.java b/src/main/java/org/htmlunit/html/HtmlSubscript.java
index d88c3f4eee9..bbaf6601bc5 100644
--- a/src/main/java/org/htmlunit/html/HtmlSubscript.java
+++ b/src/main/java/org/htmlunit/html/HtmlSubscript.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSummary.java b/src/main/java/org/htmlunit/html/HtmlSummary.java
index 82209589bf3..3bcda51ecf1 100644
--- a/src/main/java/org/htmlunit/html/HtmlSummary.java
+++ b/src/main/java/org/htmlunit/html/HtmlSummary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSuperscript.java b/src/main/java/org/htmlunit/html/HtmlSuperscript.java
index da860d55d68..99887803649 100644
--- a/src/main/java/org/htmlunit/html/HtmlSuperscript.java
+++ b/src/main/java/org/htmlunit/html/HtmlSuperscript.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlSvg.java b/src/main/java/org/htmlunit/html/HtmlSvg.java
index 75fa768d2d8..2d2708dff95 100644
--- a/src/main/java/org/htmlunit/html/HtmlSvg.java
+++ b/src/main/java/org/htmlunit/html/HtmlSvg.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlTable.java b/src/main/java/org/htmlunit/html/HtmlTable.java
index fef6feba237..9d62e33c804 100644
--- a/src/main/java/org/htmlunit/html/HtmlTable.java
+++ b/src/main/java/org/htmlunit/html/HtmlTable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,9 +91,11 @@ public final HtmlTableCell getCellAt(final int rowIndex, final int columnIndex)
return cell;
}
}
- if (cell.getRowSpan() > 1 || cell.getColumnSpan() > 1) {
- for (int i = 0; i < cell.getRowSpan(); i++) {
- for (int j = 0; j < cell.getColumnSpan(); j++) {
+ final int rowSpan = cell.getRowSpan();
+ final int columnSpan = cell.getColumnSpan();
+ if (rowSpan > 1 || columnSpan > 1) {
+ for (int i = 0; i < rowSpan; i++) {
+ for (int j = 0; j < columnSpan; j++) {
occupied.add(new Position(row + i, col + j));
}
}
@@ -235,7 +237,7 @@ public List Cookie Domain Test Cookie Domain Test Cookie Domain Test hello world hello world
+ *
+ * @param returnNullIfFixed if position is 'fixed' return null
+ * @return the offset parent {@link HtmlElement}
+ */
+ public HtmlElement getOffsetParentInternal(final boolean returnNullIfFixed) {
+ if (getParentNode() == null) {
+ return null;
+ }
+
+ final WebWindow webWindow = getPage().getEnclosingWindow();
+ final ComputedCssStyleDeclaration style = webWindow.getComputedStyle(this, null);
+ final String position = style.getPositionWithInheritance();
+
+ if (returnNullIfFixed && FIXED.equals(position)) {
+ return null;
+ }
+
+ final boolean staticPos = STATIC.equals(position);
+
+ DomNode currentElement = this;
+ while (currentElement != null) {
+
+ final DomNode parentNode = currentElement.getParentNode();
+ if (parentNode instanceof HtmlBody
+ || (staticPos && parentNode instanceof HtmlTableDataCell)
+ || (staticPos && parentNode instanceof HtmlTable)) {
+ return (HtmlElement) parentNode;
+ }
+
+ if (parentNode instanceof HtmlElement) {
+ final ComputedCssStyleDeclaration parentStyle =
+ webWindow.getComputedStyle((HtmlElement) parentNode, null);
+ final String parentPosition = parentStyle.getPositionWithInheritance();
+ if (!STATIC.equals(parentPosition)) {
+ return (HtmlElement) parentNode;
+ }
+ }
+
+ currentElement = currentElement.getParentNode();
+ }
+
+ return null;
+ }
+
+ /**
+ * @return this element's top offset, which is the calculated left position of this
+ * element relative to the offsetParent
.
+ */
+ public int getOffsetTop() {
+ if (this instanceof HtmlBody) {
+ return 0;
+ }
+
+ int top = 0;
+
+ // Add the offset for this node.
+ final WebWindow webWindow = getPage().getEnclosingWindow();
+ ComputedCssStyleDeclaration style = webWindow.getComputedStyle(this, null);
+ top += style.getTop(true, false, false);
+
+ // If this node is absolutely positioned, we're done.
+ final String position = style.getPositionWithInheritance();
+ if (ABSOLUTE.equals(position) || FIXED.equals(position)) {
+ return top;
+ }
+
+ final HtmlElement offsetParent = getOffsetParentInternal(false);
+
+ // Add the offset for the ancestor nodes.
+ DomNode parentNode = getParentNode();
+ while (parentNode != null && parentNode != offsetParent) {
+ if (parentNode instanceof HtmlElement) {
+ style = webWindow.getComputedStyle((HtmlElement) parentNode, null);
+ top += style.getTop(false, true, true);
+ }
+ parentNode = parentNode.getParentNode();
+ }
+
+ if (offsetParent != null) {
+ style = webWindow.getComputedStyle(this, null);
+ final boolean thisElementHasTopMargin = style.getMarginTopValue() != 0;
+
+ style = webWindow.getComputedStyle(offsetParent, null);
+ if (!thisElementHasTopMargin) {
+ top += style.getMarginTopValue();
+ }
+ top += style.getPaddingTopValue();
+ }
+
+ return top;
+ }
+
+ /**
+ * @return this element's left offset, which is the calculated left position of this
+ * element relative to the offsetParent
.
+ */
+ public int getOffsetLeft() {
+ if (this instanceof HtmlBody) {
+ return 0;
+ }
+
+ int left = 0;
+
+ // Add the offset for this node.
+ final WebWindow webWindow = getPage().getEnclosingWindow();
+ ComputedCssStyleDeclaration style = webWindow.getComputedStyle(this, null);
+ left += style.getLeft(true, false, false);
+
+ // If this node is absolutely positioned, we're done.
+ final String position = style.getPositionWithInheritance();
+ if (ABSOLUTE.equals(position) || FIXED.equals(position)) {
+ return left;
+ }
+
+ final HtmlElement offsetParent = getOffsetParentInternal(false);
+
+ DomNode parentNode = getParentNode();
+ while (parentNode != null && parentNode != offsetParent) {
+ if (parentNode instanceof HtmlElement) {
+ style = webWindow.getComputedStyle((HtmlElement) parentNode, null);
+ left += style.getLeft(true, true, true);
+ }
+ parentNode = parentNode.getParentNode();
+ }
+
+ if (offsetParent != null) {
+ style = webWindow.getComputedStyle(offsetParent, null);
+ left += style.getMarginLeftValue();
+ left += style.getPaddingLeftValue();
+ }
+
+ return left;
+ }
+
+ /**
+ * Returns this element's X position.
+ * @return this element's X position
+ */
+ public int getPosX() {
+ int cumulativeOffset = 0;
+ final WebWindow webWindow = getPage().getEnclosingWindow();
+
+ HtmlElement element = this;
+ while (element != null) {
+ cumulativeOffset += element.getOffsetLeft();
+ if (element != this) {
+ final ComputedCssStyleDeclaration style =
+ webWindow.getComputedStyle(element, null);
+ cumulativeOffset += style.getBorderLeftValue();
+ }
+ element = element.getOffsetParentInternal(false);
+ }
+
+ return cumulativeOffset;
+ }
+
+ /**
+ * Returns this element's Y position.
+ * @return this element's Y position
+ */
+ public int getPosY() {
+ int cumulativeOffset = 0;
+ final WebWindow webWindow = getPage().getEnclosingWindow();
+
+ HtmlElement element = this;
+ while (element != null) {
+ cumulativeOffset += element.getOffsetTop();
+ if (element != this) {
+ final ComputedCssStyleDeclaration style =
+ webWindow.getComputedStyle(element, null);
+ cumulativeOffset += style.getBorderTopValue();
+ }
+ element = element.getOffsetParentInternal(false);
+ }
+
+ return cumulativeOffset;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/org/htmlunit/html/HtmlEmailInput.java b/src/main/java/org/htmlunit/html/HtmlEmailInput.java
index 8b923b7b920..fb391a50ad0 100644
--- a/src/main/java/org/htmlunit/html/HtmlEmailInput.java
+++ b/src/main/java/org/htmlunit/html/HtmlEmailInput.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlEmbed.java b/src/main/java/org/htmlunit/html/HtmlEmbed.java
index 8f169a736f6..266f942cd50 100644
--- a/src/main/java/org/htmlunit/html/HtmlEmbed.java
+++ b/src/main/java/org/htmlunit/html/HtmlEmbed.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlEmphasis.java b/src/main/java/org/htmlunit/html/HtmlEmphasis.java
index a3d3f495daa..a0ebfd2175b 100644
--- a/src/main/java/org/htmlunit/html/HtmlEmphasis.java
+++ b/src/main/java/org/htmlunit/html/HtmlEmphasis.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlExample.java b/src/main/java/org/htmlunit/html/HtmlExample.java
index 553a3edf2dd..40207710fed 100644
--- a/src/main/java/org/htmlunit/html/HtmlExample.java
+++ b/src/main/java/org/htmlunit/html/HtmlExample.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlFieldSet.java b/src/main/java/org/htmlunit/html/HtmlFieldSet.java
index 25fb285fd16..bfe0cc3fdee 100644
--- a/src/main/java/org/htmlunit/html/HtmlFieldSet.java
+++ b/src/main/java/org/htmlunit/html/HtmlFieldSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlFigure.java b/src/main/java/org/htmlunit/html/HtmlFigure.java
index a45ee383e79..e2aa3446d08 100644
--- a/src/main/java/org/htmlunit/html/HtmlFigure.java
+++ b/src/main/java/org/htmlunit/html/HtmlFigure.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlFigureCaption.java b/src/main/java/org/htmlunit/html/HtmlFigureCaption.java
index 9577c7868a7..8e0485fb7bc 100644
--- a/src/main/java/org/htmlunit/html/HtmlFigureCaption.java
+++ b/src/main/java/org/htmlunit/html/HtmlFigureCaption.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlFileInput.java b/src/main/java/org/htmlunit/html/HtmlFileInput.java
index cb53def554a..5f95299fd61 100644
--- a/src/main/java/org/htmlunit/html/HtmlFileInput.java
+++ b/src/main/java/org/htmlunit/html/HtmlFileInput.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -137,7 +137,7 @@ public void setContentType(final String contentType) {
/**
* Gets the content type that should be sent together with the uploaded file.
* @return the content type, or {@code null} if this has not been explicitly set
- * and should be guessed from file content
+ * and should be guessed from file content
*/
public String getContentType() {
return contentType_;
diff --git a/src/main/java/org/htmlunit/html/HtmlFont.java b/src/main/java/org/htmlunit/html/HtmlFont.java
index 4b2852afcda..cd9df518051 100644
--- a/src/main/java/org/htmlunit/html/HtmlFont.java
+++ b/src/main/java/org/htmlunit/html/HtmlFont.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlFooter.java b/src/main/java/org/htmlunit/html/HtmlFooter.java
index dc9382b9469..f9236d3b898 100644
--- a/src/main/java/org/htmlunit/html/HtmlFooter.java
+++ b/src/main/java/org/htmlunit/html/HtmlFooter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/htmlunit/html/HtmlForm.java b/src/main/java/org/htmlunit/html/HtmlForm.java
index 9ad6cafa176..dd7797388f3 100644
--- a/src/main/java/org/htmlunit/html/HtmlForm.java
+++ b/src/main/java/org/htmlunit/html/HtmlForm.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -191,7 +191,7 @@ && getAttributeDirect(ATTRIBUTE_NOVALIDATE) != ATTRIBUTE_NOT_DEFINED) {
final WebWindow webWindow = htmlPage.getEnclosingWindow();
// Calling form.submit() twice forces double download.
- webClient.download(webWindow, target, request, false, false, null, "JS form.submit()");
+ webClient.download(webWindow, target, request, false, null, "JS form.submit()");
}
/**
@@ -541,36 +541,18 @@ private tabindex
attribute: A, AREA, BUTTON,
- * INPUT, OBJECT, SELECT, and TEXTAREA.tabindex
attribute:
+ * A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA.
*
* @return all the tabbable elements in proper tab order
*/
@@ -908,7 +907,7 @@ public List
*
* @return a list of all styles from this page (<style> and <link rel=stylesheet>).
- * This returns an empty list if css support is disabled in the web client options.
+ * This returns an empty list if css support is disabled in the web client options.
*/
public Listalert(document.cookie)
. */
- public static final String HTML_ALERT_COOKIE
- = HtmlPageTest.STANDARDS_MODE_PREFIX_
+ public static final String HTML_ALERT_COOKIE = DOCTYPE_HTML
+ "\n"
+ "\n"
@@ -303,7 +302,7 @@ public void setCookieExpired() throws Exception {
@Test
@Alerts({"cookies: first=1", "cookies: "})
public void setCookieTimeout() throws Exception {
- final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_
+ final String html = DOCTYPE_HTML
+ "\n"
+ "\n"
- + "";
-
- final URL firstUrl = new URL("http://host1.htmlunit.org:" + PORT + "/");
- getMockWebConnection().setResponse(firstUrl, html);
- loadPage2(html, firstUrl);
-
- loadPage2(HTML_ALERT_COOKIE, firstUrl);
- verifyTitle2(getWebDriver(), getExpectedAlerts());
- }
}
diff --git a/src/test/java/org/htmlunit/DefaultCredentialsProvider2Test.java b/src/test/java/org/htmlunit/DefaultCredentialsProvider2Test.java
index d3a8ff56164..e1b9ab8f10e 100644
--- a/src/test/java/org/htmlunit/DefaultCredentialsProvider2Test.java
+++ b/src/test/java/org/htmlunit/DefaultCredentialsProvider2Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.junit.BrowserRunner;
-import org.htmlunit.junit.BrowserRunner.Alerts;
+import org.htmlunit.junit.annotation.Alerts;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -135,7 +135,7 @@ public void basicAuthentication_singleAuthenticaiton() throws Exception {
@Test
@Alerts("SecRet")
public void basicAuthenticationUserFromUrl() throws Exception {
- final String html = "";
+ final String html = DOCTYPE_HTML + "";
getMockWebConnection().setDefaultResponse(html);
getWebClient().getCredentialsProvider().clear();
@@ -184,7 +184,7 @@ public void basicAuthenticationUserFromUrl() throws Exception {
@Test
@Alerts("SecRet")
public void basicAuthenticationUserFromUrlUsedForNextSteps() throws Exception {
- final String html = "";
+ final String html = DOCTYPE_HTML + "";
getMockWebConnection().setDefaultResponse(html);
getWebClient().getCredentialsProvider().clear();
@@ -248,7 +248,7 @@ public void basicAuthenticationUserFromUrlUsedForNextSteps() throws Exception {
@Test
@Alerts("SecRet")
public void basicAuthenticationUserFromUrlOverwrite() throws Exception {
- final String html = "";
+ final String html = DOCTYPE_HTML + "";
getMockWebConnection().setDefaultResponse(html);
getWebClient().getCredentialsProvider().clear();
@@ -307,7 +307,7 @@ public void basicAuthenticationUserFromUrlOverwrite() throws Exception {
@Test
@Alerts("SecRet")
public void basicAuthenticationUserFromUrlOverwriteDefaultCredentials() throws Exception {
- final String html = "";
+ final String html = DOCTYPE_HTML + "";
getMockWebConnection().setDefaultResponse(html);
getWebClient().getCredentialsProvider().clear();
@@ -333,7 +333,7 @@ public void basicAuthenticationUserFromUrlOverwriteDefaultCredentials() throws E
@Test
@Alerts("SecRet")
public void basicAuthenticationUserFromUrlOverwriteWrongDefaultCredentials() throws Exception {
- final String html = "";
+ final String html = DOCTYPE_HTML + "";
getMockWebConnection().setDefaultResponse(html);
getWebClient().getCredentialsProvider().clear();
@@ -372,7 +372,8 @@ public void basicAuthenticationUserFromUrlOverwriteWrongDefaultCredentials() thr
@Test
@Alerts("Hello World")
public void basicAuthenticationXHR() throws Exception {
- final String html = "";
+ String html = DOCTYPE_HTML
+ + "";
html = "HTTP/1.1 200 OK\r\n"
+ "Content-Length: " + (html.length()) + "\r\n"
+ "Content-Type: text/html\r\n"
@@ -1142,7 +1146,8 @@ public void locationSetHref() throws Exception {
"Sec-Fetch-User: ?1",
"Priority: u=0, i"})
public void locationSetSearch() throws Exception {
- String html = "";
+ String html = DOCTYPE_HTML
+ + "";
html = "HTTP/1.1 200 OK\r\n"
+ "Content-Length: " + (html.length()) + "\r\n"
+ "Content-Type: text/html\r\n"
@@ -1293,7 +1298,8 @@ public void locationSetSearch() throws Exception {
"Sec-Fetch-User: ?1", /* wrong */
"Priority: u=0, i"})
public void loadJavascript() throws Exception {
- String html = " ";
+ String html = DOCTYPE_HTML
+ + " ";
html = "HTTP/1.1 200 OK\r\n"
+ "Content-Length: " + (html.length()) + "\r\n"
+ "Content-Type: text/html\r\n"
@@ -1448,7 +1454,8 @@ public void loadJavascript() throws Exception {
// PrimitiveWebServer
@NotYetImplemented(value = {}, os = OS.Linux)
public void loadJavascriptCharset() throws Exception {
- String html = ""
+ String html = DOCTYPE_HTML
+ + ""
+ ""
+ ""
+ "";
diff --git a/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLTest.java b/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLTest.java
index cc622a7edbd..b62022bb4f9 100644
--- a/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLTest.java
+++ b/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLWithClientCertificateTest.java b/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLWithClientCertificateTest.java
index 197fa70a0f4..3c7013da406 100644
--- a/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLWithClientCertificateTest.java
+++ b/src/test/java/org/htmlunit/HttpWebConnectionInsecureSSLWithClientCertificateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/htmlunit/HttpWebConnectionProxyTest.java b/src/test/java/org/htmlunit/HttpWebConnectionProxyTest.java
index 84236df65dc..df47e09a647 100644
--- a/src/test/java/org/htmlunit/HttpWebConnectionProxyTest.java
+++ b/src/test/java/org/htmlunit/HttpWebConnectionProxyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/htmlunit/HttpWebConnectionTest.java b/src/test/java/org/htmlunit/HttpWebConnectionTest.java
index 9dd4f7a155c..21aec5c549f 100644
--- a/src/test/java/org/htmlunit/HttpWebConnectionTest.java
+++ b/src/test/java/org/htmlunit/HttpWebConnectionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -292,7 +292,8 @@ public void emptyPut() throws Exception {
public static class EmptyPutServlet extends ServletContentWrapper {
/** Constructor. */
public EmptyPutServlet() {
- super("\n"
+ super(DOCTYPE_HTML
+ + "\n"
+ "\n"
+ " \n"
+ "\n"
+ "\n"
diff --git a/src/test/java/org/htmlunit/MiniServer.java b/src/test/java/org/htmlunit/MiniServer.java
index a36cdc8d2ab..5f6e25c1bd5 100644
--- a/src/test/java/org/htmlunit/MiniServer.java
+++ b/src/test/java/org/htmlunit/MiniServer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2024 Gargoyle Software Inc.
+ * Copyright (c) 2002-2025 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,19 +58,35 @@ public class MiniServer extends Thread implements Closeable {
private static final Set