Bug 1091290 - Queue addIceCandidate correctly to not overwrite already-queued callbacks. r=bwc
authorJan-Ivar Bruaroey <jib@mozilla.com>
Wed, 29 Oct 2014 19:29:21 -0400
changeset 214709 aa148a97a974f0de780bd43aea5faa6a90f8a7b3
parent 214708 9e3582d234c13280a5fb6677319eb5e5b6bf0f45
child 214710 2db5b82bf663cc22879d5236b51a2c5274f0db61
push id27792
push userkwierso@gmail.com
push dateSat, 08 Nov 2014 01:50:17 +0000
treeherdermozilla-central@eb0d3b3c0b22 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1091290
milestone36.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 1091290 - Queue addIceCandidate correctly to not overwrite already-queued callbacks. r=bwc
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -830,23 +830,28 @@ RTCPeerConnection.prototype = {
       this.logWarning(
           "addIceCandidate called without success/failure callbacks. This is deprecated, and will be an error in the future.",
           null, 0);
     }
     if (!cand.candidate && !cand.sdpMLineIndex) {
       throw new this._win.DOMError("",
           "Invalid candidate passed to addIceCandidate!");
     }
+
+    this._queueOrRun({
+      func: this._addIceCandidate,
+      args: [cand, onSuccess, onError],
+      wait: false
+    });
+  },
+
+  _addIceCandidate: function(cand, onSuccess, onError) {
     this._onAddIceCandidateSuccess = onSuccess || null;
     this._onAddIceCandidateError = onError || null;
 
-    this._queueOrRun({ func: this._addIceCandidate, args: [cand], wait: false });
-  },
-
-  _addIceCandidate: function(cand) {
     this._impl.addIceCandidate(cand.candidate, cand.sdpMid || "",
                                (cand.sdpMLineIndex === null) ? 0 :
                                  cand.sdpMLineIndex + 1);
   },
 
   addStream: function(stream) {
     stream.getTracks().forEach(track => this.addTrack(track, stream));
   },