pdf.js/src
Jonas Jenwald 3351d3476d Don't store complex data in PDFDocument.formInfo, and replace the fields object with a hasFields boolean instead
*This patch is based on a couple of smaller things that I noticed when working on PR 12479.*

 - Don't store the /Fields on the `formInfo` getter, since that feels like overloading it with unintended (and too complex) data, and utilize a `hasFields` boolean instead.
   This functionality was originally added in PR 12271, to help determine what kind of form data a PDF document contains, and I think that we should ensure that the return value of `formInfo` only consists of "simple" data.
   With these changes the `fieldObjects` getter instead has to look-up the /Fields manually, however that shouldn't be a problem since the access is guarded by a `formInfo.hasFields` check which ensures that the data both exists and is valid. Furthermore, most documents doesn't even have any /AcroForm data anyway.

 - Determine the `hasFields` property *first*, to ensure that it's always correct even if there's errors when checking e.g. the /XFA or /SigFlags entires, since the `fieldObjects` getter depends on it.

 - Simplify a loop in `fieldObjects`, since the object being accessed is a `Map` and those have built-in iteration support.

 - Use a higher logging level for errors in the `formInfo` getter, and include the actual error message, since that'd have helped with fixing PR 12479 a lot quicker.

 - Update the JSDoc comment in `src/display/api.js` to list the return values correctly, and also slightly extend/improve the description.
2020-10-16 12:47:27 +02:00
..
core Don't store complex data in PDFDocument.formInfo, and replace the fields object with a hasFields boolean instead 2020-10-16 12:47:27 +02:00
display Don't store complex data in PDFDocument.formInfo, and replace the fields object with a hasFields boolean instead 2020-10-16 12:47:27 +02:00
images Vectorize the logo. 2012-10-29 14:08:52 -04:00
shared Add the possibility to collect Javascript actions 2020-10-14 10:44:16 +02:00
.eslintrc Re-factor how the ESLint no-var rule is enabled in the src/ folder 2020-10-03 20:15:29 +02:00
doc_helper.js [api-major] Completely remove the global PDFJS object 2018-03-01 18:13:27 +01:00
interfaces.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
license_header_libre.js Update the year in the license_header files 2020-01-05 12:14:03 +01:00
license_header.js Update the year in the license_header files 2020-01-05 12:14:03 +01:00
pdf.image_decoders.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.js [api-minor] Fix the AnnotationStorage usage properly in the viewer/tests (PR 12107 and 12143 follow-up) 2020-07-31 16:32:46 +02:00
pdf.worker.entry.js Update the year in the license_header files 2020-01-05 12:14:03 +01:00
pdf.worker.js Convert the src/pdf.js and src/pdf.worker.js files to use standard import/export statements 2020-05-20 13:18:23 +02:00
worker_loader.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00