pdf.js/src/core
Jonas Jenwald 168c6aecae Stop caching Streams in XRef.fetchCompressed
I'm slightly surprised that this hasn't actually caused any (known) bugs, but that may be more luck than anything else since it fortunately doesn't seem common for Streams to be defined inside of an 'ObjStm'.[1]

Note that in the `XRef.fetchUncompressed` method we're *not* caching Streams, and that for very good reasons too.

 - Streams, especially the `DecodeStream` ones, can become *very* large once read. Hence caching them really isn't a good idea simply because of the (potential) memory impact of doing so.

 - Attempting to read from the *same* Stream more than once won't work, unless it's `reset` in between, since using any method such as e.g. `getBytes` always starts at the current data position.

 - Given that even the `src/core/` code is now fairly asynchronous, see e.g. the `PartialEvaluator`, it's generally impossible to assert that any one Stream isn't being accessed "concurrently" by e.g. different `getOperatorList` calls. Hence `reset`-ing a cached Streams isn't going to work in the general case.

All in all, I cannot understand why it'd ever be correct to cache Streams in the `XRef.fetchCompressed` method.

---
[1] One example where that happens is the `issue3115r.pdf` file in the test-suite, where the streams in question are not actually used for anything within the PDF.js code.
2019-11-30 10:21:08 +01:00
..
annotation.js Consistently use @returns for returned data types in JSDoc comments 2019-10-13 13:58:17 +02:00
arithmetic_decoder.js Convert src/core/arithmetic_decoder.js to ES6 syntax 2019-01-06 15:04:01 +01:00
bidi.js Fix inconsistent spacing and trailing commas in objects in src/core/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on 2017-06-02 11:20:19 +02:00
ccitt_stream.js Extract the actual decoding in CCITTFaxStream into a new CCITTFaxDecoder "class", which the new CCITTFaxStream depends on 2017-10-24 16:03:08 +02:00
ccitt.js Consistently use square brackets for optional parameters in JSDoc comments 2019-10-13 13:58:17 +02:00
cff_parser.js Put the string name of the glyph in the charset array. 2019-03-01 18:03:51 -08:00
charsets.js Convert src/core/charsets.js and src/core/standard_fonts.js to ES6 syntax 2019-01-06 15:04:01 +01:00
chunked_stream.js Ensure that the peekByte methods, on the various Streams, handles end of data correctly (PR 5286 follow-up) 2019-11-01 18:22:33 +01:00
cmap.js Enable the getter-return, no-dupe-else-if, and no-setter-return ESLint rules 2019-11-23 11:40:30 +01:00
colorspace.js Consistently use number for numeric data types in JSDoc comments 2019-10-13 13:58:13 +02:00
core_utils.js Consistently use @returns for returned data types in JSDoc comments 2019-10-13 13:58:17 +02:00
crypto.js Implement the AESBaseCipher class and let the AES128Cipher and AES256Cipher classes extend it 2018-02-03 20:16:33 +01:00
document.js Remove outdated, and misleading, JSDoc comment from the PDFDocument class 2019-11-25 11:36:29 +01:00
encodings.js Implement unit tests for the encodings and fix missing items 2017-12-24 18:14:40 +01:00
evaluator.js Allow skipping of errors when parsing broken/unsupported ColorSpaces (issue 6707, issue 11287) 2019-11-01 09:01:24 +01:00
font_renderer.js Map all glyphs to the private use area and duplicate the first glyph. 2018-09-05 14:04:54 -07:00
fonts.js Add a fallback for non-embedded *composite* Verdana fonts (issue 11242) 2019-10-17 17:00:55 +02:00
function.js Use Dict.getArray, instead of Dict.get, when getting the 'Size' in constructSampled in src/core/function.js (PR 7295 follow-up) 2018-06-02 11:16:05 -04:00
glyphlist.js Add a work-around, in glyphlist.js, for bad PDF generators which use a non-standard /f_f string in the Encoding dictionary when referring to the ff ligature (issue 11016) 2019-07-30 17:06:58 +02:00
image_utils.js Move NativeImageDecoder into a separate file, and convert it to a class 2019-03-09 15:59:04 +01:00
image.js Consistently use number for numeric data types in JSDoc comments 2019-10-13 13:58:13 +02:00
jbig2_stream.js Fix the interface of JpegStream/JpxStream/Jbig2Stream to agree with the other DecodeStreams 2017-11-11 11:22:16 +01:00
jbig2.js Convert the various image decoder ...Errors to classes extending BaseException (PR 11185 follow-up) 2019-10-01 13:10:14 +02:00
jpeg_stream.js Add a new parameter to JpegImage.getData to indicate the source of the image data (issue 9513) 2018-09-02 14:15:22 +02:00
jpg.js Convert the various image decoder ...Errors to classes extending BaseException (PR 11185 follow-up) 2019-10-01 13:10:14 +02:00
jpx_stream.js Fix the interface of JpegStream/JpxStream/Jbig2Stream to agree with the other DecodeStreams 2017-11-11 11:22:16 +01:00
jpx.js Convert the various image decoder ...Errors to classes extending BaseException (PR 11185 follow-up) 2019-10-01 13:10:14 +02:00
metrics.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
murmurhash3.js Convert MurmurHash3_64 to an ES6 class 2019-03-09 17:03:06 +01:00
obj.js Stop caching Streams in XRef.fetchCompressed 2019-11-30 10:21:08 +01:00
operator_list.js Consistently use @type for getter data types in JSDoc comments 2019-10-13 13:58:17 +02:00
parser.js Reduce the number of temporary variables in the Parser.getObj method 2019-08-16 13:51:41 +02:00
pattern.js Avoid floating point inaccuracy in gradient color stops 2019-09-17 21:01:17 +03:00
pdf_manager.js Ensure that ReadableStreams are cancelled with actual Errors 2019-08-01 16:40:46 +02:00
primitives.js Reduce the number of function calls in the Dict class 2019-09-24 08:31:39 +02:00
ps_parser.js Convert src/core/charsets.js and src/core/standard_fonts.js to ES6 syntax 2019-01-06 15:04:01 +01:00
standard_fonts.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
stream.js Use getBytes, rather than looping over getByte, in FlateStream.prototype.readBlock 2019-11-15 15:45:31 +01:00
type1_parser.js For Type1 fonts, replace missing font dictionary /Widths entries with ones from the font data (issue 11150) 2019-09-18 10:15:09 +02:00
unicode.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
worker_stream.js Move PDFWorkerStream and related code to its own file 2019-06-15 13:05:25 +02:00
worker.js Change isNodeJS from a function to a constant 2019-11-10 16:44:29 +01:00