1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Closes all promises/streams when handler is destroyed.

This commit is contained in:
Yury Delendik 2017-09-28 16:45:04 -05:00
parent 25806d17f4
commit 71b0e4e818
3 changed files with 41 additions and 15 deletions

View file

@ -14,10 +14,11 @@
*/
import {
arrayByteLength, arraysToBytes, assert, createPromiseCapability, info,
InvalidPDFException, isNodeJS, MessageHandler, MissingPDFException,
PasswordException, setVerbosityLevel, UnexpectedResponseException,
UnknownErrorException, UNSUPPORTED_FEATURES, warn, XRefParseException
AbortException, arrayByteLength, arraysToBytes, assert,
createPromiseCapability, info, InvalidPDFException, isNodeJS, MessageHandler,
MissingPDFException, PasswordException, setVerbosityLevel,
UnexpectedResponseException, UnknownErrorException, UNSUPPORTED_FEATURES,
warn, XRefParseException
} from '../shared/util';
import { LocalPdfManager, NetworkPdfManager } from './pdf_manager';
import { Ref } from './primitives';
@ -841,7 +842,7 @@ var WorkerMessageHandler = {
return Promise.all(waitOn).then(function () {
// Notice that even if we destroying handler, resolved response promise
// must be sent back.
handler.destroy();
handler.close(new AbortException('Worker was terminated'));
handler = null;
});
});