-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Firefox] Lazy load network.js in PdfStreamConverter.js #4501
[Firefox] Lazy load network.js in PdfStreamConverter.js #4501
Conversation
Nice! |
While we're here: the other pdf.js compartments seen at start-up: [System Principal], resource://pdf.js/default_preferences.js Are they all necessary? If so, could any be combined easily? default_preferences.js is tiny... |
The way that the code is currently structured, I think most of them are. Both PdfStreamConverter.jsm and PdfRedirector.jsm are then (indirectly) loaded by https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/content/PdfJs.jsm#L111 (https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/content/PdfJs.jsm#L244).
I don't know enough about these parts of the code base to answer that, sorry!
Yes, and I have a patch ready that use the preprocessor to include this code where necessary. However, I wanted to submit this PR first to gauge the interest in these kind of changes before submitting that one. |
Actually, it seems probable (I haven't tested though) that we could change these to be lazily loaded as well: https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/content/PdfJs.jsm#L37-L38. Edit: It might actually be worthwhile to change this anyway, since they are currently loaded irrespective of whether PDF.js is active or not. |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/b59b9f658a5a0c4/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/b59b9f658a5a0c4/output.txt Total script time: 0.40 mins Published
|
[Firefox] Lazy load network.js in PdfStreamConverter.js
Thanks |
Inspired by this thread, started by @nnethercote on dev.platform: https://groups.google.com/forum/#!topic/mozilla.dev.platform/sAuhWQOAWic.
This PR changes
network.js
to be lazily loaded instead, to delay loading it until it's needed and to avoid affecting the browser start-up.I my testing this works fine, and given that we already lazy load other modules (e.g.
PdfJsTelemetry.jsm
) I don't think that there should be any issues with this change.