2b2234fd5a
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). |
||
---|---|---|
.. | ||
chromium | ||
font | ||
integration | ||
pdfs | ||
resources | ||
stats | ||
ttx | ||
types | ||
unit | ||
.eslintrc | ||
.gitignore | ||
add_test.js | ||
annotation_layer_builder_overrides.css | ||
downloadutils.js | ||
driver.js | ||
integration-boot.js | ||
test_manifest.json | ||
test_slave.html | ||
test.js | ||
testutils.js | ||
text_layer_test.css | ||
webserver.js |