Merge pull request #19939 from Snuffleupagus/disableWorker-clear-workerPort

Ensure that the viewer clears the `workerPort` option when using "fake" workers
This commit is contained in:
Jonas Jenwald 2025-05-18 08:38:48 +02:00 committed by GitHub
commit f72f240699
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -298,11 +298,12 @@ const PDFViewerApplication = {
try { try {
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc"); GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
if (typeof PDFJSDev === "undefined") { typeof PDFJSDev === "undefined" // eslint-disable-line no-unused-expressions
globalThis.pdfjsWorker = await import("pdfjs/pdf.worker.js"); ? await import("pdfjs/pdf.worker.js")
} else { : await __raw_import__(PDFWorker.workerSrc);
await __raw_import__(PDFWorker.workerSrc);
} // Ensure that the "fake" worker won't be ignored.
AppOptions.set("workerPort", null);
} catch (ex) { } catch (ex) {
console.error("_parseHashParams:", ex); console.error("_parseHashParams:", ex);
} }