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

[Regression] Prevent the *built* pdf.scripting.js/pdf.sandbox.js files from accidentally including most of the main-thread code (PR 12631 follow-up) #12693

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

This is a recent regression, which I stumbled upon while working on cleaning-up the gulpfile related to pdf.sandbox.js building.

By placing the ColorConverters functionality in the src/display/display_utils.js file, you end up including a significant chunk of the pdf.js file in the built pdf.scripting.js/pdf.sandbox.js files.
Given that I cannot imagine that this was actually intended, since it inflates the built files with unnecessary/unused code, this moves ColorConverters to a new file instead (thus breaking the dependencies).

To hopefully reduce the risk future bugs, along these lines, a big comment is also placed at the top of the new file.
Finally, the ColorConverters is converted to a class with static methods, since this felt slightly cleaner overall.

…files from accidentally including most of the main-thread code (PR 12631 follow-up)

*This is a recent regression, which I stumbled upon while working on cleaning-up the gulpfile related to `pdf.sandbox.js` building.*

By placing the `ColorConverters` functionality in the `src/display/display_utils.js` file, you end up including a *significant* chunk of the `pdf.js` file in the built `pdf.scripting.js`/`pdf.sandbox.js` files.
Given that I cannot imagine that this was actually intended, since it inflates the built files with unnecessary/unused code, this moves `ColorConverters` to a new file instead (thus breaking the dependencies).

To hopefully reduce the risk future bugs, along these lines, a big comment is also placed at the top of the new file.
Finally, the `ColorConverters` is converted to a class with static methods, since this felt slightly cleaner overall.
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.

Thanks for doing that.
I supposed that unused code was striped out, TIL.

@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

pdfjsbot commented Dec 4, 2020

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/5c26286267f061f/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 4, 2020

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/05e464eda16efaf/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 4, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/05e464eda16efaf/output.txt

Total script time: 3.58 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Dec 4, 2020

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/5c26286267f061f/output.txt

Total script time: 4.76 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit 54ca67d into mozilla:master Dec 4, 2020
@timvandermeij
Copy link
Contributor

Thanks!

@Snuffleupagus Snuffleupagus deleted the mv-ColorConverters branch December 5, 2020 10:05
}

static CMYK_HTML(components) {
return this.RGB_HTML(this.CMYK_RGB(components));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be

return this.RGB_HTML(this.CMYK_RGB(components).slice(1));

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.

5 participants