Merge pull request #10970 from Snuffleupagus/MessageHandler-simplify-finalize
Simplify, and inline, the `finalize` function in the `MessageHandler` class
This commit is contained in:
commit
766d076dcb
@ -60,10 +60,6 @@ function resolveOrReject(capability, data) {
|
||||
}
|
||||
}
|
||||
|
||||
function finalize(promise) {
|
||||
return Promise.resolve(promise).catch(() => {});
|
||||
}
|
||||
|
||||
function MessageHandler(sourceName, targetName, comObj) {
|
||||
this.sourceName = sourceName;
|
||||
this.targetName = targetName;
|
||||
@ -326,14 +322,14 @@ MessageHandler.prototype = {
|
||||
};
|
||||
|
||||
let deleteStreamController = () => {
|
||||
// Delete streamController only when start, pull and
|
||||
// cancel callbacks are resolved, to avoid "TypeError".
|
||||
// Delete the `streamController` only when the start, pull, and cancel
|
||||
// capabilities have settled, to prevent `TypeError`s.
|
||||
Promise.all([
|
||||
this.streamControllers[data.streamId].startCall,
|
||||
this.streamControllers[data.streamId].pullCall,
|
||||
this.streamControllers[data.streamId].cancelCall
|
||||
].map(function(capability) {
|
||||
return capability && finalize(capability.promise);
|
||||
return capability && capability.promise.catch(function() { });
|
||||
})).then(() => {
|
||||
delete this.streamControllers[data.streamId];
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user