March
HtmlUnit: New Versions and Improvements (March 2025)
Over the past few months, the HtmlUnit team has released several important updates that bring numerous improvements and bug fixes. Here’s an overview of the latest versions and their changes.
Version 4.11.1 (March 26, 2025)
This maintenance version focuses on bug fixes:
- Fixed: NumberFormatException when calculating clientHeight/offsetHeight.
Version 4.11.0 (March 25, 2025)
This extensive version brings support for new browser versions (Chrome/Edge 134, Firefox 136) and numerous improvements:
Improved Browser Compatibility
- Initial support for various font sizes such as ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, ‘xxx-large’, ‘smaller’, and ‘larger’.
- Improved support for CSS variables and their initial values.
JavaScript Engine Improvements
- Major overhaul of the RegExp implementation: switched back to Rhino core implementation, which has made significant progress.
- Support for RegExp lookbehind.
- Implementation of Symbol.match.
- Various fixes for RegExp and String prototypes.
Reduced Dependencies
- Apache Commons-Codec is no longer a runtime dependency.
- Various deprecated methods removed from EncodingSniffer, HttpClientConverter, WebResponse, and WebResponseWrapper.
Event Handling and DOM Improvements
- Various improvements to event initialization, particularly with WebSockets.
- Fix for the ‘onload’ event in Firefox ESR for content not displayed due to CSP.
- Improved style cache to handle all parent elements of added or deleted nodes.
Other Improvements
- HiddenFunctionObject class removed (leftover from the IE era).
- Processing of atob() improved to remove all whitespace from the provided string.
- Script async attribute now correctly ignored when the src attribute is absent.
- onerror event for HtmlImage now triggered for 204 responses.
Version 4.10.0 (February 22, 2025)
This version focused on supporting Chrome/Edge 133, Firefox 135, and especially on correct JavaScript error handling:
JavaScript Engine Optimizations
- Extensive optimizations in the core-js implementation: NativeGlobal, BigInt, Boolean, Number, Map, and Set converted to use lambda functions.
- Function hoisting inside blocks is now a core Rhino feature.
- Improvements to SlotMap handling for faster execution.
Correct Error Types
Numerous classes were revised to throw the correct error types according to specification:
- DOMException received a missing name property.
- Correct error types for HTMLInputElement, SVGMatrix, Crypto, CanvasRenderingContext2D, etc.
- Correct error types for DOM operations like appendChild(), removeChild(), insertBefore().
Important Bug Fixes
- Fixed NPE in JavaScriptEngine.asJavaScriptException().
- Improved implementation of Document.getElementById() without using XPath.
- Fixed HtmlUrlInput value trimming.
- Improved serializability for lambda-based classes.
Other Updates
- Upgraded to Commons-Logging 1.3.5 and Commons-Codec 1.18.0.
- Various code cleanup and performance improvements.
Particularly noteworthy are the improved JavaScript engine and the correct implementation of error types, which increases the reliability of web tests.
For more details on these releases, please visit the official HtmlUnit documentation.
Stay tuned
RBRi
Large parts of this post were generated by Claude 3.7 Sonnet.