Ignore operators that are known to be unsupported
`operatorList.addOp` adds the arguments to the list which is then passed as-is by postMessage to the main thread. But since we don't parse these operations, they are raw PDF objects and may therefore cause a serialization error. This is a conservative patch, and only affects operators which are known to be unsupported. We should ignore all unknown operators, but I haven't really looked into the consequences of doing that. Fixes #6549
This commit is contained in:
parent
f12d692c78
commit
50ff2d4c2a
@ -870,6 +870,24 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
case OPS.rectangle:
|
||||
self.buildPath(operatorList, fn, args);
|
||||
continue;
|
||||
case OPS.markPoint:
|
||||
case OPS.markPointProps:
|
||||
case OPS.beginMarkedContent:
|
||||
case OPS.beginMarkedContentProps:
|
||||
case OPS.endMarkedContent:
|
||||
case OPS.beginCompat:
|
||||
case OPS.endCompat:
|
||||
// Ignore operators where the corresponding handlers are known to
|
||||
// be no-op in CanvasGraphics (display/canvas.js). This prevents
|
||||
// serialization errors and is also a bit more efficient.
|
||||
// We could also try to serialize all objects in a general way,
|
||||
// e.g. as done in https://github.com/mozilla/pdf.js/pull/6266,
|
||||
// but doing so is meaningless without knowing the semantics.
|
||||
continue;
|
||||
default:
|
||||
// Note: Let's hope that the ignored operator does not have any
|
||||
// non-serializable arguments, otherwise postMessage will throw
|
||||
// "An object could not be cloned.".
|
||||
}
|
||||
operatorList.addOp(fn, args);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user