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).
This commit is contained in:
Jonas Jenwald 2023-09-07 15:31:32 +02:00
parent df9cce39c0
commit b5b061cdb6

View File

@ -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,