1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Inline the loadFakeWorker function at its only call-site in web/app.js

Given that this is a debug-only, and fairly short, function we can just inline the code.
This commit is contained in:
Jonas Jenwald 2024-05-10 12:21:37 +02:00
parent 4a8d742592
commit ba8c620e4b

View file

@ -267,7 +267,13 @@ const PDFViewerApplication = {
if (params.get("disableworker") === "true") {
try {
await loadFakeWorker();
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
if (typeof PDFJSDev === "undefined") {
globalThis.pdfjsWorker = await import("pdfjs/pdf.worker.js");
} else {
await __non_webpack_import__(PDFWorker.workerSrc);
}
} catch (ex) {
console.error(`_parseHashParams: "${ex.message}".`);
}
@ -2164,16 +2170,6 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
};
}
async function loadFakeWorker() {
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
if (typeof PDFJSDev === "undefined") {
globalThis.pdfjsWorker = await import("pdfjs/pdf.worker.js");
return;
}
await __non_webpack_import__(PDFWorker.workerSrc);
}
async function loadPDFBug(self) {
const { PDFBug } =
typeof PDFJSDev === "undefined"