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

Various PageViewport and MessageHandler cleanup #9777

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Jun 4, 2018

Split off from PR #9729, as requested in #9729 (comment). /cc @timvandermeij

For easier reviewing I'd suggest first of all to look at one commit at a time, and second of all to use the ?w=1 flag to reduce the sizes of some of the diffs.

…e `gulp lib` build target

To avoid having to manually update the "shared files" list in `gulpfile.js`, whenever any changes are made to the file structure in the `src/shared/` folder, let's simply list the files we do *not* want instead.
Given that the excluded files have been consistent ever since the `lib` build target was added, this patch should help avoid unnecessary churn in `gulpfile.js` in the future.
…ls.js`

Since the `PageViewport` is not used in the worker, duplicating this code on both the main and worker sides seems completely unnecessary.
The `fontScale` property was added in PR 1531, see commit mozilla@b312719 in particular, apparently for the sole purpose of supporting the "acroforms" example.

However, the `fontScale` property was never used anywhere else in the code-base, and after the modernization of the "acroforms" example in PR 8030 it's been completely unused.

Finally, note that there's also a (more suitably named) `scale` property on `PageViewport` instances, which contains the exact same information as the property being removed here.
Also converts all `var` to `let` for good measure.
…he JSDoc comments for the class

This changes the constructor to take a parameter object, rather than a string of parameters.
… file

The `MessageHandler` itself, and its assorted helper functions, are currently the single largest[1] piece of code in the `src/shared/util.js` file. By moving this code into its own file, `src/shared/util.js` thus becomes smaller and more manageable.
There's no good reason, as far as I can tell, to duplicate the functionality of the `LoopbackPort` in the unit-tests. The only difference between the implementations is that `LoopbackPort` mimics the (native) structured cloning, however that shouldn't matter here since the tests are only sending "simple" data (strings respectively arrays with numbers).

Furthermore the patch also changes `LoopbackPort` to default to using "structured cloning" and deferred invocation of the listeners, since native typed array support is now a requirement for using the PDF.js library.
@Snuffleupagus Snuffleupagus force-pushed the PageViewport-MessageHandler-cleanup branch from c8dafd2 to 89caaf4 Compare June 4, 2018 10:53
@Snuffleupagus Snuffleupagus changed the title Page viewport message handler cleanup Various PageViewport and MessageHandler cleanup Jun 4, 2018
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2018

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/59d88aaf33c49f4/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2018

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/064b83b7d5a7f98/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2018

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/064b83b7d5a7f98/output.txt

Total script time: 18.95 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2018

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/59d88aaf33c49f4/output.txt

Total script time: 24.55 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/59d88aaf33c49f4/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2018

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/a954ef0f7f0a8a9/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2018

From: Bot.io (Linux m4)


Success

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

Total script time: 2.92 mins

Published

@timvandermeij timvandermeij merged commit 76337fd into mozilla:master Jun 4, 2018
@timvandermeij
Copy link
Contributor

Thank you for fixing this and splitting it up into manageable pull requests!

@Snuffleupagus Snuffleupagus deleted the PageViewport-MessageHandler-cleanup branch June 5, 2018 06:38
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…geHandler-cleanup

Various `PageViewport` and `MessageHandler` cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants