diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /dom/media/PeerConnection.js | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-2018.07.18.tar UXP-2018.07.18.tar.gz UXP-2018.07.18.tar.lz UXP-2018.07.18.tar.xz UXP-2018.07.18.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'dom/media/PeerConnection.js')
-rw-r--r-- | dom/media/PeerConnection.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 0c3021799..0569b15ae 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -516,6 +516,18 @@ RTCPeerConnection.prototype = { }; }, + // This implements the fairly common "Queue a task" logic + async _queueTaskWithClosedCheck(func) { + return new Promise(resolve => { + Services.tm.mainThread.dispatch({ run() { + if (!this._closed) { + func(); + resolve(); + } + }}, Ci.nsIThread.DISPATCH_NORMAL); + }); + }, + /** * An RTCConfiguration may look like this: * @@ -1445,7 +1457,10 @@ PeerConnectionObserver.prototype = { break; case "IceConnectionState": - this.handleIceConnectionStateChange(this._dompc._pc.iceConnectionState); + let connState = this._dompc._pc.iceConnectionState; + this._dompc._queueTaskWithClosedCheck(() => { + this.handleIceConnectionStateChange(connState); + }); break; case "IceGatheringState": |