Bug 1480525 - ensure localIdp, remoteIdp exist before closing them r=mjf
authorNico Grunbaum <na-g@nostrum.com>
Mon, 06 Aug 2018 21:44:32 +0000
changeset 827163 5b36bf1368f66d3f028bf990c0e36362f875c579
parent 827162 fb85f9a81670722ca0de657cdad944b342585a79
child 827164 4466a4393d5f7fcf989155668906611df8775b5d
push id118488
push userbmo:hsivonen@hsivonen.fi
push dateTue, 07 Aug 2018 12:28:14 +0000
reviewersmjf
bugs1480525
milestone63.0a1
Bug 1480525 - ensure localIdp, remoteIdp exist before closing them r=mjf If PeerConnection initialization terminates early due to an excpetion localIdp, and remoteIdp aren't created. This causes another exception in close(). The patch checks that they each exist in close before attempting to access them. Differential Revision: https://phabricator.services.mozilla.com/D2686
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -1414,18 +1414,22 @@ class RTCPeerConnection {
   }
 
   close() {
     if (this._closed) {
       return;
     }
     this._closed = true;
     this.changeIceConnectionState("closed");
-    this._localIdp.close();
-    this._remoteIdp.close();
+    if (this._localIdp) {
+        this._localIdp.close();
+    }
+    if (this._remoteIdp) {
+        this._remoteIdp.close();
+    }
     this._impl.close();
     this._suppressEvents = true;
     delete this._pc;
     delete this._observer;
   }
 
   getLocalStreams() {
     this._checkClosed();