Why is RTCIceCandidate mutable

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=26644

It's strange to me that we should permit RTCIceCandidate being
mutable.  Can anyone explain why this is so?

Having it mutable opens all sorts of strange error cases: particularly
those where candidates are passed to RTCPeerConnection and then
mutated by script after basic sanity checks have been passed.

Here's what I think the definition should look like:

[Constructor(RTCIceCandidateInit init)]
interface RTCIceCandidate {
  readonly attribute DOMString candidate;
  readonly attribute DOMString? sdpMid;
  readonly attribute unsigned short? sdpMLineIndex;
};

Note that the current definition also allows for the init dictionary
to be omitted or empty.  I would prefer that script only be allowed to
create candidates that are basically valid.  Syntax checking might be
deferred, but I see no reason to permit a missing or null candidate
value.

I originally thought that this might be to support the terminal (or
null) candidate on the icecandidate event.  But that relies on the
candidate value in RTCIceCandidateEvent being null.

I plan to include these changes in my pull request for 26644.

Received on Tuesday, 4 November 2014 22:59:30 UTC