[webrtc-pc] Consider making RTCIceCandidatePair an interface (#2930)

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

== Consider making RTCIceCandidatePair an interface ==
Currently, [RTCIceCandidatePair](https://w3c.github.io/webrtc-pc/#dom-rtcicecandidatepair) is a dictionary containing two interfaces:
```webidl
dictionary RTCIceCandidatePair {
  RTCIceCandidate local;
  RTCIceCandidate remote;
};
```
This seems like a mistake, allowing JS to compose invalid pairs and pass them as inputs.

Valid pairs are [formed](https://w3c.github.io/webrtc-extensions/#dfn-form) exclusively by the ICE Agent, a reality better expressed by a more restrictive contract:
```webidl
[Exposed=Window]
interface RTCIceCandidatePair {
  readonly attribute RTCIceCandidate local;
  readonly attribute RTCIceCandidate remote;
};
```
This would benefit web developers by enforcing an invariant, and spec writers by improved WebIDL type checking, simpler algorithms, and even simpler APIs in the future.

I believe this should be mostly backwards compatible since all APIs that take pairs expect valid ones. cc @sam-vi

I propose we make this change.

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


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

Received on Thursday, 18 January 2024 21:09:19 UTC