mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #8922 from Snuffleupagus/paintXObject-errors
Allow `getOperatorList`/`getTextContent` to skip errors when parsing broken XObjects (issue 8702, issue 8704)
This commit is contained in:
commit
509d3728f1
5 changed files with 138 additions and 86 deletions
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -57,6 +57,7 @@
|
|||
!issue8480.pdf
|
||||
!issue8570.pdf
|
||||
!issue8697.pdf
|
||||
!issue8702.pdf
|
||||
!issue8707.pdf
|
||||
!issue8798r.pdf
|
||||
!issue8823.pdf
|
||||
|
|
BIN
test/pdfs/issue8702.pdf
Normal file
BIN
test/pdfs/issue8702.pdf
Normal file
Binary file not shown.
|
@ -1640,6 +1640,22 @@
|
|||
"lastPage": 1,
|
||||
"type": "load"
|
||||
},
|
||||
{ "id": "issue8702-eq",
|
||||
"file": "pdfs/issue8702.pdf",
|
||||
"md5": "59d501ed1518d78ef6ee442cf824b0f6",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue8702-text",
|
||||
"file": "pdfs/issue8702.pdf",
|
||||
"md5": "59d501ed1518d78ef6ee442cf824b0f6",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"lastPage": 1,
|
||||
"type": "text"
|
||||
},
|
||||
{ "id": "pr4897",
|
||||
"file": "pdfs/pr4897.pdf",
|
||||
"md5": "26897633eea5e6d10345a130b1c1777c",
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
*/
|
||||
|
||||
import { Dict, Name } from '../../src/core/primitives';
|
||||
import { FormatError, OPS } from '../../src/shared/util';
|
||||
import { OperatorList, PartialEvaluator } from '../../src/core/evaluator';
|
||||
import { Stream, StringStream } from '../../src/core/stream';
|
||||
import { OPS } from '../../src/shared/util';
|
||||
import { WorkerTask } from '../../src/core/worker';
|
||||
import { XRefMock } from './test_utils';
|
||||
|
||||
|
@ -48,6 +48,8 @@ describe('evaluator', function() {
|
|||
operatorList: result,
|
||||
}).then(function() {
|
||||
callback(result);
|
||||
}, function(reason) {
|
||||
callback(reason);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -229,9 +231,9 @@ describe('evaluator', function() {
|
|||
it('should skip paintXObject if name is missing', function(done) {
|
||||
var stream = new StringStream('/ Do');
|
||||
runOperatorListCheck(partialEvaluator, stream, new ResourcesMock(),
|
||||
function (result) {
|
||||
expect(result.argsArray).toEqual([]);
|
||||
expect(result.fnArray).toEqual([]);
|
||||
function(result) {
|
||||
expect(result instanceof FormatError).toEqual(true);
|
||||
expect(result.message).toEqual('XObject must be referred to by name.');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue