From 84476da26e8ae232429061ab1c0106a770cc59cb Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 14 Jul 2020 13:00:35 +0200 Subject: [PATCH] Handle lookup errors "silently" in `PartialEvaluator.hasBlendModes` (PR 11680 follow-up) Given that this method is used during what's essentially a *pre*-parsing stage, before the actual OperatorList parsing occurs, on second thought it doesn't seem at all necessary to warn and trigger fallback in cases where there's lookup errors. *Please note:* Any any errors will still be either suppressed or thrown, according to the `ignoreErrors` option, during the *actual* OperatorList parsing. --- src/core/evaluator.js | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 3a1296f1d..6951e954e 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -264,20 +264,11 @@ class PartialEvaluator { if (ex instanceof MissingDataException) { throw ex; } - if (this.options.ignoreErrors) { - if (graphicState instanceof Ref) { - // Avoid parsing a corrupt ExtGState more than once. - processed[graphicState.toString()] = true; - } - // Error(s) in the ExtGState -- sending unsupported feature - // notification and allow parsing/rendering to continue. - this.handler.send("UnsupportedFeature", { - featureId: UNSUPPORTED_FEATURES.errorExtGState, - }); - warn(`hasBlendModes - ignoring ExtGState: "${ex}".`); - continue; - } - throw ex; + // Avoid parsing a corrupt ExtGState more than once. + processed[graphicState.toString()] = true; + + info(`hasBlendModes - ignoring ExtGState: "${ex}".`); + continue; } } if (!(graphicState instanceof Dict)) { @@ -326,20 +317,11 @@ class PartialEvaluator { if (ex instanceof MissingDataException) { throw ex; } - if (this.options.ignoreErrors) { - if (xObject instanceof Ref) { - // Avoid parsing a corrupt XObject more than once. - processed[xObject.toString()] = true; - } - // Error(s) in the XObject -- sending unsupported feature - // notification and allow parsing/rendering to continue. - this.handler.send("UnsupportedFeature", { - featureId: UNSUPPORTED_FEATURES.errorXObject, - }); - warn(`hasBlendModes - ignoring XObject: "${ex}".`); - continue; - } - throw ex; + // Avoid parsing a corrupt XObject more than once. + processed[xObject.toString()] = true; + + info(`hasBlendModes - ignoring XObject: "${ex}".`); + continue; } } if (!isStream(xObject)) {