Skip to content

Commit

Permalink
Ensure that useWorkerFetch fallback value is always a boolean
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Snuffleupagus committed Feb 16, 2025
1 parent 3f15e0c commit 79a7dc0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,17 @@ function getDocument(src = {}) {
typeof src.useWorkerFetch === "boolean"
? src.useWorkerFetch
: (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
(CMapReaderFactory === DOMCMapReaderFactory &&
!!(
CMapReaderFactory === DOMCMapReaderFactory &&
StandardFontDataFactory === DOMStandardFontDataFactory &&
WasmFactory === DOMWasmFactory &&
cMapUrl &&
standardFontDataUrl &&
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 =
Expand Down

0 comments on commit 79a7dc0

Please sign in to comment.