Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2d530bfeaa4658acd955ed694afa41d2d1a4aebb
      
https://github.com/WebKit/WebKit/commit/2d530bfeaa4658acd955ed694afa41d2d1a4aebb
  Author: Chris Dumez <[email protected]>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    M 
Source/WebKit/NetworkProcess/webtransport/cocoa/NetworkTransportSessionCocoa.mm
    M 
Source/WebKit/NetworkProcess/webtransport/cocoa/NetworkTransportStreamCocoa.mm

  Log Message:
  -----------
  WebTransport: resolve pending promise when a connection or group is cancelled 
before becoming ready
https://bugs.webkit.org/show_bug.cgi?id=320424

Reviewed by Alex Christensen.

The Network.framework state-changed handlers for a WebTransport stream 
connection and
for the session's connection group treated the terminal 
nw_connection_state_cancelled /
nw_connection_group_state_cancelled transition as a silent return, without 
invoking the
one-shot CompletionHandler they had captured.

When a session or stream is cancelled before it ever reaches the ready state -- 
e.g. the
page calls WebTransport.close() (or creates then tears down a stream) while the 
QUIC
connection is still being established -- terminate() cancels the underlying 
nw_connection /
nw_connection_group, the cancelled state is delivered, and the captured handler 
is never
called. When Network.framework later releases the block, the CompletionHandler 
is destroyed
uncalled: an assertion failure in debug builds, and in release builds a 
never-settled IPC
async reply, leaving the corresponding JS promise (WebTransport.ready,
createBidirectionalStream()) pending until the whole connection is torn down.

Handle the cancelled transition the same way the datagram connection already 
does: resolve
the handler with a failure result. NetworkTransportStream::start calls 
readyHandler(nullopt)
when it is still pending (guarded like the existing failed branch, since 
cancelled can also
fire after ready/failed during normal teardown), which also covers the 
createStream reply
captured inside that handler. NetworkTransportSession::initialize calls
creationCompletionHandler(nullopt), which already self-guards against being 
called twice.

* 
Source/WebKit/NetworkProcess/webtransport/cocoa/NetworkTransportSessionCocoa.mm:
(WebKit::NetworkTransportSession::initialize):
* 
Source/WebKit/NetworkProcess/webtransport/cocoa/NetworkTransportStreamCocoa.mm:
(WebKit::NetworkTransportStream::start):

Canonical link: https://commits.webkit.org/318131@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to