Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e83716d173835cbf698bf91763d63a630776fa4e
      
https://github.com/WebKit/WebKit/commit/e83716d173835cbf698bf91763d63a630776fa4e
  Author: Youenn Fablet <[email protected]>
  Date:   2025-12-22 (Mon, 22 Dec 2025)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-local-close-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-local-close.html
    M Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
    M Source/WebCore/Modules/mediastream/RTCDataChannel.h
    M Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.cpp
    M Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.h
    M Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
    M Source/WebCore/Modules/mediastream/RTCPeerConnection.h
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.cpp
    M Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h
    M Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WebRTC.mm

  Log Message:
  -----------
  RTCDataChannel close event does not fire if RTCPeerConnection closes
rdar://165617848
https://bugs.webkit.org/show_bug.cgi?id=303052

Reviewed by Jean-Yves Avenard.

Since closing the peer connection backend is severing the state updates of the 
data channel backend, we add the logic to close the data channel from 
RTCPeerConnection::close.
For that reason, we keep a list of channel identifiers in RTCPeerConnection.

We then call RTCDataChannelHandlerClient::peerConnectionIsClosing for each of 
this identifier.
This will do the following:
- If the data channel lives in main thread, it will call 
RTCDataChannel::peerConnectionIsClosing() directly.
- If the data channel lives in another process, it will call 
RTCDataChannel::peerConnectionIsClosing() directly.
- If the data channel lives in a worker, it will call 
RTCDataChannel::peerConnectionIsClosing() after hopping to the service worker 
thread.
- If the data channel is being transferred, it will call 
RTCDataChannel::peerConnectionIsClosing() which will make the newly transferred 
data channel moving to closed state.

Covered by added test.

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



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

Reply via email to