Swallowed errors from session subscribe/unsubscribe (Promise.allSettled)
Categories
(Remote Protocol :: WebDriver BiDi, task)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Unassigned)
Details
The current implementation for session subscribe / unsubscribe uses Promise.allSettled: https://searchfox.org/mozilla-central/rev/c1180ea13e73eb985a49b15c0d90e977a1aa919c/remote/webdriver-bidi/modules/root/session.sys.mjs#70
Promise.allSettled swallows all exceptions unless we explicitly process the array it returns and log something for rejected promises. Subscribing to events in BiDi might lead to create modules, potentially cross process... it will potentially run a lot of code.
For instance, an error in the constructor of the module will be completely ignored by this codepath.
We should either:
- try/catch each promise and log a proper message
- loop over the results from allSettled
const results = await Promise.allSettled(listeners);
for (const result of results) {
if (result.status === "rejected") {
lazy.logger.error("session.subscribe failed", result.reason);
}
}
I would have a slight preference for the first approach because it would allow to easily log which event failed ....
Comment 1•2 years ago
|
||
This issue will be fixed in the scope of bug 1741834.
Description
•