Progress in April
HtmlUnit 4.12.0: Upcoming Release Preview
Generated by Claude 3.7 Sonnet on May 10, 2025.
The HtmlUnit team has been hard at work on version 4.12.0, which is scheduled for release in Mai 2025. This upcoming version brings support for Chrome/Edge 135, Firefox 137, significant improvements to the Rhino RegExp implementation, and addresses numerous bugs. Let’s take a look at the impressive work that’s gone into this development cycle.
Browser Compatibility Advancements
Firefox 137 Support
The team has implemented several components to match Firefox 137 behavior:
- Added SVGDiscardElement implementation
- Refined clientHeight calculations for Ruby-related tags
- Improved table cell handling by setting span to zero for invalid values
- Enhanced event handling by correctly typing scroll events as UIEvent
Chrome/Edge 135 Support
Significant effort has gone into keeping pace with Chromium-based browsers:
- Implemented new style properties: ‘interactivity’, ‘overflowBlock’, ‘overflowInline’, and ‘scrollMarkerGroup’
- Enhanced parsing of
<br>
tags within options elements
Cross-Browser Harmonization
The development team has worked to ensure consistent behavior across browsers:
- Implemented uniform setter validation for length style properties
- Enhanced namespace handling for HTML documents sent via XMLHttpRequest
- Corrected font size calculations for ‘smaller’/’larger’ CSS property values
- Expanded CSS blockSize support
JavaScript Engine Transformation
Core Rhino Improvements
Substantial work has gone into upgrading the JavaScript engine:
- Modernized NativeArray implementation with lambda-based architecture
- Fixed Function.prototype[Symbol.hasInstance] implementation
- Addressed regression in hex and unicode hex parsing for RegExp
- Enhanced debugging by adding detailed messages to IndexOutOfBoundsExceptions
- Improved performance with double null check pattern for cache value initialization
- Addressed multiple issues with strict mode handling
RegExp Revolution
One of the most significant areas of development has been the RegExp implementation:
- Complete reimplementation of critical String prototype methods:
- String.prototype.search
- String.prototype.replace
- String.prototype.replaceAll
- String.prototype.split
- Fixed character class parsing regression
- Corrected handling of \x and \u escape sequences in RegExp
- Added support for named capture groups in RegularExpressions
- Implemented numerous code improvements for better RegExp handling
Date Handling Enhancement
The team has improved date string parsing functionality:
- Added support for optional millisecond digits
- Implemented proper handling of missing millisecond values
- Adjusted code to reflect that extended year support is not available in ES6
DOM and Event Handling Refinements
- Enhanced Element.scrollIntoView() to correctly trigger scroll events on all parent elements
- Corrected scroll event behavior to be non-bubbling and non-cancelable
- Fixed DomTokenList.forEach() to properly handle modifications during iteration
- Addressed similar issues in NodeList.forEach() to handle list modifications while iterating
WebSocket Architecture Improvements
A significant refactoring of the WebSocket implementation makes it more flexible:
- Created new WebClient.setWebSocketAdapter(WebSocketAdapterFactory) method to support alternative WebSocket implementations
- Split WebSocketAdapter into separate WebSocketAdapter and WebSocketListener interfaces
- Designed a new WebSocketAdapterFactory interface to simplify integration of different WebSocket implementations
HTML Parser (Neko) Optimization
Several improvements to the Neko HTML parser:
- Streamlined HTMLScanner to always require a document handler
- Fixed HTML1011 error handling for self-closing tags
- Improved robustness by handling whitespace before closing “>” when parsing special tags
- Code cleanup through removal of superfluous conversions
API Modernization
As part of ongoing code quality efforts, several deprecated methods have been removed:
- CssStyleSheet.validateSelectors(SelectorList, int, DomNode)
- HtmlForm.getElements()
- WebRequest.setRefererlHeader(URL)
Developer Experience Improvements
- Enhanced code clarity by marking several interfaces with @FunctionalInterface:
- AlertHandler
- ConfirmHandler
- FrameContentHandler
- CharacterDataChangeListener
- IncorrectnessListener
- Updated Apache commons-io dependency to 2.19.0
This upcoming release demonstrates the HtmlUnit team’s dedication to maintaining a cutting-edge headless browser implementation. The significant JavaScript engine improvements, particularly with RegExp handling, will deliver more accurate JavaScript behavior simulation, while the flexible WebSocket architecture opens the door for customized implementations.
The development team continues to balance browser compatibility with architectural improvements and code quality, making HtmlUnit an increasingly powerful tool for web application testing and automation.
Stay tuned for the official release announcement with the final release date in Mai 2025.
RBRi