[webrtc-pc] Connection establishment should be "failed" even without candidates (#2698)

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

== Connection establishment should be "failed" even without candidates ==
I tried to detect connection establishment failure by withholding all candidates, while still signaling end-of-candidates. The spec says I should see ["failed"](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-failed) fired: _"The RTCIceTransport has finished gathering, received an indication that there are no more remote candidates, finished checking all candidate pairs, and all pairs have either failed connectivity checks or have lost consent."_

There are zero candidate pairs in this case, which is a 🚩 perhaps, but still passes a pedantic (robot) test: "I have have finished all zero of them", or "there were zero successful pairs with consent", if you will. Zero shoes that fit.

 But none of the browsers appear to fire anything indicating failure. Things just stall. This seems wrong since the UA knows nothing more can happen, but fails to communicate this.

Here's a diff of a [fiddle](https://jsfiddle.net/jib1/uq6pk40r/)'s output in Chrome (which comes closest) compared to what I'd expect according to the spec:
  ice1.state = new
  ice1.gatheringState = new
  ice1.getSelectedCandidatePair() = null
+ ice1.state = gathering
  pc1.iceGatheringState = gathering
  ice2.state = new
  ice2.gatheringState = new
  ice2.getSelectedCandidatePair() = null
+ ice2.state = gathering
  pc2.iceGatheringState = gathering
  ice1.gatheringState = complete
  pc1.iceGatheringState = complete
+ ice1.state = failed
+ pc1.connectionState = failed
+ pc1.iceConnectionState = failed
  ice2.gatheringState = complete
  pc2.iceGatheringState = complete
+ ice2.state = failed
+ pc2.connectionState = failed
+ pc2.iceConnectionState = failed
Importantly, the connection state would have to go directly from "new" to "failed" here, bypassing ["checking"](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-checking) which says: _"The RTCIceTransport has received at least one remote candidate ..."_

But when I look at the [state transition diagram](https://w3c.github.io/webrtc-pc/#fig-non-normative-ice-transport-state-transition-diagram), and there's no arrow from "new" to "failed":

<img width="626" alt="image" src="https://user-images.githubusercontent.com/3136226/142705007-29cb8f6e-098a-4e0e-a811-8cc77f2f6a7d.png">

I think we should draw an arrow, and add some tests.

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 20 November 2021 00:30:43 UTC