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

Ensure that printing, triggered from scripting, won't accidentally throw in PDFScriptingManager._updateFromSandbox #13104

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

The issue that this patch fixes is extremely unlikely, but still theoretically possible, and I really should've caught this earlier.
Note how BaseViewer.pagesPromise will only be defined when a document is active, see below, and that if a printing event (triggered from scripting) arrives while the document is been closed there's a small chance that the promise isn't defined.

pdf.js/web/base_viewer.js

Lines 426 to 428 in eb92ed1

get pagesPromise() {
return this.pdfDocument ? this._pagesCapability.promise : null;
}

…row in `PDFScriptingManager._updateFromSandbox`

The issue that this patch fixes is extremely unlikely, but still theoretically possible, and I really should've caught this earlier.
Note how `BaseViewer.pagesPromise` will only be defined when a document is active, see below, and that if a printing event (triggered from scripting) arrives while the document is been closed there's a small chance that the promise isn't defined.

https://github.com/mozilla/pdf.js/blob/eb92ed12f202de4cc8b0060aac1f1a06b26f83a4/web/base_viewer.js#L426-L428
@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/143dee77f40c3e1/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/aeb18d469d2f31f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/143dee77f40c3e1/output.txt

Total script time: 4.65 mins

  • Integration Tests: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/aeb18d469d2f31f/output.txt

Total script time: 4.86 mins

  • Integration Tests: Passed

Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thank you for fixing this.

@calixteman calixteman merged commit d92b77e into mozilla:master Mar 16, 2021
@Snuffleupagus Snuffleupagus deleted the scripting-await-print branch March 16, 2021 13:57
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.

4 participants