Ensure that the Cmd
/Name
/Ref
caches are cleared when terminating the worker (PR 10863 follow-up)
Usually when the worker is terminated it will also be completely destroyed/removed, which means that any global caches (such as the ones in `src/core/primitive.js`) should be automatically cleared in the process. However, for certain ways of loading the `pdf.worker.js` file, e.g. passing in a re-usable worker to `getDocument`, using the `workerPort` functionality, or even disabling workers completely (even though this is never a good idea), the worker file may be kept in memory and these caches will not be cleared as expected.
This commit is contained in:
parent
d0892e46e2
commit
a3742a9f83
@ -19,10 +19,10 @@ import {
|
|||||||
PasswordException, setVerbosityLevel, UnexpectedResponseException,
|
PasswordException, setVerbosityLevel, UnexpectedResponseException,
|
||||||
UnknownErrorException, UNSUPPORTED_FEATURES, VerbosityLevel, warn
|
UnknownErrorException, UNSUPPORTED_FEATURES, VerbosityLevel, warn
|
||||||
} from '../shared/util';
|
} from '../shared/util';
|
||||||
|
import { clearPrimitiveCaches, Ref } from './primitives';
|
||||||
import { LocalPdfManager, NetworkPdfManager } from './pdf_manager';
|
import { LocalPdfManager, NetworkPdfManager } from './pdf_manager';
|
||||||
import isNodeJS from '../shared/is_node';
|
import isNodeJS from '../shared/is_node';
|
||||||
import { MessageHandler } from '../shared/message_handler';
|
import { MessageHandler } from '../shared/message_handler';
|
||||||
import { Ref } from './primitives';
|
|
||||||
import { XRefParseException } from './core_utils';
|
import { XRefParseException } from './core_utils';
|
||||||
|
|
||||||
var WorkerTask = (function WorkerTaskClosure() {
|
var WorkerTask = (function WorkerTaskClosure() {
|
||||||
@ -700,6 +700,7 @@ var WorkerMessageHandler = {
|
|||||||
if (cancelXHRs) {
|
if (cancelXHRs) {
|
||||||
cancelXHRs();
|
cancelXHRs();
|
||||||
}
|
}
|
||||||
|
clearPrimitiveCaches();
|
||||||
|
|
||||||
var waitOn = [];
|
var waitOn = [];
|
||||||
WorkerTasks.forEach(function (task) {
|
WorkerTasks.forEach(function (task) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user