Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minified-es5 fails to "load" / correctly handle defective pdf-files #11941

Closed
pfeldbaumer opened this issue May 29, 2020 · 0 comments · Fixed by #12210
Closed

minified-es5 fails to "load" / correctly handle defective pdf-files #11941

pfeldbaumer opened this issue May 29, 2020 · 0 comments · Fixed by #12210
Labels

Comments

@pfeldbaumer
Copy link

pfeldbaumer commented May 29, 2020

Configuration:
latest master / beta 2.4.456
minified-es5 build
various (chromium) based browser-versions (from .49 to .81)

Steps to reproduce the problem:
call pdfjs.getDocument(path_to_invalid_pdf_file) with minified-es5 pdf.js and pdf.worker.js
use e.g. any text-document as "path_to_invalid_pdf_file" (so a valid file, but no pdf-document)

Expected behavior:
PDFDocumentLoadingTask.promise should get rejected with an InvalidPDFException as parameter

Observed behaviour:
code throws an (unhandled) exception "Unhandled promise rejection TypeError: Cannot read property 'message' of undefined"

In current minified-es5 builds calling .getDocument(path_to_invalid_pdf_file) does not correctly "work", it leads to:
Unhandled promise rejection TypeError: Cannot read property 'message' of undefined
at main.js:...
at lib/pdf.min.js:22:64582
at MutationObserver.n (lib/pdf.min.js:22:69954)

instead of rejecting the promise on the PDFDocumentLoadingTask.

This happens with any "invalid" pdf-file (e.g. a text-document instead of a "real" pdf), loading a "valid" pdf however works absolutely correctly (with any version, also minified-es5).
Using a generic-es5 build produces the expected result (an InvalidPDFException is thrown).

The problem itself however seems to originitate in (minified-es5) pdf.worker.js, because using minified pdf.js with non-minified pdf.worker.js behaves as expected?

ps: did not test with es6 (minified)..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants