Bug 1263312 - Update RTCIceCandidate to spec. draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Tue, 08 Nov 2016 20:22:40 -0500
changeset 448242 78e322a8af8dea468c1fcc35bae0f560193c5307
parent 448241 383de455893c1511918b04c72191893877bd0b5e
child 448243 ce5e540b798312eeb47c24ba71b0494d3ff21be5
child 448384 72950bfb242882930b256b2abac12ade5859bb32
push id38290
push userjbruaroey@mozilla.com
push dateFri, 09 Dec 2016 15:08:21 +0000
bugs1263312
milestone53.0a1
Bug 1263312 - Update RTCIceCandidate to spec. MozReview-Commit-ID: 6S60dAWgZH5
dom/media/PeerConnection.js
dom/webidl/RTCIceCandidate.webidl
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -224,32 +224,28 @@ GlobalPCList.prototype = {
   },
 
   _registerPeerConnectionLifecycleCallback: function(winID, cb) {
     this._lifecycleobservers[winID] = cb;
   },
 };
 var _globalPCList = new GlobalPCList();
 
-function RTCIceCandidate() {
-  this.candidate = this.sdpMid = this.sdpMLineIndex = null;
-}
+function RTCIceCandidate() {}
 RTCIceCandidate.prototype = {
   classDescription: "RTCIceCandidate",
   classID: PC_ICE_CID,
   contractID: PC_ICE_CONTRACT,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
                                          Ci.nsIDOMGlobalPropertyInitializer]),
 
   init: function(win) { this._win = win; },
 
   __init: function(dict) {
-    this.candidate = dict.candidate;
-    this.sdpMid = dict.sdpMid;
-    this.sdpMLineIndex = ("sdpMLineIndex" in dict)? dict.sdpMLineIndex : null;
+    Object.assign(this, dict);
   }
 };
 
 function RTCSessionDescription() {}
 RTCSessionDescription.prototype = {
   classDescription: "RTCSessionDescription",
   classID: PC_SESSION_CID,
   contractID: PC_SESSION_CONTRACT,
--- a/dom/webidl/RTCIceCandidate.webidl
+++ b/dom/webidl/RTCIceCandidate.webidl
@@ -3,23 +3,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCIceCandidate
  */
 
 dictionary RTCIceCandidateInit {
-  DOMString? candidate = null;
+  required DOMString candidate;
   DOMString? sdpMid = null;
-  unsigned short sdpMLineIndex;
+  unsigned short? sdpMLineIndex = null;
 };
 
 [Pref="media.peerconnection.enabled",
  JSImplementation="@mozilla.org/dom/rtcicecandidate;1",
- Constructor(optional RTCIceCandidateInit candidateInitDict)]
+ Constructor(RTCIceCandidateInit candidateInitDict)]
 interface RTCIceCandidate {
-  attribute DOMString?      candidate;
+  attribute DOMString       candidate;
   attribute DOMString?      sdpMid;
   attribute unsigned short? sdpMLineIndex;
 
   jsonifier;
 };