1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Ensure that the cancel/error methods on Streams are always called with valid reason arguments

This commit is contained in:
Jonas Jenwald 2019-09-02 13:28:19 +02:00
parent 02bdacef42
commit 74f5a59f43
2 changed files with 8 additions and 3 deletions

View file

@ -223,6 +223,7 @@ MessageHandler.prototype = {
},
cancel: (reason) => {
assert(reason instanceof Error, 'cancel must have a valid reason');
let cancelCapability = createPromiseCapability();
this.streamControllers[streamId].cancelCall = cancelCapability;
this.streamControllers[streamId].isClosed = true;
@ -287,6 +288,7 @@ MessageHandler.prototype = {
},
error(reason) {
assert(reason instanceof Error, 'error must have a valid reason');
if (this.isCancelled) {
return;
}