From e288a72efd36df3047e6d0d316d5821f05d204b8 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Sun, 7 Sep 2014 12:08:49 -0400 Subject: [PATCH] Bug 1063971: Allow SetRemoteDescription to omit callbacks again r=jib --- dom/media/PeerConnection.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 9941ef0b4866..4a3f67b2cf33 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -679,16 +679,19 @@ RTCPeerConnection.prototype = { let idpComplete = false; let setRemoteComplete = false; let idpError = null; + let isDone = false; // we can run the IdP validation in parallel with setRemoteDescription this // complicates much more than would be ideal, but it ensures that the IdP // doesn't hold things up too much when it's not on the critical path let allDone = () => { - if (!setRemoteComplete || !idpComplete || !onSuccess) { + if (!setRemoteComplete || !idpComplete || isDone) { return; } + // May be null if the user didn't supply success/failure callbacks. + // Violation of spec, but we allow it for now this.callCB(onSuccess); - onSuccess = null; + isDone = true; this._executeNext(); };