-
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
Adds streams-lib polyfill and exports ReadableStream from shared/util. #8396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, please note that Travis has a lot of complaints about the code. In this case, since it concerns external code, I'd suggest simply adding external/streams/
to https://github.com/mozilla/pdf.js/blob/master/.eslintignore. Edit: Remember that running gulp lint
helps catch these kind of issues locally.
Second of all, this will get bundled into all build targets by default. I imagine that we don't want to do that, at least not at the present time, since it would cause e.g. the FIREFOX
/MOZCENTRAL
builds to become quite a lot larger (for code that we currently don't use in production).
Thanks for you suggestion. I will add the file.
No idea what we have to do for this. Maybe we can compress the polyfill. Have to ask @yurydelendik . |
85bb940
to
d5147c6
Compare
We need to follow https://bugzilla.mozilla.org/show_bug.cgi?id=1272697 for that. I'm expecting landing of streamable getTextContent as soon as we land this PR, so the code will be using streams api in production. |
It looks like Travis does not see the library as a module. Is it a valid CommonJS module? Moreover, the file looks built. I suspect one of the next steps will be to fetch the original from the repository and build it ourselves? In case the upstream library changes, it should be easy for us to rebuild our version from source. |
TODO:
|
0a3aecd
to
a454dd8
Compare
gulpfile.js
Outdated
gulp.src([ | ||
'src/{core,display}/*.js', | ||
'src/shared/{compatibility,util}.js', | ||
'src/{pdf,pdf.worker}.js', | ||
], {base: 'src/'}), | ||
], {base: 'src/'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many irrelevant changes. let's make original marge as var buildLib = merge([...]);
and then add
return merge([
buildLib,
gulp.src('external/streams/streams-lib.js', {base: '.'})
.pipe(gulp.dest('build/'))
]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, sure. Looks more clear. Thanks for suggestion.
gulpfile.js
Outdated
gulp.task('dist', ['dist-repo-git']); | ||
gulp.task('dist', ['dist-repo-git'], function () { | ||
gulp.src('external/streams/streams-lib.js', {base: '.'}) | ||
.pipe(gulp.dest('build/dist/')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this belong in the dist-repo-prepare task
453f613
to
21b1b01
Compare
Added test for ReadableStream. Adds ref-implementation license-header in streams-lib and change gulp task to copy external/streams/ in build/ external/streams/ and build/dist/external/streams folder. Adds README.md and LICENSE.md
21b1b01
to
c9f44f3
Compare
While I'd wish that the size impact of this patch was a bit smaller, I've got no formal objections here :-) /botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/533ea717f83341b/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/6bd04c9c974ea96/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/6bd04c9c974ea96/output.txt Total script time: 17.42 mins
Image differences available at: http://54.67.70.0:8877/6bd04c9c974ea96/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/533ea717f83341b/output.txt Total script time: 25.92 mins
|
/botio-linux test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/b755221678801b6/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/b755221678801b6/output.txt Total script time: 19.20 mins
Image differences available at: http://54.67.70.0:8877/b755221678801b6/reftest-analyzer.html#web=eq.log |
It unfortunately seems that loading all of this new code has made the tests even more unreliable :-( |
Not sure why this is happening(as all unit-tests are passing on my local machine) and what will be the potential solution of this :-( But i think we can reduce the size of |
This is a pre-existing issue affecting only the Chrome browser on the Linux bot, and one that has thus far prevented landing for example PR #8284. Note that e.g. compared to PR #8284, the current PR seems to cause even worse timeouts on the Linux bot. |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://54.67.70.0:8877/8ca3c6c39e0ef85/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 1 Live output at: http://54.215.176.217:8877/0e387beaad90426/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/8ca3c6c39e0ef85/output.txt Total script time: 17.73 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/0e387beaad90426/output.txt Total script time: 30.14 mins
|
Thank you for the patch. As a follow up let's check if we can bring code from https://github.com/mukulmishra18/streams-lib/ as is here. |
Adds streams-lib polyfill and exports ReadableStream from shared/util.
This is the first PR of project Streams API in PDF.js. This allow PDF.js to use Streams API in the process of networking and rendering. For that purpose, this PR:
Fork Streams API ref-implementation and convert it to commonjs module.
Import/Export ReadableStream from shared/util.js.
Adds test for ReadableStream to check it's working.
Increase in file size(in kb) after adding this code, in pdf.js and pdf.worker.js:
pdf.js: 468.8(after) - 343.7(before) = ~125
pdf.worker.js: 1400(after) - 1300(before) = 100