pdf.js/web
Tim van der Meij 280207c740
Redo the form type detection logic and include unit tests
Good form type detection is important to get reliable telemetry and to
only show the fallback bar if a form cannot be filled out by the user.

PDF.js only supports AcroForm data, so XFA data is explicitly unsupported
(tracked in issue #2373). However, the previous form type detection
couldn't separate AcroForm and XFA well enough, causing form type
telemetry to be incorrect sometimes and the fallback bar to be shown for
forms that could in fact be filled out by the user.

The solution in this commit is found by studying the specification and
the form documents that are available to us. In a nutshell the rules are:

- There is XFA data if the `XFA` entry is a non-empty array or stream.
- There is AcroForm data if the `Fields` entry is a non-empty array and
  it doesn't consist of only document signatures.

The document signatures part was not handled in the old code, causing a
document with only XFA data to also be marked as having AcroForm data.
Moreover, the old code didn't check all the data types.

Now that AcroForm and XFA can be distinguished, the viewer is configured
to only show the fallback bar for documents that only have XFA data. If
a document also has AcroForm data, the viewer can use that to render the
form. We have not found documents where the XFA data was necessary in
that case.

Finally, we include unit tests to ensure that all cases are covered and
move the form type detection out of the `parse` function so that it's
only executed if the document information is actually requested
(potentially making initial parsing a tiny bit faster).
2020-08-25 23:28:55 +02:00
..
images Replaced menu dropdown icon 2020-08-22 12:10:51 +04: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 Also enable renderInteractiveForms by default in the viewer components (PR 12201 follow-up) 2020-08-22 14:24:04 +02:00
app_options.js Enable renderInteractiveForms by default. 2020-08-12 10:28:27 -07:00
app.js Redo the form type detection logic and include unit tests 2020-08-25 23:28:55 +02:00
base_tree_viewer.js Extract common methods from PDFOutlineViewer/PDFAttachmentViewer into a new abstract BaseTreeViewer class 2020-08-05 23:08:06 +02:00
base_viewer.js Also enable renderInteractiveForms by default in the viewer components (PR 12201 follow-up) 2020-08-22 14:24:04 +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 Support file save triggered from the Firefox integrated version. 2020-08-20 18:05:08 -07:00
firefox_print_service.js [api-minor] Fix the annotationStorage parameter in PDFPageProxy.render 2020-08-05 23:02:30 +02:00
firefoxcom.js Support file save triggered from the Firefox integrated version. 2020-08-20 18:05:08 -07: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 Also enable renderInteractiveForms by default in the viewer components (PR 12201 follow-up) 2020-08-22 14:24:04 +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 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 Remove the disableCreateObjectURL option from web/app_options.js 2020-08-10 15:56:30 +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 Return the query with the findcontrols 2020-08-20 11:18:43 +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 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 Extract common methods from PDFOutlineViewer/PDFAttachmentViewer into a new abstract BaseTreeViewer class 2020-08-05 23:08:06 +02:00
pdf_page_view.js Also enable renderInteractiveForms by default in the viewer components (PR 12201 follow-up) 2020-08-22 14:24:04 +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 Remove the disableCreateObjectURL option from web/app_options.js 2020-08-10 15:56:30 +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 Re-factor the "outlineloaded"/"attachmentsloaded" event handlers in PDFSidebar 2020-08-05 23:08:06 +02: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 the zoom dropdown width calculation to work better in locales with long zoom-strings (PR 11077 follow-up) 2020-08-20 09:57:42 +02:00
ui_utils.js Bug 1392361 - Fix zooming sensitivity on macOS 2020-08-12 17:18:50 -04: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 Reduce the leading padding for the numPages span (PR 11077 follow-up) 2020-08-23 16:21:07 +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