-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Implement Fetch API for streaming PDF loads on Chrome #6126
Comments
Actually to correct that, seems it's already implemented in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1039846 |
Is this perhaps a duplicate of issue #5319? |
Yes I guess so. It appears that it's also possible to do streaming through the normal XHR api, so I'll try that first since it will most likely require less code changes. EDIT: Actually, seems there are substantial advantages to doing this through the Fetch API so that seems preferable. |
See #6348 for additional information. If someone is willing to work on this, feel free to submit a pull request. We must be sure to remain compatible for old browsers, so we probably need a fallback to XHR or a polyfill for fetch() to do so. |
FYI, GitHub published a fetch polyfill. |
Our main use case is progressive fetching portions of the remote file. The solution using Fetch API shall not regress our streaming and range fetching capabilities. |
We use sync-XHR in l10n and cmap components. We shall probably create (blocking?) issues to migrate both to async-XHR/fetch as well. |
@yurydelendik I patched l10n to not use sync XHR a while back (#5739), so only cmaps and fonts need to be fixed. Note that fetch is not yet usable as a full replacement for XHR, because:
In theory, fetch supersedes XMLHttpRequest, and And, note that |
Chrome has now shipped the Fetch API ( https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/35_QSL1ABTY ) in Chrome 43. I'm not sure yet if other browser vendors will implement it, but seeing as PDF.js has support for the firefox-only moz-chunk-arraybuffer, it seems reasonable to implement this for Chrome. We often see poor network performance loading PDFs, especially when using range requests, and hopefully this can help.
I'm planning to start working on this over the next few days, any initial thoughts?
The text was updated successfully, but these errors were encountered: