summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dom/media/PeerConnection.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js
index d13f1d0fbb..0569b15aeb 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:
*