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

Refactor the DownloadManager initialization in GENERIC/CHROME builds again (PR 8203 follow-up) #8300

Merged
merged 1 commit into from
Apr 17, 2017
Merged

Refactor the DownloadManager initialization in GENERIC/CHROME builds again (PR 8203 follow-up) #8300

merged 1 commit into from
Apr 17, 2017

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Apr 17, 2017

In the first commit in PR #8203, I changed how the DownloadManager was included/initialized in GENERIC/CHROME builds.
The change was prompted by the fact that you cannot have conditional imports with ES6 modules, and I wanted to avoid bundling the general DownloadManager into the various Firefox specific build targets.

What I completely missed though, is that the new code meant that download_manager.js will now be pulling in the entire viewer (through app.js).
This is a really stupid mistake on my part, since it causes the special pdf_viewer.js file used with the viewer components to now include basically the entire default viewer.

The simplest solution that I could come up with, is to add a genericcom.js file (similar to the firefoxcom.js/chromecom.js files) which will be responsible for importing/initializing the DownloadManager.

This should fix the remaining warnings in issue #8292, and also restores the viewer components specific pdf_viewer.js file to its intended scope/size.

Edit: Adding the genericcom.js file might seem a bit unnecessary at the moment, however I've got an idea for refactoring of https://github.com/mozilla/pdf.js/blob/master/web/preferences.js into a proper class and that work would leverage the new genericcom.js file.

…uilds again (PR 8203 follow-up)

In the first commit in PR 8203, I changed how the `DownloadManager` was included/initialized in `GENERIC`/`CHROME` builds.
The change was prompted by the fact that you cannot have conditional `import`s with ES6 modules, and I wanted to avoid bundling the general `DownloadManager` into the various Firefox specific build targets.

What I completely missed though, is that the new code meant that `download_manager.js` will now be pulling in the *entire* viewer (through `app.js`).
This is a *really* stupid mistake on my part, since it causes the `dist/build/pdf_viewer.js` used with the viewer components to now include basically the entire default viewer.

The simplest solution that I could come up with, is to add a `genericcom.js` file (similar to the `firefoxcom.js`/`chromecom.js` files) which will be responsible for importing/initializing the `DownloadManager`.
@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/af08fd5825fd3ff/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/af08fd5825fd3ff/output.txt

Total script time: 3.02 mins

Published

Copy link
Contributor

@yurydelendik yurydelendik left a comment

Choose a reason for hiding this comment

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

looks good, thank you

@yurydelendik yurydelendik merged commit 5ad3611 into mozilla:master Apr 17, 2017
@Snuffleupagus Snuffleupagus deleted the GENERIC-DownloadManager-creation branch April 17, 2017 13:51
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…nager-creation

Refactor the `DownloadManager` initialization in `GENERIC`/`CHROME` builds again (PR 8203 follow-up)
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