Failed WebTransport sessions report unhandled promise rejections for `closed` and `ready`
Categories
(Core :: DOM: Networking, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: tschuster, Assigned: jesup)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Attachments
(1 external file)
When a WebTransport session fails (for example, the server rejects the connection), Firefox rejects transport.closed and transport.ready without marking them as handled. A page that never attaches a handler to closed therefore gets an "Unhandled rejection" for every failed session.
The spec says these rejections must be marked as handled. The last step of the WebTransport "cleanup" algorithm (https://w3c.github.io/webtransport/#webtransport-cleanup) reads, for the case without closeInfo:
Otherwise:
- Reject closed with error.
- Set closed.[[PromiseIsHandled]] to true.
- Reject ready with error.
- Set ready.[[PromiseIsHandled]] to true.
- Error incomingBidirectionalStreams with error.
In WebTransport::Cleanup (dom/webtransport/api/WebTransport.cpp), the failure branch implements the rejections but skips both [[PromiseIsHandled]] steps:
// 13.1: Reject closed with error
mClosed->MaybeReject(errorValue);
// 13.2: Reject ready with error
mReady->MaybeReject(errorValue);
These are the only places mClosed and mReady are rejected. Every failed session goes through them, including a refused connection: RejectWaitingConnection builds the "WebTransport connection rejected" error and calls Cleanup(error, nullptr, ...).
Suggested fix: call SetSettledPromiseIsHandled() on mClosed and mReady right after rejecting them. The step-number comments in Cleanup no longer match the spec, which has since added steps for datagrams, so they should be updated at the same time.
Test impact: connection-allowlist/tentative/webtransport-document.https.sub.window.js currently ends in a harness ERROR ("Unhandled rejection: WebTransport connection rejected"). Its WebTransport attempts are expected to fail, and it never handles closed. This hides all of its subtest results. https://tests.firefox.dev/test.html?test=testing/web-platform/tests/connection-allowlist/tentative/webtransport-document.https.sub.window.js
| Reporter | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
Also renumber the cleanup step comments to match the current spec, and drop
the harness ERROR expectations the unhandled rejections caused.
| Reporter | ||
Comment 2•1 month ago
|
||
Thanks for working on this. Is this ready to land?
Comment 3•27 days ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 1 week.
:jesup, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•26 days ago
|
Updated•9 days ago
|
Description
•