From b5b061cdb6a2798d433207189d4d3b9d69508045 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 7 Sep 2023 15:31:32 +0200 Subject: [PATCH] Slightly re-factor the parameter handling in `Catalog.parseDestDictionary` While it makes sense to check that the `destDict` parameter is indeed a Dictionary, since that data comes from the PDF document itself, the `resultObj` parameter is an internal PDF.js implementation detail that should always be correct (or tests will fail). --- src/core/catalog.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/core/catalog.js b/src/core/catalog.js index 6350bbf09..f52357d6a 100644 --- a/src/core/catalog.js +++ b/src/core/catalog.js @@ -1423,19 +1423,16 @@ class Catalog { * Helper function used to parse the contents of destination dictionaries. * @param {ParseDestDictionaryParameters} params */ - static parseDestDictionary(params) { - const destDict = params.destDict; + static parseDestDictionary({ + destDict, + resultObj, + docBaseUrl = null, + docAttachments = null, + }) { if (!(destDict instanceof Dict)) { warn("parseDestDictionary: `destDict` must be a dictionary."); return; } - const resultObj = params.resultObj; - if (typeof resultObj !== "object") { - warn("parseDestDictionary: `resultObj` must be an object."); - return; - } - const docBaseUrl = params.docBaseUrl || null; - const docAttachments = params.docAttachments || null; let action = destDict.get("A"), url,