[webrtc-pc] pc.setConfiguration() has an input validation order bug (#2688)

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

== pc.setConfiguration() has an input validation order bug ==
The [set a configuration](https://w3c.github.io/webrtc-pc/#set-pc-configuration) algorithm is broken down like this:
- Steps 1-6 are input validation (throw on bad input)
- Steps 7-8 set `iceTransportPolicy` and `iceCandidatePoolSize` directly on the [ICE agent](https://w3c.github.io/webrtc-pc/#dfn-ice-agent)
- Steps 9-10 are more input validation (throw on bad input in `iceServers`)
- Step 11 sets `iceServers` directly on the [ICE agent](https://w3c.github.io/webrtc-pc/#dfn-ice-agent)
- Final step 12 updates [[Configuration]]

This is a bug, because if validation fails in step 10, then the method fails even though things have been partially set, but the [[Configuration]] internal slot is never updated to match what was set.

This appears [untested](https://github.com/web-platform-tests/wpt/blob/8347f5b483/webrtc/RTCConfiguration-iceTransportPolicy.html) but a cursory [check](https://jsfiddle.net/jib1/srqwfdae/) suggests Chrome and Safari are already doing the right thing: do all input validation first.

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


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

Received on Friday, 22 October 2021 19:37:32 UTC