diff options
Diffstat (limited to 'dom')
-rw-r--r-- | dom/media/PeerConnection.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index d13f1d0fb..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: * |