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 216814 02eaea5dce76
parent 216813 b73f15e656a1
child 216815 6cdc428e3e62
push id3922
push userryanvm@gmail.com
push date2014-09-22 17:26 +0000
treeherdermozilla-beta@02eaea5dce76 [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 => {