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

Move handling of the PageOpen/PageClose events into the PDFScriptingManager (PR 13042 follow-up) #13054

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Mar 5, 2021

By moving this code from the BaseViewer and into PDFScriptingManager, all of the scripting initialization/handling code is now limited to just one file/class which help overall readability (in my opinion). Also, this patch is a net reduction in number of lines of code which can never hurt.

As part of these changes, the intermediary "pageopen"/"pageclose" events are now removed in favor of using the "regular" viewer events directly in PDFScriptingManager. Hence this removes some (strictly unnecessary) indirection in the current code, when handling PageOpen/PageClose events, which leads to overall fewer function calls in this part of the code.

Slightly smaller/easier diff with https://github.com/mozilla/pdf.js/pull/13054/files?w=1

@Snuffleupagus Snuffleupagus changed the title Move handling of the PageOpen/PageClose events into the PDFScriptingManager (PR 13042 follow-up Move handling of the PageOpen/PageClose events into the PDFScriptingManager (PR 13042 follow-up) Mar 5, 2021
@Snuffleupagus Snuffleupagus force-pushed the scripting-pageOpenClose branch from 4a0c163 to 05f4f2e Compare March 5, 2021 23:23
Comment on lines +101 to +104
if (event?.source !== window) {
return;
}
Copy link
Collaborator Author

@Snuffleupagus Snuffleupagus Mar 5, 2021

Choose a reason for hiding this comment

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

While this is probably not necessary, it's a "better safe than sorry"-type of check I forgot to add in PR #13042

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2021

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

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2021

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/3db7f233efb79c0/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2021

From: Bot.io (Linux m4)


Success

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

Total script time: 3.07 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Mar 5, 2021

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/3db7f233efb79c0/output.txt

Total script time: 5.01 mins

  • Integration Tests: Passed

@Snuffleupagus Snuffleupagus force-pushed the scripting-pageOpenClose branch from 05f4f2e to 65b0324 Compare March 6, 2021 09:01
@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

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/730659ef044e471/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/730659ef044e471/output.txt

Total script time: 3.99 mins

Published

@Snuffleupagus Snuffleupagus force-pushed the scripting-pageOpenClose branch from 65b0324 to df523e3 Compare March 6, 2021 09:09
…Manager` (PR 13042 follow-up)

By moving this code from the `BaseViewer` and into `PDFScriptingManager`, all of the scripting initialization/handling code is now limited to just one file/class which help overall readability (in my opinion). Also, this patch is a *net reduction* in number of lines of code which can never hurt.

As part of these changes, the intermediary "pageopen"/"pageclose" events are now removed in favor of using the "regular" viewer events directly in `PDFScriptingManager`. Hence this removes some (strictly unnecessary) indirection in the current code, when handling PageOpen/PageClose events, which leads to overall fewer function calls in this part of the code.
@Snuffleupagus Snuffleupagus force-pushed the scripting-pageOpenClose branch from df523e3 to 87dd93b Compare March 6, 2021 09:12
@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

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

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/935aae3c2e61ade/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Linux m4)


Failed

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

Total script time: 3.50 mins

  • Integration Tests: FAILED

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/935aae3c2e61ade/output.txt

Total script time: 5.11 mins

  • Integration Tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

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

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/207f470c19968b9/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Linux m4)


Success

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

Total script time: 3.05 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/207f470c19968b9/output.txt

Total script time: 5.23 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

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/1e0a031f08ed765/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Mar 6, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/1e0a031f08ed765/output.txt

Total script time: 4.06 mins

Published

@timvandermeij timvandermeij merged commit 709c57a into mozilla:master Mar 6, 2021
@timvandermeij
Copy link
Contributor

Thank you for simplifying this!

@Snuffleupagus Snuffleupagus deleted the scripting-pageOpenClose branch March 6, 2021 19:58
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