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:
parent
02bdacef42
commit
74f5a59f43
2 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue