pdf.js/web
Jonas Jenwald 625f8a6f51 Refactor/simplify the "delayedFallback" handling in the default viewer
There's a few things that could be improved in the current implementation, such as:
 - It's currently necessary to *both* manually track the `featureId`s which should trigger delayed fallback, as well as manually report telemetry in affected cases.
Obviously there's only two call-sites as of now (forms and javaScript), but it still feels somewhat error-prone especially if more cases were to be added in the future. To address this, this patch adds a new (private) method which abstracts away these details from the call-sites.

 - Generally, it also seems nice to reduce *and* simplify the amount of state we need to store on `PDFViewerApplication` in order to support the "delayedFallback" functionality.
Also, having to *manually* work with the "delayedFallback"-array in multiple places feels cumbersome and makes e.g. the `PDFViewerApplication.fallback` method less clear as to its behaviour.

 - Having code *outside* of `PDFViewerApplication`, i.e. in the event handlers, directly access properties which are marked as "private" via a leading underscore doesn't seem that great in general.
Furthermore, having the event handlers directly deal with that should be internal state also seem unfortunate. To address this, the patch will instead make use of a new `PDFViewerApplication.triggerDelayedFallback` callback.

 - There's at least one code-path in the viewer, see `PDFViewerApplication.error`, where `fallback` can be called without an argument.
It's currently possible (although maybe somewhat unlikely) that such a call *could* be overridden by the `featureId` of a pending "delayedFallback" call, thus not reporting the *correct* fallback reason.

 - The "delayedFallback"-state weren't being reset on document close (which shouldn't affect Firefox, but nonetheless it ought to be fixed).
2020-07-08 15:30:07 +02:00
..
images Replace the RTL images with CSS transforms of the standard images (issue 11766) 2020-03-30 22:47:49 +02:00
.eslintrc Enable the ESLint prefer-const rule globally (PR 11450 follow-up) 2020-01-25 00:20:22 +01:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css Convert all six-digit HEX colors to RGBA colors 2020-01-01 14:52:37 +01:00
annotation_layer_builder.js Ensure that all import and require statements, in the entire code-base, have a .js file extension 2020-01-04 13:01:43 +01:00
app_options.js [api-minor] Remove the disableCreateObjectURL option from the getDocument parameters, since it's now unused in the API 2020-05-22 00:22:48 +02:00
app.js Refactor/simplify the "delayedFallback" handling in the default viewer 2020-07-08 15:30:07 +02:00
base_viewer.js Enable the dot-notation ESLint rule 2020-04-17 12:24:46 +02: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 Update Prettier to version 2.0 2020-04-14 12:28:14 +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 Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
download_manager.js [api-minor] Remove the disableCreateObjectURL option from the getDocument parameters, since it's now unused in the API 2020-05-22 00:22:48 +02:00
firefox_print_service.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
firefoxcom.js Use the native URL.createObjectURL method more in web/firefoxcom.js 2020-04-24 11:29:33 +02:00
genericcom.js Re-factor the various ExternalServices, used in the default viewer, to classes with static methods 2020-01-15 14:26:47 +01:00
genericl10n.js Enable import/extensions of ESlint plugin to enforce all import have a .js file extension. 2020-01-18 10:53:01 +09:00
grab_to_pan.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
interfaces.js [api-minor] Deprecate getGlobalEventBus and update the "viewer components" examples accordingly 2020-02-27 14:44:48 +01: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 Ensure that all import and require statements, in the entire code-base, have a .js file extension 2020-01-04 13:01:43 +01:00
pdf_attachment_viewer.js [api-minor] Remove the disableCreateObjectURL option from the getDocument parameters, since it's now unused in the API 2020-05-22 00:22:48 +02:00
pdf_cursor_tools.js Re-factor the EventBus to allow servicing of "external" event listeners *after* the viewer components have updated 2020-02-27 19:38:13 +01:00
pdf_document_properties.js Remove unnecessary empty string fallback from the getPDFFileNameFromURL call in web/pdf_document_properties.js (PR 10114 follow-up) 2020-05-20 12:09:04 +02:00
pdf_find_bar.js [api-minor] Remove the getGlobalEventBus viewer functionality (PR 11631 follow-up) 2020-03-29 12:20:23 +02:00
pdf_find_controller.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02: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 Attempt to respect the "zoom" hash parameter, even when the "nameddest" parameter is present (issue 11875) 2020-05-07 13:53:07 +02:00
pdf_link_service.js Attempt to respect the "zoom" hash parameter, even when the "nameddest" parameter is present (issue 11875) 2020-05-07 13:53:07 +02:00
pdf_outline_viewer.js Re-factor the EventBus to allow servicing of "external" event listeners *after* the viewer components have updated 2020-02-27 19:38:13 +01:00
pdf_page_view.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
pdf_presentation_mode.js Add passive: false when removing wheel listeners 2020-03-25 22:42:27 +08:00
pdf_print_service.js [api-minor] Remove the disableCreateObjectURL option from the getDocument parameters, since it's now unused in the API 2020-05-22 00:22:48 +02:00
pdf_rendering_queue.js Prevent circular references in the /Pages tree 2020-02-19 01:49:39 +01:00
pdf_sidebar_resizer.js Re-factor the EventBus to allow servicing of "external" event listeners *after* the viewer components have updated 2020-02-27 19:38:13 +01:00
pdf_sidebar.js Remove variable shadowing from the JavaScript files in the web/ folder 2020-03-13 12:59:58 +01:00
pdf_single_page_viewer.js Rename BaseViewer._setDocumentViewerElement to BaseViewer._viewerElement 2020-03-24 16:54:37 +01:00
pdf_thumbnail_view.js Add basic support for the nullish coalescing operator ?? 2020-06-12 15:16:54 +02:00
pdf_thumbnail_viewer.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
pdf_viewer.component.js [api-minor] Deprecate getGlobalEventBus and update the "viewer components" examples accordingly 2020-02-27 14:44:48 +01:00
pdf_viewer.css Convert all named colors to RGBA colors 2020-01-01 14:48:56 +01:00
pdf_viewer.js Rename BaseViewer._setDocumentViewerElement to BaseViewer._viewerElement 2020-03-24 16:54:37 +01: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 the SystemJS dependency from the web/preferences.js file 2020-05-16 16:22:15 +02:00
secondary_toolbar.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
text_layer_builder.css Convert all RGB colors to RGBA colors 2020-01-01 14:48:55 +01:00
text_layer_builder.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
toolbar.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
ui_utils.js [Firefox] Allow PDF attachments to, once again, be opened directly in the browser (bug 1632644) 2020-05-20 12:08:59 +02:00
view_history.js Add a bit more validation in the ViewHistory constructor 2020-03-21 13:55:06 +01:00
viewer_compatibility.js [api-minor] Remove the disableCreateObjectURL option from the getDocument parameters, since it's now unused in the API 2020-05-22 00:22:48 +02: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 Add a new pdfjs.enablePermissions preference, off by default, to allow the PDF documents to disable copying in the viewer (bug 792816) 2020-04-08 18:20:47 +02:00
viewer.html Reduce usage of SystemJS, in the development viewer, even further 2020-05-20 13:36:52 +02:00
viewer.js Reduce usage of SystemJS, in the development viewer, even further 2020-05-20 13:36:52 +02:00