Skip to content

Re-factor the PDFScriptingManager._destroyScripting method (PR 13042 follow-up) #13074

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

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Mar 10, 2021

Please note: Given the pre-existing issues raised in PR #13056, which seem to block immediate progress there, this patch extracts some overall improvements of the scripting/sandbox destruction in PDFScriptingManager.

As can be seen in BaseViewer.setDocument, it's currently necessary to manually delay the PDFScriptingManager-destruction in order for things to work correctly. This is, in hindsight, obviously an extremely poor design choice on my part; sorry about the churn here!

In order to improve things overall, the PDFScriptingManager._destroyScripting-method is re-factored to wait for the relevant events to be dispatched before sandbox-destruction occurs.
To avoid the scripting/sandbox-destruction hanging indefinitely, we utilize a timeout to force-destroy the sandbox after a short time (currently set to 1 second).

…2 follow-up)

*Please note:* Given the pre-existing issues raised in PR 13056, which seem to block immediate progress there, this patch extracts some *overall* improvements of the scripting/sandbox destruction in `PDFScriptingManager`.

As can be seen in `BaseViewer.setDocument`, it's currently necessary to *manually* delay the `PDFScriptingManager`-destruction in order for things to work correctly. This is, in hindsight, obviously an *extremely poor* design choice on my part; sorry about the churn here!

In order to improve things overall, the `PDFScriptingManager._destroyScripting`-method is re-factored to wait for the relevant events to be dispatched *before* sandbox-destruction occurs.
To avoid the scripting/sandbox-destruction hanging indefinitely, we utilize a timeout to force-destroy the sandbox after a short time (currently set to 1 second).
@Snuffleupagus Snuffleupagus force-pushed the scripting-refactor-destroy branch from 8b339bf to 52a5989 Compare March 10, 2021 12:08
@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@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/a0780c57e1c1bdb/output.txt

@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/23fe8e79bebaa87/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/23fe8e79bebaa87/output.txt

Total script time: 3.10 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 4.72 mins

  • Integration Tests: Passed

@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/c8777a8653848e8/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/c8777a8653848e8/output.txt

Total script time: 4.27 mins

Published

@timvandermeij timvandermeij merged commit 6af9b64 into mozilla:master Mar 12, 2021
@timvandermeij
Copy link
Contributor

Thank you for improving this!

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