pdf.js/test
Jonas Jenwald 547f119be6 Simplify the error handling slightly in the src/display/node_stream.js file
The various classes have `this._errored` and `this._reason` properties, where the first one is a boolean indicating if an error was encountered and the second one contains the actual `Error` (or `null` initially).

In practice this means that errors are basically tracked *twice*, rather than just once. This kind of double-bookkeeping is generally a bad idea, since it's quite easy for the properties to (accidentally) get into an inconsistent state whenever the relevant code is modified.

Rather than using a separate boolean, we can just as well check the "error" property directly (since `null` is falsy).

---

Somewhat unrelated to this patch, but `src/display/node_stream.js` is currently *not* handling errors in a consistent or even correct way; compared with `src/display/network.js` and `src/display/fetch_stream.js`.
Obviously using the `createResponseStatusError` utility function, from `src/display/network_utils.js`, might not make much sense in a Node.js environment. However at the *very* least it seems that `MissingPDFException`, or `UnknownErrorException` when one cannot tell that the PDF file is "missing", should be manually thrown.

As is, the API (i.e. `getDocument`) is not returning the *expected* errors when loading fails in Node.js environments (as evident from the `pending` API unit-test).
2018-06-06 09:05:45 +02:00
..
chromium 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
features Remove usage of mozFillRule 2017-01-29 23:24:44 +01:00
font Use fs.unlinkSync instead of fs.unlink when removing files in the font tests 2018-06-03 22:17:05 +02:00
pdfs Ignore the rest of the image when encountering an EOI (End of Image) marker while parsing Scan data (issue 9679) 2018-05-30 22:40:11 +02:00
resources Bots: disable the default browser test and enable E10s 2017-04-27 20:39:57 +02:00
stats Enable the mozilla/use-includes-instead-of-indexOf ESLint rule globally 2018-02-10 23:24:50 +01:00
ttx Update fonttools location and version (issue 6223) 2015-07-17 12:51:09 +02:00
unit Simplify the error handling slightly in the src/display/node_stream.js file 2018-06-06 09:05:45 +02:00
.eslintrc Removes shelljs 2017-05-19 07:53:05 -05:00
.gitignore Ignore test snapshots directory. 2013-03-15 11:24:08 -07:00
annotation_layer_builder_overrides.css Provide a prefixed appearance CSS rule for reference testing in Chrome 2018-04-08 13:54:16 +02:00
downloadutils.js Enable the mozilla/use-includes-instead-of-indexOf ESLint rule globally 2018-02-10 23:24:50 +01:00
driver.js Rename the globals to shorter names. 2018-03-16 11:08:56 -07:00
test_manifest.json Ignore the rest of the image when encountering an EOI (End of Image) marker while parsing Scan data (issue 9679) 2018-05-30 22:40:11 +02:00
test_slave.html Use the SimpleLinkService when running "annotations" reference tests 2017-09-12 15:24:46 +02:00
test.js Use fs.unlinkSync instead of fs.unlink when removing eq.log 2018-05-28 23:48:20 +02:00
testutils.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
text_layer_test.css Better "text" testing. 2015-11-19 11:03:52 -06:00
webbrowser.js Enable the mozilla/use-includes-instead-of-indexOf ESLint rule globally 2018-02-10 23:24:50 +01:00
webserver.js Add test for withCredentials option 2017-08-31 14:30:00 +02:00