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

Ensure that the useWorkerFetch fallback value is always a boolean

If either of the factory-urls are missing or invalid, the fallback value would currently become `useWorkerFetch === null`.
While that is obviously a falsy value, which means that the code still works as intended, we should ensure that this is consistent.
This commit is contained in:
Jonas Jenwald 2025-02-16 13:55:35 +01:00
parent 3f15e0c469
commit 06e4580f8b

View file

@ -331,7 +331,8 @@ function getDocument(src = {}) {
typeof src.useWorkerFetch === "boolean"
? src.useWorkerFetch
: (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
(CMapReaderFactory === DOMCMapReaderFactory &&
!!(
CMapReaderFactory === DOMCMapReaderFactory &&
StandardFontDataFactory === DOMStandardFontDataFactory &&
WasmFactory === DOMWasmFactory &&
cMapUrl &&
@ -339,7 +340,8 @@ function getDocument(src = {}) {
wasmUrl &&
isValidFetchUrl(cMapUrl, document.baseURI) &&
isValidFetchUrl(standardFontDataUrl, document.baseURI) &&
isValidFetchUrl(wasmUrl, document.baseURI));
isValidFetchUrl(wasmUrl, document.baseURI)
);
// Parameters only intended for development/testing purposes.
const styleElement =