Bug 1443198 - Part 2: Check whether PC is closed before trying to create transceivers due to offerToReceive. r?jib
MozReview-Commit-ID: 5xDzBc9af6Y
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -788,20 +788,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));
}
@@ -842,16 +838,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();