mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
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
1 changed files with 6 additions and 4 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue