1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #11872 from Snuffleupagus/issue-11871

Gracefully handle annotation parsing errors in `Page.getOperatorList` (issue 11871)
This commit is contained in:
Tim van der Meij 2020-05-04 22:19:27 +02:00 committed by GitHub
commit 491904d30a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 6 deletions

View file

@ -302,11 +302,15 @@ class Page {
for (const annotation of annotations) {
if (isAnnotationRenderable(annotation, intent)) {
opListPromises.push(
annotation.getOperatorList(
partialEvaluator,
task,
renderInteractiveForms
)
annotation
.getOperatorList(partialEvaluator, task, renderInteractiveForms)
.catch(function (reason) {
warn(
"getOperatorList - ignoring annotation data during " +
`"${task.name}" task: "${reason}".`
);
return null;
})
);
}
}

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { assert, ImageKind, OPS } from "../shared/util.js";
import { assert, ImageKind, OPS, warn } from "../shared/util.js";
var QueueOptimizer = (function QueueOptimizerClosure() {
function addState(parentState, pattern, checkFn, iterateFn, processFn) {
@ -674,6 +674,10 @@ var OperatorList = (function OperatorListClosure() {
},
addOpList(opList) {
if (!(opList instanceof OperatorList)) {
warn('addOpList - ignoring invalid "opList" parameter.');
return;
}
Object.assign(this.dependencies, opList.dependencies);
for (var i = 0, ii = opList.length; i < ii; i++) {
this.addOp(opList.fnArray[i], opList.argsArray[i]);