[Pkg-javascript-commits] [pdf.js] 73/174: Ignore operators that are known to be unsupported
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 50ff2d4c2afdd9f26e54ce77b3af6f651154467a
Author: Rob Wu <rob at robwu.nl>
Date: Wed Oct 21 15:39:25 2015 +0200
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
---
src/core/evaluator.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 453bd05..0594dd4 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -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);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list