pdf.js/test
Jonas Jenwald ad3a271fc4 [api-minor] Clear all caches in XRef.indexObjects, and improve /Root dictionary validation in XRef.parse (issue 14303)
*This patch improves handling of a couple of PDF documents from issue 14303.*

 - Update `XRef.indexObjects` to actually clear *all* XRef-caches. Invalid XRef tables *usually* cause issues early enough during parsing that we've not populated the XRef-cache, however to prevent any issues we obviously need to clear that one as well.

 - Improve the /Root dictionary validation in `XRef.parse` (PR 9827 follow-up). In addition to checking that a /Pages entry exists, we'll now also check that it can be successfully fetched *and* that it's of the correct type. There's really no point trying to use a /Root dictionary that e.g. `Catalog.toplevelPagesDict` will reject, and this way we'll be able to fallback to indexing the objects in corrupt documents.

 - Throw an `InvalidPDFException`, rather than a general `FormatError`, in `XRef.parse` when no usable /Root dictionary could be found. That really seems more appropriate overall, since all attempts at parsing/recovery have failed. (This part of the patch is API-observable, hence the tag.)

With these changes, two existing test-cases are improved and the unit-tests are updated/re-factored to highlight that. In particular `GHOSTSCRIPT-698804-1-fuzzed.pdf` will now both load and "render" correctly, whereas `poppler-395-0-fuzzed.pdf` will now fail immediately upon loading (rather than *appearing* to work).
2021-12-03 11:57:38 +01:00
..
chromium Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
font Add non-PRODUCTION/TESTING overflow asserts to various string helper-functions (issue 6759) 2021-06-27 16:06:30 +02:00
integration [api-minor] Implement securityHandler in the scripting API (bug 1731578) 2021-10-26 23:42:04 +10:00
pdfs [Regression] Eagerly fetch/parse the entire /Pages-tree in corrupt documents (issue 14303, PR 14311 follow-up) 2021-12-02 14:31:04 +01:00
resources Replace the remaining Node.removeChild() instances with Element.remove() 2021-11-16 17:52:50 +01:00
stats Enable the ESLint no-var rule in the test/stats/ folder 2021-03-14 10:15:45 +01:00
ttx Update fonttools location and version (issue 6223) 2015-07-17 12:51:09 +02:00
types Add support for modern ECMAScript class features 2021-10-22 22:01:17 +02:00
unit [api-minor] Clear all caches in XRef.indexObjects, and improve /Root dictionary validation in XRef.parse (issue 14303) 2021-12-03 11:57:38 +01:00
.eslintrc Enable ESLint rules that no longer need to be disabled on a directory/file-basis 2021-01-22 17:47:03 +01:00
.gitignore Ignore test snapshots directory. 2013-03-15 11:24:08 -07:00
add_test.js Enable the ESLint no-var rule in test/add_test.js 2021-03-14 10:25:51 +01:00
annotation_layer_builder_overrides.css Enable the Stylelint length-zero-no-unit rule 2021-01-10 14:09:36 +01:00
downloadutils.js Make verifyManifestFiles fail for non-linked test-cases with a "link": true-entry 2021-09-10 09:51:34 +02:00
driver.js Merge pull request #14229 from brendandahl/term-log 2021-11-19 19:48:59 +01:00
integration-boot.js Fix position of highlighted all text. (#13306) 2021-04-28 10:15:31 +02:00
test_manifest.json XFA - Draw arcs correctly 2021-11-27 19:30:12 +01:00
test_slave.html Use the SimpleLinkService when running "annotations" reference tests 2017-09-12 15:24:46 +02:00
test.js Fix browser page navigation for Puppeteer 11+ in test/test.js 2021-11-28 18:58:22 +01:00
testutils.js Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
text_layer_test.css Fix highlighting of search results when the textLayer contains br-elements (PR 13257 follow-up, issue 13323) 2021-05-02 15:36:01 +02:00
webserver.js Remove the LGTM configuration and inline disable comments (issue 13829) 2021-08-03 11:14:49 +02:00
xfa_layer_builder_overrides.css XFA - Fix xfaLink class to make links work (bug 1735738) 2021-10-29 11:39:33 -04:00