pdf.js/test
Jonas Jenwald 327f2eb588 Ensure that onProgress is always called when the entire PDF file has been loaded, regardless of how it was fetched (issue 10160)
*Please note:* I'm totally fine with this patch being rejected, and the issue closed as WONTFIX; however these changes should address the issue if that's desired.

From a conceptual point of view, reporting loading progress doesn't really make a lot of sense for PDF files opened by passing raw binary data directly to `getDocument` (since obviously *all* data was loaded).
This is compared to PDF files loaded via e.g. `XMLHttpRequest` or the Fetch API, where the entire PDF file isn't available from the start and knowing the loading progress makes total sense.

However I can certainly see why the current API could be considered inconsistent, which isn't great, since a registered `onProgress` callback will never be called for certain `getDocument` calls.
The simplest solution to this inconsistency thus seem to be to ensure that `onProgress` is always called when handling the `DataLoaded` message, since that will *always* be dispatched[1] from the worker-thread.

---
[1] Note that this isn't guaranteed to happen, since setting `disableAutoFetch = true` often prevents the *entire* file from ever loading. However, this isn't relevant for the issue at hand, and is a well-known consequence of using `disableAutoFetch = true`; note how the default viewer even has a specialized code-path for hiding the loadingBar.
2018-10-16 13:51:12 +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 Replace deprecated constructor with 2018-06-11 20:41:56 -07:00
pdfs Add support of Ink annotation 2018-10-03 00:28:49 +02:00
resources Replace String.prototype.substr() occurrences with String.prototype.substring() 2018-09-28 11:41:07 +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 Ensure that onProgress is always called when the entire PDF file has been loaded, regardless of how it was fetched (issue 10160) 2018-10-16 13:51:12 +02:00
.eslintrc Provide custom messages for the no-restricted-globals ESLint rule, and refactor the .eslintrc files (PR 9868 follow-up) 2018-07-23 14:10:13 +02:00
.gitignore Ignore test snapshots directory. 2013-03-15 11:24:08 -07:00
add_test.js Replace String.prototype.substr() occurrences with String.prototype.substring() 2018-09-28 11:41:07 +02: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 Add support of Ink annotation 2018-10-03 00:28:49 +02:00
test_slave.html Use the SimpleLinkService when running "annotations" reference tests 2017-09-12 15:24:46 +02:00
test.js Fail when MD5 of test files fails on bots. 2018-08-03 17:48:47 -07: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 Support running the tests headlessly. 2018-06-05 11:29:58 -07:00
webserver.js Add test for withCredentials option 2017-08-31 14:30:00 +02:00