[webrtc-pc] iceconnectionstatechange event after PeerConnection.close() is called (#2335)

jianjunz has just created a new issue for https://github.com/w3c/webrtc-pc:

== iceconnectionstatechange event after PeerConnection.close() is called ==
When the `close` method of `RTCPeerConnection` is invoked, user agent runs the following steps[1]:

> ...
> 3. Set `connection.[[IsClosed]]` to true. 
> ...
> 11. Set connection's ICE connection state to "closed".
> ...

If I understand correctly, "setting connection's ICE connection state to closed"(step 11) runs the  "update the ICE connection state" process[2].

> 1. If `connection.[[IsClosed]]` is true, abort these steps. (**It's always true**)
> 2. Let `newState` be the value of deriving a new state value as described by the `RTCIceConnectionState` enum.
> 3. If connection's ICE connection state is equal to `newState`, abort these steps.
> 4. Set connection's ice connection state to `newState`.
> 5. Fire an event named `iceconnectionstatechange` at `connection`.

As `connection.[[IsClosed]]` is always true in this case, step 2 to step 5 should not be executed. Does it mean user agent should not fire `iceconnectionstatechange` after `PeerConnection.close()` is called?

My observation is Safari doesn't fire `iceconnectionstatechange` after `PeerConnection.close()`, however, Chrome and Firefox does.

[1] https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-close
[2] https://w3c.github.io/webrtc-pc/#update-the-ice-connection-state

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2335 using your GitHub account

Received on Sunday, 20 October 2019 08:43:57 UTC