Bug 1070076 - Fix createOffer options arg legacy-syntax-warning to not trip on absent arg. r=jesup, a=sledru
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 19 Sep 2014 15:25:06 -0400
changeset 217936 02eaea5dce76a2ca7ccd4d9f70a29a58c7c2be70
parent 217935 b73f15e656a1991fdbea3e00e779766161252881
child 217937 6cdc428e3e6273403eb90ea0c1b6bac3dfddf469
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, sledru
bugs1070076
milestone33.0
Bug 1070076 - Fix createOffer options arg legacy-syntax-warning to not trip on absent arg. r=jesup, a=sledru
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -553,19 +553,20 @@ RTCPeerConnection.prototype = {
                             get:function()  { return this.getEH(name); },
                             set:function(h) { return this.setEH(name, h); }
                           });
   },
 
   createOffer: function(onSuccess, onError, options) {
 
     // TODO: Remove old constraint-like RTCOptions support soon (Bug 1064223).
+    // Note that webidl bindings make o.mandatory implicit but not o.optional.
     function convertLegacyOptions(o) {
-      if (!(o.mandatory || o.optional) ||
-          Object.keys(o).length != ((o.mandatory && o.optional)? 2 : 1)) {
+      if (!(Object.keys(o.mandatory).length || o.optional) ||
+          Object.keys(o).length != (o.optional? 2 : 1)) {
         return false;
       }
       let old = o.mandatory || {};
       if (o.mandatory) {
         delete o.mandatory;
       }
       if (o.optional) {
         o.optional.forEach(one => {