Bug 1263312 - Update RTCIceCandidate to spec. r=drno,smaug
☠☠ backed out by a3fe137d4d47 ☠ ☠
authorJan-Ivar Bruaroey <jib@mozilla.com>
Tue, 08 Nov 2016 20:22:40 -0500
changeset 325533 a667af08ffb5326c19321f5128d4b5227a7350aa
parent 325532 5159fd693f92397c8c9622e51a9e7a3475e9153a
child 325534 b311b7e439e868049c07c53d82a759d962aaba2c
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersdrno, smaug
bugs1263312
milestone53.0a1
Bug 1263312 - Update RTCIceCandidate to spec. r=drno,smaug 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;
 };