Refactor the DownloadManager
initialization in GENERIC
/CHROME
builds again (PR 8203 follow-up)
#8300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the first commit in PR #8203, I changed how the
DownloadManager
was included/initialized inGENERIC
/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 generalDownloadManager
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 (throughapp.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 thefirefoxcom.js
/chromecom.js
files) which will be responsible for importing/initializing theDownloadManager
.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 ofhttps://github.com/mozilla/pdf.js/blob/master/web/preferences.js
into a proper class and that work would leverage the newgenericcom.js
file.