Validate the cMapUrl/standardFontDataUrl parameters in getDocument

These changes make sense for two reasons:
 - Given that the parameters are potentially passed to the worker-thread, depending on the `useWorkerFetch` parameter, we need to prevent errors if the user provides values that aren't clonable.
 - By ensuring that the default values are indeed `null`, we'll trigger main-thread fetching (of CMaps and Standard fonts) as intended in the `PartialEvaluator` and thus potentially provide better Error messages.
This commit is contained in:
Jonas Jenwald 2022-03-10 16:33:10 +01:00
parent ee39499a5a
commit a60b98412f

View File

@ -339,6 +339,12 @@ function getDocument(src) {
if (!Number.isInteger(params.maxImageSize)) {
params.maxImageSize = -1;
}
if (typeof params.cMapUrl !== "string") {
params.cMapUrl = null;
}
if (typeof params.standardFontDataUrl !== "string") {
params.standardFontDataUrl = null;
}
if (typeof params.useWorkerFetch !== "boolean") {
params.useWorkerFetch =
params.CMapReaderFactory === DOMCMapReaderFactory &&