mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Merge pull request #20652 from Snuffleupagus/ChunkedStream-sendRequest-skip-empty
Avoid parsing skipped range requests in `ChunkedStreamManager` (PR 10694 follow-up)
This commit is contained in:
commit
f22fb6bbfb
@ -301,7 +301,11 @@ class ChunkedStreamManager {
|
|||||||
const readChunk = ({ value, done }) => {
|
const readChunk = ({ value, done }) => {
|
||||||
try {
|
try {
|
||||||
if (done) {
|
if (done) {
|
||||||
resolve(arrayBuffersToBytes(chunks));
|
resolve(
|
||||||
|
chunks.length > 0 || !this.disableAutoFetch
|
||||||
|
? arrayBuffersToBytes(chunks)
|
||||||
|
: null
|
||||||
|
);
|
||||||
chunks = null;
|
chunks = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -322,6 +326,11 @@ class ChunkedStreamManager {
|
|||||||
if (this.aborted) {
|
if (this.aborted) {
|
||||||
return; // Ignoring any data after abort.
|
return; // Ignoring any data after abort.
|
||||||
}
|
}
|
||||||
|
if (!data) {
|
||||||
|
// The range request wasn't dispatched, see the "GetRangeReader" handler
|
||||||
|
// in the `src/display/api.js` file.
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onReceiveData({ chunk: data.buffer, begin });
|
this.onReceiveData({ chunk: data.buffer, begin });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user