Ensure that getMainThreadWorkerMessageHandler
won't accidentally break getDocument
(PR 10139 follow-up)
*This should have been part of PR 10139.* In the event that a user has attempted to manually load the worker file on the main-thread, but somehow failed to do that correctly, there's a possibility that `getMainThreadWorkerMessageHandler` could throw. Considering how/where that helper function is being called, an error could still prevent `PDFDocumentLoadingTask` from completing (regardless if it's being resolved/rejected).
This commit is contained in:
parent
f45e46d7ad
commit
0e2c6047e4
@ -1358,10 +1358,12 @@ var PDFWorker = (function PDFWorkerClosure() {
|
||||
}
|
||||
|
||||
function getMainThreadWorkerMessageHandler() {
|
||||
if (typeof window === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
return (window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler);
|
||||
try {
|
||||
if (typeof window !== 'undefined') {
|
||||
return (window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler);
|
||||
}
|
||||
} catch (ex) { }
|
||||
return null;
|
||||
}
|
||||
|
||||
let fakeWorkerFilesLoadedCapability;
|
||||
|
Loading…
x
Reference in New Issue
Block a user