Skip to content

Commit eef1e3e

Browse files
committed
Ensure that the viewer clears the workerPort option when using "fake" workers
Without this "fake" workers may be ignored in the API, which isn't really what you want when manually providing the `disableWorker=true` hash parameter. (Note that this requires the `pdfBugEnabled` option/preference to be set as well.) Also, after the changes in PR 19810 we can just load the "fake" worker directly in development mode and don't need to manually assign it to the global scope.
1 parent d97b653 commit eef1e3e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

web/app.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,12 @@ const PDFViewerApplication = {
298298
try {
299299
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
300300

301-
if (typeof PDFJSDev === "undefined") {
302-
globalThis.pdfjsWorker = await import("pdfjs/pdf.worker.js");
303-
} else {
304-
await __raw_import__(PDFWorker.workerSrc);
305-
}
301+
typeof PDFJSDev === "undefined" // eslint-disable-line no-unused-expressions
302+
? await import("pdfjs/pdf.worker.js")
303+
: await __raw_import__(PDFWorker.workerSrc);
304+
305+
// Ensure that the "fake" worker won't be ignored.
306+
AppOptions.set("workerPort", null);
306307
} catch (ex) {
307308
console.error("_parseHashParams:", ex);
308309
}

0 commit comments

Comments
 (0)