I made PR 407, to make the ICE candidate object an interface

Harald and Adam pointed out that RTCIceCandidate needs to be an interface,
not a dictionary, since it's an attribute of RTCPeerConnectionIceEvent.

So, here's a new PR that returns to the "interface with an init dictionary"
pattern: https://github.com/w3c/webrtc-pc/pull/407

A summary of the PR:

   - addIceCandidate now takes a union type of the interface and the init
   dictionary. So legacy code that does "addIceCandidate(new
   RTCIceCandidate({...}));" and new code that does "addIceCandidate({...});"
   should both work.
   - Defined "RTCIceCandidateInit" (like we had before) which contains only
   the candidate, sdpMid and sdpMLineIndex members.
   - RTCIceCandidate becomes an interface, with a constructor that takes an
   RTCIceCandidateInit. This is partly for legacy backwards compatibility, but
   it also lets an application construct an RTCIceCandidate and then inspect
   the new attributes populated.
   - All the members of RTCIceCandidate become readonly attributes. Some of
   them are nullable.

Also, a side-note: I noticed that somewhere along the way, the dictionary
argument of the RTCIceCandidate constructor went from optional to required.
So any code doing the following will no longer work:

var candidate = new RTCIceCandidate();
candidate.candidate = /*...*/;
candidate.sdpMLineIndex = /*...*/;

Is this ok?

Received on Monday, 30 November 2015 18:58:36 UTC