- From: Christoph Guttandin via GitHub <sysbot+gh@w3.org>
- Date: Thu, 16 May 2024 11:52:47 +0000
- To: public-webrtc@w3.org
chrisguttandin has just created a new issue for https://github.com/w3c/webrtc-pc: == Promises on the operations chain may never settle == Please consider the following example: ```js const peerConnection = new RTCPeerConnection(); peerConnection.createDataChannel('label'); peerConnection .setLocalDescription() .then(() => console.log('resolved'), () => console.log('reject')); peerConnection.close(); ``` It will log nothing in all browsers. The promise just never settles. It seems to be inline with the spec. https://w3c.github.io/webrtc-pc/#chain-an-asynchronous-operation In 7.1. it says "If connection.[[IsClosed]] is true, abort these steps." Maybe it should reject the promise with an `InvalidStateError` instead as it would do when the connection is already closed by the time the promise gets added to the operations chain. The following snippet will invoke the error callback as expected. ```js const peerConnection = new RTCPeerConnection(); peerConnection.createDataChannel('label'); peerConnection.close(); peerConnection .setLocalDescription() .then(() => console.log('resolved'), () => console.log('reject')); ``` The examples are of course very contrived but I can imagine that this behavior is responsible for a lot of difficult to debug memory leaks. Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2973 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 16 May 2024 11:52:48 UTC