Bug 1070076 - fixed createOffer options arg legacy-syntax-warning to not trip on absent arg. r=jesup
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 19 Sep 2014 15:25:06 -0400
changeset 206346 c885916823daea6e3070d5f5425b5dd2de111547
parent 206345 c8510704ccdba2ce7fd2c18c017944cfa39aae37
child 206347 507bdbd98fae3ef5e98b5224f86aaa4e5a5e7391
child 206380 53f7f5b6d7bfd2366721a58cddf92418de41ef20
push id49417
push usercbook@mozilla.com
push dateMon, 22 Sep 2014 07:00:37 +0000
treeherdermozilla-inbound@c885916823da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1070076
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1070076 - fixed createOffer options arg legacy-syntax-warning to not trip on absent arg. r=jesup
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -552,19 +552,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 => {