Use an early return in PDFWorker.prototype._initialize when workers are disabled
This helps reduce overall indentation in the method, thus leading to slightly less code. Also, remove an old comment referring to Chrome 15 since that's no longer relevant now.
This commit is contained in:
parent
d6612b3427
commit
0a36b667e4
@ -2124,11 +2124,14 @@ class PDFWorker {
|
||||
// support, create a new web worker and test if it/the browser fulfills
|
||||
// all requirements to run parts of pdf.js in a web worker.
|
||||
// Right now, the requirement is, that an Uint8Array is still an
|
||||
// Uint8Array as it arrives on the worker. (Chrome added this with v.15.)
|
||||
// Uint8Array as it arrives on the worker.
|
||||
if (
|
||||
!PDFWorkerUtil.isWorkerDisabled &&
|
||||
!PDFWorker.#mainThreadWorkerMessageHandler
|
||||
PDFWorkerUtil.isWorkerDisabled ||
|
||||
PDFWorker.#mainThreadWorkerMessageHandler
|
||||
) {
|
||||
this._setupFakeWorker();
|
||||
return;
|
||||
}
|
||||
let { workerSrc } = PDFWorker;
|
||||
|
||||
try {
|
||||
@ -2219,8 +2222,7 @@ class PDFWorker {
|
||||
} catch {
|
||||
info("The worker has been disabled.");
|
||||
}
|
||||
}
|
||||
// Either workers are disabled, not supported or have thrown an exception.
|
||||
// Either workers are not supported or have thrown an exception.
|
||||
// Thus, we fallback to a faked worker.
|
||||
this._setupFakeWorker();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user