pdf.js/test
Jonas Jenwald 2b2234fd5a [api-minor] Ensure that PDFDocumentProxy.hasJSActions won't fail if MissingDataExceptions are thrown during the associated worker-thread parsing
With the current implementation of `PDFDocument.hasJSActions`, in the worker-thread, we're not actually handling not-yet-loaded data correctly. This can thus fail in *two* different ways:
 - The `PDFDocument.fieldObjects` getter (and its helper method), while it may *return* a Promise, still fetches all of its data synchronously and it can thus throw a `MissingDataException` during parsing.
 - The `Catalog.jsActions` getter, which is completely synchronous, can obviously throw a `MissingDataException` during parsing.

If either of these cases occur currently, the `PDFDocumentProxy.hasJSActions` method in the API can either return a *rejected* Promise (which it never should) or possibly "hang" and never resolve.

*Please note:* While I've not *yet* seen this error in an actual PDF document, it can happen during loading if you're unlucky enough with e.g. the structure of the PDF document and/or the download speed offered by the server.
This patch is thus based on code-inspection *and* on manually throwing a `MissingDataException` on the first access of `Catalog.jsActions` to simulate this situation.

Finally, this patch adds a couple of *API* unit-tests for this (since none existed).
2021-04-13 14:33:56 +02:00
..
chromium Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
font Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
integration Add support for basic structure tree for accessibility. 2021-04-09 09:56:28 -07:00
pdfs Merge pull request #13214 from calixteman/signatures 2021-04-10 19:35:16 +02:00
resources Introduce Puppeteer for handling browsers during tests 2020-04-27 13:03:12 +02: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 typescript definitions 2020-07-30 11:10:37 +02:00
unit [api-minor] Ensure that PDFDocumentProxy.hasJSActions won't fail if MissingDataExceptions are thrown during the associated worker-thread parsing 2021-04-13 14:33:56 +02: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 Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
driver.js Merge pull request #13171 from brendandahl/struct-tree 2021-04-09 21:32:44 +02:00
integration-boot.js Add support for basic structure tree for accessibility. 2021-04-09 09:56:28 -07:00
test_manifest.json Merge pull request #13214 from calixteman/signatures 2021-04-10 19:35:16 +02:00
test_slave.html Use the SimpleLinkService when running "annotations" reference tests 2017-09-12 15:24:46 +02:00
test.js Improve handling of *linked* test-cases for the unit/integration suites (#13160) 2021-03-30 13:24:04 +02:00
testutils.js Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
text_layer_test.css Add support for basic structure tree for accessibility. 2021-04-09 09:56:28 -07:00
webserver.js Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00