pdf.js/web
Jonas Jenwald b513c64d9d [api-minor] Convert Catalog.getPageDict to an asynchronous method
Besides converting `Catalog.getPageDict` to an `async` method, thus simplifying the code, this patch also allows us to pro-actively fix a existing issue.
Note how we're looking up References in such a way that `MissingDataException`s won't cause trouble, however it's *technically possible* that the entries (i.e. /Count, /Kids, and /Type) in a /Pages Dictionary could actually be indirect objects as well. In the existing code this could lead to *some*, or even all, pages failing to load/render as intended.
In practice that doesn't *appear* to happen in real-world PDF documents, but given all the weird things that PDF software do I'd prefer to fix this pro-actively (rather than waiting for a bug report).
With `Catalog.getPageDict` being `async` this is now really simple to address, however I didn't want to introduce a bunch more *unconditional* asynchronicity in this method if it could be avoided (since that could slow things down). Hence we'll *synchronously* lookup the *raw* data in a /Pages Dictionary, and only fallback to asynchronous data lookup when a Reference was encountered.

In addition to the above, this patch also makes the following notable changes:
 - Let `Catalog.getPageDict` *consistently* reject with the actual error, regardless of what data we're fetching. Previously we'd "swallow" the actual errors except when looking up Dictionary entries, which is inconsistent and thus seem unfortunate. As can be seen from the updated unit-tests this change is API-observable, hence why the patch is tagged `[api-minor]`.

 - Improve the consistency of the Dictionary /Type-checks in both the `Catalog.getPageDict` and `Catalog.getAllPageDicts` methods.
   In `Catalog.getPageDict` there's a fallback code-path where we're *incorrectly* checking the /Page Dictionary for a /Contents-entry, which is wrong since a /Page Dictionary doesn't need to have a /Contents-entry in order to be valid.
   For consistency the `Catalog.getAllPageDicts` method is also updated to handle errors in the /Type-lookup correctly.

 - Reduce the `PagesCountLimit.PAUSE_EAGER_PAGE_INIT` viewer constant, to further improve loading/rendering performance of the *second* page during initialization of very long documents; PR 14359 follow-up.
2021-12-25 15:22:48 +01:00
..
images Add a new Page scrolling mode (issue 2638, 8952, 10907) 2021-10-12 13:45:15 +02:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css [api-minor] Render pushbuttons on their own canvas (bug 1737260) 2021-11-12 15:37:33 +01:00
annotation_layer_builder.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
app_options.js [GENERIC viewer] Warn about AppOptions being overridden by Preferences during loading 2021-09-22 15:43:26 +02:00
app.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
base_tree_viewer.js Remove non-displayable chars from outline title (#14267) 2021-11-13 16:56:08 +01:00
base_viewer.js [api-minor] Convert Catalog.getPageDict to an asynchronous method 2021-12-25 15:22:48 +01:00
chrome-i18n-allow-access-to-file-urls.json Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
chromecom.js Account for formatting changes in Prettier version 2.3.0 2021-05-16 11:44:05 +02:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js Replace the remaining Node.removeChild() instances with Element.remove() 2021-11-16 17:52:50 +01:00
default_factory.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
download_manager.js Fix broken/missing JSDocs and typedefs, to allow updating TypeScript to the latest version (issue 14342) 2021-12-15 23:14:25 +01:00
event_utils.js Move the EventBus, and related functionality, into its own file 2021-12-15 17:18:57 +01:00
firefox_print_service.js Re-factor the CSS_PIXELS_PER_INCH/PDF_PIXELS_PER_INCH exports (PR 13991 follow-up) 2021-09-11 11:15:25 +02:00
firefoxcom.js [Firefox] Handle errors if loading failed before the "supportsRangedLoading" message was sent (bug 1732141) 2021-11-01 17:50:49 +01:00
generic_scripting.js Account for formatting changes in Prettier version 2.3.0 2021-05-16 11:44:05 +02:00
genericcom.js Pass in the "sandboxBundleSrc" option when calling DefaultExternalServices.createScripting 2020-12-23 14:05:49 +01:00
genericl10n.js Fix broken/missing JSDocs and typedefs, to allow updating TypeScript to the latest version (issue 14342) 2021-12-15 23:14:25 +01:00
grab_to_pan.js Convert GrabToPan to a standard class 2021-11-13 23:07:36 +01:00
interfaces.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
l10n_utils.js [GENERIC viewer] Try to fixup "incomplete" language codes (issue 13689) 2021-07-08 12:54:58 +02:00
overlay_manager.js Fix the linting errors, from the Prettier auto-formatting, that ESLint --fix couldn't handle 2019-12-26 12:35:12 +01:00
password_prompt.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
pdf_attachment_viewer.js [api-minor] Support the Content-Disposition filename in the Firefox PDF Viewer (bug 1694556, PR 9379 follow-up) 2021-02-26 10:50:29 +01:00
pdf_cursor_tools.js Remove the useless PresentationModeState.CHANGING-case in PDFCursorTools (PR 12788 follow-up) 2021-02-14 10:39:49 +01:00
pdf_document_properties.js Move the getPdfFilenameFromUrl helper function from web/ui_utils.js and into src/display/display_utils.js 2021-03-17 15:48:24 +01:00
pdf_find_bar.js [api-minor] Change PDFFindController to use the "find"-event directly (issue 12731) 2021-10-16 10:36:22 +02:00
pdf_find_controller.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_find_utils.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
pdf_history.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_layer_viewer.js Account for formatting changes in Prettier version 2.3.0 2021-05-16 11:44:05 +02:00
pdf_link_service.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_outline_viewer.js Tweak the "pagesloaded" event handler in PDFOutlineViewer 2021-12-05 11:04:17 +01:00
pdf_page_view.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_presentation_mode.js Add a new Page scrolling mode (issue 2638, 8952, 10907) 2021-10-12 13:45:15 +02:00
pdf_print_service.js Re-factor the CSS_PIXELS_PER_INCH/PDF_PIXELS_PER_INCH exports (PR 13991 follow-up) 2021-09-11 11:15:25 +02:00
pdf_rendering_queue.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_scripting_manager.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_sidebar_resizer.js Use more optional chaining in the web/-folder (PR 12961 follow-up) 2021-03-07 16:20:52 +01:00
pdf_sidebar.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_thumbnail_view.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_thumbnail_viewer.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_viewer.component.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
pdf_viewer.css Move the permissions handling into the BaseViewer (PR 11789 follow-up) 2021-12-11 17:13:41 +01:00
pdf_viewer.js Move PDFSinglePageViewer into the web/pdf_viewer.js file 2021-10-12 13:45:19 +02:00
pdfjs.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
preferences.js Remove some *indirect* loops in the BasePreferences.getAll-method 2021-03-22 14:38:05 +01:00
print_utils.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
secondary_toolbar.js Enforce PAGE-scrolling for *very* large/long documents (bug 1588435, PR 11263 follow-up) 2021-11-29 13:54:24 +01:00
struct_tree_layer_builder.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
text_highlighter.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
text_layer_builder.css [Google Chrome] Ensure that markedContent spans are placed in the top-left corner (issue 14205) 2021-11-07 11:01:35 +01:00
text_layer_builder.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
toolbar.js [api-minor] Add a wrapper around the addLinkAttributes-function, in the API, to the PDFLinkService implementations 2021-10-02 12:28:00 +02:00
ui_utils.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00
view_history.js Add a bit more validation in the ViewHistory constructor 2020-03-21 13:55:06 +01:00
viewer-snippet-chrome-extension.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer-snippet-chrome-overlays.html [CRX] Add file chooser as fallback (fixes #9411) 2018-03-21 18:21:46 +01:00
viewer-snippet-firefox-extension.html Stop bundling the ReadableStream polyfill in MOZCENTRAL builds (PR 10470 follow-up) 2019-01-23 20:33:20 +01:00
viewer-snippet-minified.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer.css Move the permissions handling into the BaseViewer (PR 11789 follow-up) 2021-12-11 17:13:41 +01:00
viewer.html Remove the PDFSinglePageViewer-specific code from web/secondary_toolbar.js (PR 9877 follow-up) 2021-11-29 13:13:17 +01:00
viewer.js Add a new Page scrolling mode (issue 2638, 8952, 10907) 2021-10-12 13:45:15 +02:00
xfa_layer_builder.css XFA - Fix xfaLink class to make links work (bug 1735738) 2021-10-29 11:39:33 -04:00
xfa_layer_builder.js Move the Default{...}LayerFactory into a new web/default_factory.js file 2021-12-15 23:17:08 +01:00