mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1259728 - minimal fix for reentrancy in pc.close(). r=jesup
MozReview-Commit-ID: Dji4d2bYTcj --HG-- extra : rebase_source : 65d08cc6869444b2219ed7529ebad6c23115153f
This commit is contained in:
parent
528d76cc52
commit
036cbca2a2
@ -622,8 +622,8 @@ RTCPeerConnection.prototype = {
|
||||
|
||||
dispatchEvent: function(event) {
|
||||
// PC can close while events are firing if there is an async dispatch
|
||||
// in c++ land
|
||||
if (!this._closed) {
|
||||
// in c++ land. But let through "closed" signaling and ice connection events.
|
||||
if (!this._closed || this._inClose) {
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
}
|
||||
},
|
||||
@ -1139,11 +1139,13 @@ RTCPeerConnection.prototype = {
|
||||
if (this._closed) {
|
||||
return;
|
||||
}
|
||||
this._closed = true;
|
||||
this._inClose = true;
|
||||
this.changeIceConnectionState("closed");
|
||||
this._localIdp.close();
|
||||
this._remoteIdp.close();
|
||||
this._impl.close();
|
||||
this._closed = true;
|
||||
this._inClose = false;
|
||||
},
|
||||
|
||||
getLocalStreams: function() {
|
||||
|
@ -29,6 +29,16 @@
|
||||
is(pc.signalingState, "closed", "signalingState is 'closed'");
|
||||
is(pc.iceConnectionState, "closed", "iceConnectionState is 'closed'");
|
||||
|
||||
// test that pc is really closed (and doesn't crash, bug 1259728)
|
||||
try {
|
||||
pc.getLocalStreams();
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
is(exception && exception.name, "InvalidStateError",
|
||||
"pc.getLocalStreams should throw when closed");
|
||||
exception = null;
|
||||
|
||||
try {
|
||||
pc.close();
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user