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

Fix a couple of edge-cases in PDFViewerApplication._initializeJavaScript (PR 12432 follow-up) #12522

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

  • Return early in PDFViewerApplication._initializeJavaScript for PDF documents without any fieldObjects, which is the vast majority of all documents, to prevent errors when trying to parse a non-existent object.

  • Similar to the other PDFViewerApplication._initialize* methods, ignore the fieldObjects if the document was closed before the data resolved.

  • Fix the JSDoc comment for the generateRandomStringForSandbox helper function, since there's currently a bit too much copy-and-paste going on :-)

  • Change FirefoxScripting to a class with static methods, which is consistent with the surrounding code in web/firefoxcom.js.

…ript` (PR 12432 follow-up)

 - Return early in `PDFViewerApplication._initializeJavaScript` for PDF documents without any `fieldObjects`, which is the vast majority of all documents, to prevent errors when trying to parse a non-existent object.

 - Similar to the other `PDFViewerApplication._initialize*` methods, ignore the `fieldObjects` if the document was closed before the data resolved.

 - Fix the JSDoc comment for the `generateRandomStringForSandbox` helper function, since there's currently a bit too much copy-and-paste going on :-)

 - Change `FirefoxScripting` to a class with static methods, which is consistent with the surrounding code in `web/firefoxcom.js`.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/4256d5d1146b7f4/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/4256d5d1146b7f4/output.txt

Total script time: 3.98 mins

Published

@timvandermeij timvandermeij merged commit e8e029d into mozilla:master Oct 24, 2020
@timvandermeij
Copy link
Contributor

Thank you for improving this code!

@Snuffleupagus Snuffleupagus deleted the _initializeJavaScript-fixes branch October 24, 2020 14:25
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 this pull request may close these issues.

3 participants