pdf.js/test
Jonas Jenwald 397f943ca3 [api-minor] Enable transferring of TypedArray PDF data by default (PR 15908 follow-up)
This patch removes the recently introduced `transferPdfData` API-option, and simply enables transferring of TypedArray data *by default* instead of copying it. This will help reduce main-thread memory usage, however it will take ownership of the TypedArrays. Currently this only applies to the following cases:
 - TypedArrays passed to the `getDocument`-function in the API, in order to open PDF documents from binary data.
 - TypedArrays passed to a `PDFDataRangeTransport`-instance, used to support custom PDF document fetching/loading (see e.g. the Firefox PDF Viewer).

*PLEASE NOTE:* To avoid being affected by this, please simply *copy* any TypedArray data before passing it to either of the functions/methods mentioned above.

Now that we transfer TypedArray data that we previously only copied, we need to be more careful with input validation. Given how the `{IPDFStreamReader, IPDFStreamRangeReader}.read` methods will always return ArrayBuffer data, which is then transferred to the worker-thread[1], the actual TypedArray data passed to the API thus need to have the same exact size as its underlying ArrayBuffer to prevent issues.
Hence we'll check for this and only allow transferring of *safe* TypedArray data, and fallback to simply copying the data just as before. This obviously shouldn't be an issue in the Firefox PDF Viewer, but for the general PDF.js library we need to be more careful here.

---
[1] See e09ad99973/src/display/api.js (L2492-L2506) respectively e09ad99973/src/display/api.js (L2578-L2590)
2023-01-14 10:39:36 +01:00
..
chromium Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
font Enable the ESLint prefer-spread rule 2022-08-06 10:17:00 +02:00
integration [JS] UserActivation must be enabled before running document actions 2023-01-04 21:26:36 +01:00
pdfs Support parsing encrypted documents in XRef.indexObjects (issue 15893) 2023-01-06 13:09:37 +01:00
resources Enable the unicorn/prefer-regexp-test ESLint plugin rule 2022-09-19 16:34:01 +02:00
stats Use more for...of loops in the code-base 2022-07-17 16:18:54 +02:00
ttx Update ttx from version 2.5 to version 3.19.0 2022-07-10 21:18:36 +02:00
types Add support for modern ECMAScript class features 2021-10-22 22:01:17 +02:00
unit [api-minor] Enable transferring of TypedArray PDF data by default (PR 15908 follow-up) 2023-01-14 10:39:36 +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 [Annotation] Add a div containing the text of a FreeText annotation (bug 1780375) 2022-08-04 11:14:05 +02: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 #15775 from Snuffleupagus/vars-all 2022-12-07 10:30:47 +01:00
integration-boot.js [Annotations] Add some aria-owns in the text layer to link to annotations (bug 1780375) 2022-08-12 14:35:26 +02:00
test_manifest.json Support parsing encrypted documents in XRef.indexObjects (issue 15893) 2023-01-06 13:09:37 +01:00
test_slave.html Tighten the vars-argument for the ESLint no-unused-vars rule 2022-12-04 16:15:50 +01:00
test.js Update npm packages 2022-10-16 09:38:58 +02:00
testutils.js Enable the no-var linting rule in test/testutils.js 2021-12-18 15:58:47 +01:00
text_layer_test.css Refactor the text layer code in order to avoid to recompute it on each draw 2022-12-01 18:42:43 +01: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