@@ -83,19 +83,14 @@ describe('Datachannel send errors', () => {
8383 } )
8484
8585 it ( 'aborts the stream when underlying datachannel is closed mid-send' , async function ( ) {
86- // the state divergence reproduced here is specific to the
87- // node-datachannel polyfill; native browser WebRTC does not exhibit it
86+ // polyfill-specific race; native browser WebRTC doesn't exhibit it
8887 if ( ! isNode && ! isElectronMain ) {
8988 return this . skip ( )
9089 }
9190
92- // open a real datachannel pair so we can trigger the JS-vs-native state
93- // divergence in the node-datachannel polyfill: peerConnection.close()
94- // synchronously closes the native datachannel at the C++ level, but the
95- // polyfill's cached readyState only updates when the onClosed callback
96- // fires on the next event loop tick. Calling send() in that race window
97- // passes the readyState guard and reaches the native binding, which
98- // throws "DataChannel is closed"
91+ // the node-datachannel polyfill's cached readyState updates on the next
92+ // tick after onClosed fires, so closing the peer leaves a window where
93+ // send() passes the guard and hits an already-closed native channel
9994 pcA = new RTCPeerConnection ( )
10095 pcB = new RTCPeerConnection ( )
10196 const channelA = pcA . createDataChannel ( 'test' , { negotiated : true , id : 91 } )
@@ -129,7 +124,6 @@ describe('Datachannel send errors', () => {
129124 log : defaultLogger ( ) . forComponent ( 'test' )
130125 } )
131126
132- // synchronously close the native peer; polyfill readyState is still 'open'
133127 pcA . close ( )
134128 expect ( channelA . readyState ) . to . equal ( 'open' )
135129
0 commit comments