Bug 1443198 - Part 2: Check whether PC is closed before trying to create transceivers due to offerToReceive. r=jib
authorByron Campen [:bwc] <docfaraday@gmail.com>
Tue, 06 Mar 2018 09:24:18 -0600
changeset 459701 a34f669a52e14e130573df0763a23fbb124a92cf
parent 459700 14858f6bea8dbdfa9356cd8abed2256fdb3bd7a5
child 459709 28ec88d1b741579f643427a6b96aec6e4f7a44ed
child 459714 78f9dd3eb0843c12e311df2256d15743a7653477
push id8822
push userarchaeopteryx@coole-files.de
push dateThu, 08 Mar 2018 23:51:23 +0000
treeherdermozilla-beta@e18b07e250b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1443198
milestone60.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 1443198 - Part 2: Check whether PC is closed before trying to create transceivers due to offerToReceive. r=jib MozReview-Commit-ID: 5xDzBc9af6Y
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -787,20 +787,16 @@ class RTCPeerConnection {
   createOffer(optionsOrOnSucc, onErr, options) {
     let onSuccess = null;
     if (typeof optionsOrOnSucc == "function") {
       onSuccess = optionsOrOnSucc;
     } else {
       options = optionsOrOnSucc;
     }
 
-    // Spec language implies that this needs to happen as if it were called
-    // before createOffer, so we do this as early as possible.
-    this._ensureTransceiversForOfferToReceive(options);
-
     // This entry-point handles both new and legacy call sig. Decipher which one
     if (onSuccess) {
       return this._legacy(onSuccess, onErr, () => this._createOffer(options));
     }
 
     return this._async(() => this._createOffer(options));
   }
 
@@ -841,16 +837,17 @@ class RTCPeerConnection {
         } else if (transceiver.direction == "recvonly") {
           transceiver.setDirectionInternal("inactive");
         }
       });
   }
 
   async _createOffer(options) {
     this._checkClosed();
+    this._ensureTransceiversForOfferToReceive(options);
     this._syncTransceivers();
     let origin = Cu.getWebIDLCallerPrincipal().origin;
     return this._chain(async () => {
       let haveAssertion;
       if (this._localIdp.enabled) {
         haveAssertion = this._getIdentityAssertion(origin);
       }
       await this._getPermission();