pdf.js/test/unit
Yury Delendik 66e0dd1b06 Use streams for OperatorList chunking (issue 10023)
*Please note:* The majority of this patch was written by Yury, and it's simply been rebased and slightly extended to prevent issues when dealing with `RenderingCancelledException`.

By leveraging streams this (finally) provides a simple way in which parsing can be aborted on the worker-thread, which will ultimately help save resources.
With this patch worker-thread parsing will *only* be aborted when the document is destroyed, and not when rendering is cancelled. There's a couple of reasons for this:

 - The API currently expects the *entire* OperatorList to be extracted, or an Error to occur, once it's been started. Hence additional re-factoring/re-writing of the API code will be necessary to properly support cancelling and re-starting of OperatorList parsing in cases where the `lastChunk` hasn't yet been seen.
 - Even with the above addressed, immediately cancelling when encountering a `RenderingCancelledException` will lead to worse performance in e.g. the default viewer. When zooming and/or rotation of the document occurs it's very likely that `cancel` will be (almost) immediately followed by a new `render` call. In that case you'd obviously *not* want to abort parsing on the worker-thread, since then you'd risk throwing away a partially parsed Page and thus be forced to re-parse it again which will regress perceived performance.
 - This patch is already *somewhat* risky, given that it touches fundamentally important/critical code, and trying to keep it somewhat small should hopefully reduce the risk of regressions (and simplify reviewing as well).

Time permitting, once this has landed and been in Nightly for awhile, I'll try to work on the remaining points outlined above.

Co-Authored-By: Yury Delendik <ydelendik@mozilla.com>
Co-Authored-By: Jonas Jenwald <jonas.jenwald@gmail.com>
2019-08-24 15:56:40 +02:00
..
annotation_spec.js [api-minor] Implement quadpoints for annotations in the core layer 2019-07-28 20:36:21 +02:00
api_spec.js Use streams for OperatorList chunking (issue 10023) 2019-08-24 15:56:40 +02:00
bidi_spec.js Convert the files in the /test/unit folder to ES6 modules 2017-04-30 00:34:02 +02:00
cff_parser_spec.js Add unique glyph names for CFF fonts. 2019-02-27 15:00:29 -08:00
clitests_helper.js Reduce the amount of console "spam", by ignoring info/warn calls, when running the unit-tests in Node.js/Travis 2018-06-03 00:28:40 +02:00
clitests.json Run the custom_spec unit-tests in Node.js/Travis (PR 10537 follow-up) 2019-02-26 22:40:55 +01:00
cmap_spec.js Rename the src/display/dom_utils.js file to src/display/display_utils.js 2019-02-23 16:30:16 +01:00
colorspace_spec.js Add caching to reduce the number of Ref objects 2019-05-26 12:23:37 +02:00
core_utils_spec.js Add caching to reduce the number of Ref objects 2019-05-26 12:23:37 +02:00
crypto_spec.js Convert the files in the /test/unit folder to ES6 modules 2017-04-30 00:34:02 +02:00
custom_spec.js Rename the src/display/dom_utils.js file to src/display/display_utils.js 2019-02-23 16:30:16 +01:00
display_svg_spec.js Restore the btoa/atob polyfills for Node.js 2018-01-13 01:31:05 +01:00
display_utils_spec.js Implement creation/modification date for annotations 2019-05-05 14:51:03 +02:00
document_spec.js Add a getDocId method to the idFactory, in Page instances, to avoid passing around PDFManager instances unnecessarily (PR 7941 follow-up) 2019-04-20 13:11:17 +02:00
encodings_spec.js Implement unit tests for the encodings and fix missing items 2017-12-24 18:14:40 +01:00
evaluator_spec.js Use streams for OperatorList chunking (issue 10023) 2019-08-24 15:56:40 +02:00
fetch_stream_spec.js Ensure that ReadableStreams are cancelled with actual Errors 2019-08-01 16:40:46 +02:00
function_spec.js Update the ESLint dependencies, and also tweak the no-multiple-empty-lines rules 2018-01-03 13:32:57 +01:00
jasmine-boot.js Add fetch stream spec 2019-04-07 13:14:03 +02:00
message_handler_spec.js Ensure that ReadableStreams are cancelled with actual Errors 2019-08-01 16:40:46 +02:00
metadata_spec.js Implement a unit test for metadata parsing to ensure that it's not vulnerable to the billion laughs attack 2019-01-19 19:54:08 +01:00
murmurhash3_spec.js Convert the files in the /test/unit folder to ES6 modules 2017-04-30 00:34:02 +02:00
network_spec.js Ensure that ReadableStreams are cancelled with actual Errors 2019-08-01 16:40:46 +02:00
network_utils_spec.js decode filename when match an urlencode filename from contentDispositionFilename 2019-07-31 09:33:56 +08:00
node_stream_spec.js Ensure that ReadableStreams are cancelled with actual Errors 2019-08-01 16:40:46 +02:00
parser_spec.js Change the signature of the Parser constructor to take a parameter object 2019-06-23 16:01:45 +02:00
pdf_find_controller_spec.js Remove left-over console log from the find controller unit tests 2019-01-12 22:27:40 +01:00
pdf_find_utils_spec.js Add initial support for "Whole words" searching in the viewer 2018-09-10 11:59:29 +02:00
pdf_history_spec.js Fix a PDFHistory regression with document hashes of the nameddest=... form 2017-10-09 21:58:54 +02:00
primitives_spec.js Add caching to reduce the number of Ref objects 2019-05-26 12:23:37 +02:00
stream_spec.js Make the getBytes/peekBytes methods of Stream/DecodeStream/ChunkedStream able to return Uint8ClampedArrays 2018-06-12 11:01:32 +02:00
test_utils.js Add a getDocId method to the idFactory, in Page instances, to avoid passing around PDFManager instances unnecessarily (PR 7941 follow-up) 2019-04-20 13:11:17 +02:00
testreporter.js Reword test reporter message 2018-08-05 21:21:46 +02:00
type1_parser_spec.js Fix inconsistent spacing and trailing commas in objects in test/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on 2017-06-02 13:04:04 +02:00
ui_utils_spec.js Convert some usage of indexOf to startsWith/includes where applicable 2019-01-18 17:57:41 +01:00
unicode_spec.js Convert the files in the /test/unit folder to ES6 modules 2017-04-30 00:34:02 +02:00
unit_test.html Replaces RequireJS to SystemJS. 2017-02-27 08:32:39 -06:00
util_spec.js Move worker-thread only functions from src/shared/util.js and into a new src/core/core_utils.js file 2019-02-24 00:35:39 +01:00