Tweak the useWorkerFetch default value checks (PR 15879 follow-up)

Currently we accidentally accept `cMapUrl` and `standardFontDataUrl` parameters that are empty strings or `null`, since e.g. `new URL(null, document.baseURI)` doesn't throw, when validating the `useWorkerFetch` parameter via the `isValidFetchUrl` helper function.
Please note that we are currently failing gracefully in this case, as intended, however the warning-messages printed in the console are perhaps less helpful without this patch.
This commit is contained in:
Jonas Jenwald 2023-07-27 16:08:14 +02:00
parent 611acf52c4
commit c09bd5568c

View File

@ -316,6 +316,8 @@ function getDocument(src) {
: (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
(CMapReaderFactory === DOMCMapReaderFactory &&
StandardFontDataFactory === DOMStandardFontDataFactory &&
cMapUrl &&
standardFontDataUrl &&
isValidFetchUrl(cMapUrl, document.baseURI) &&
isValidFetchUrl(standardFontDataUrl, document.baseURI));
const canvasFactory =