WebDriver is a remote control interface that enables introspection and control of user agents. As such it can help developers to verify that their websites are working and performing well with all major browsers. The protocol is standardized by the W3C and consists of two separate specifications: WebDriver classic (HTTP) and the new WebDriver BiDi (Bi-Directional).
This newsletter gives an overview of the work we’ve done as part of the Firefox 132 release cycle.
Contributions
Firefox – including our WebDriver implementation – is developed as an open source project, and everyone is welcome to contribute. If you ever wanted to contribute to an open source project used by millions of users, or are interested in some experience in software development, jump in.
We are always grateful to receive external contributions, here are the ones which made it in Firefox 132:
- Liam (ldebeasi) refactored our internal logic tracking navigation events to remove a redundant map and simplify the implementation
- Liam (ldebeasi) also improved the signature of one of our internal helpers used to retrieve browsing context details
WebDriver code is written in JavaScript, Python, and Rust so any web developer can contribute! Read how to setup the work environment and check the list of mentored issues for Marionette, or the list of mentored JavaScript bugs for WebDriver BiDi.
WebDriver BiDi
Retry commands to avoid AbortError
failures
In release 132, one of our primary focus areas was enhancing the reliability of command execution.
Internally, we sometimes need to forward commands to content processes. This can easily fail, particularly when targeting a page which was either newly created or in the middle of a navigation. These failures often result in errors such as "AbortError: Actor 'MessageHandlerFrame' destroyed before query 'MessageHandlerFrameParent:sendCommand' was resolved"
.
<- {
"type":"error",
"id":14,
"error":"unknown error",
"message":"AbortError: Actor 'MessageHandlerFrame' destroyed before query 'MessageHandlerFrameParent:sendCommand' was resolved",
"stacktrace":""
}
While there are valid technical reasons that prevent command execution in some cases, there are also many instances where retrying the command is a feasible solution.
The browsingContext.setViewport
command was specifically updated in order to retry an internal command, as it was frequently failing. Then we updated our overall implementation in order to retry commands automatically if we detect that the page is navigating or about to navigate. Note that retrying commands is not entirely new, it’s an internal feature we were already using in a few handpicked commands. The changes in Firefox 132 just made its usage much more prevalent.
New preference: remote.retry-on-abort
To go one step further, we decided to allow all commands to be retried by default when the remote.retry-on-abort
preference is set to true
. Note that true
is the default value, which means that with Firefox 132, all commands which need to reach the content process might now be retried (documentation). If you were previously relying on or working around the aforementioned AbortError
, and notice an unexpected issue with Firefox 132, you can update this preference to make the behavior closer to previous Firefox versions. Please also file a Bug to let us know about the problem.
Bug fixes
- The
browsingContext.contextCreated
event is now correctly emitted for lazy-loaded frames. Previously the event would only be emitted when the iframe actually started loading its content. - Network events are now correctly emitted for cached stylesheet requests.
- Network event timings were previously using the wrong unit and were provided in microseconds. They are now set in milliseconds as expected by the specification.
- The
requestTime
from network event timings should now be more accurate and really match the time where the request actually started. - Fixed a bug where some commands (such as session.subscribe) could fail if a browsing context was not initialized or was being destroyed.
Leave a Reply