Remove the unused IPDFStreamRangeReader.prototype.isStreamingSupported getter

This getter was only invoked from `src/display/network.js` and `src/core/chunked_stream.js`, however in both cases it's hardcoded to `false` and thus isn't actually needed.
This originated in PR 6879, close to a decade ago, for a potential TODO which was never implemented and it ought to be OK to just simplify this now.
This commit is contained in:
Jonas Jenwald 2026-01-30 07:55:53 +01:00
parent 62d5408cf0
commit 987265720e
7 changed files with 4 additions and 47 deletions

View File

@ -283,19 +283,15 @@ class ChunkedStreamManager {
sendRequest(begin, end) {
const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
if (!rangeReader.isStreamingSupported) {
rangeReader.onProgress = this.onProgress.bind(this);
}
rangeReader.onProgress = this.onProgress.bind(this);
let chunks = [],
loaded = 0;
let chunks = [];
return new Promise((resolve, reject) => {
const readChunk = ({ value, done }) => {
try {
if (done) {
const chunkData = arrayBuffersToBytes(chunks);
resolve(arrayBuffersToBytes(chunks));
chunks = null;
resolve(chunkData);
return;
}
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
@ -304,12 +300,6 @@ class ChunkedStreamManager {
"readChunk (sendRequest) - expected an ArrayBuffer."
);
}
loaded += value.byteLength;
if (rangeReader.isStreamingSupported) {
this.onProgress({ loaded });
}
chunks.push(value);
rangeReader.read().then(readChunk, reject);
} catch (e) {

View File

@ -114,10 +114,6 @@ class PDFWorkerStreamRangeReader {
this._reader = readableStream.getReader();
}
get isStreamingSupported() {
return false;
}
async read() {
const { value, done } = await this._reader.read();
if (done) {

View File

@ -209,7 +209,6 @@ class PDFFetchStreamRangeReader {
const source = stream.source;
this._withCredentials = source.withCredentials || false;
this._readCapability = Promise.withResolvers();
this._isStreamingSupported = !source.disableStream;
this._abortController = new AbortController();
// Always create a copy of the headers.
@ -240,10 +239,6 @@ class PDFFetchStreamRangeReader {
this.onProgress = null;
}
get isStreamingSupported() {
return this._isStreamingSupported;
}
async read() {
await this._readCapability.promise;
const { value, done } = await this._reader.read();

View File

@ -413,13 +413,7 @@ class PDFNetworkStreamRangeRequestReader {
}
_onProgress(evt) {
if (!this.isStreamingSupported) {
this.onProgress?.({ loaded: evt.loaded });
}
}
get isStreamingSupported() {
return false;
this.onProgress?.({ loaded: evt.loaded });
}
async read() {

View File

@ -208,8 +208,6 @@ class PDFNodeStreamFsRangeReader {
constructor(stream, begin, end) {
this.onProgress = null;
this._loaded = 0;
const source = stream.source;
this._isStreamingSupported = !source.disableStream;
const url = stream.url;
const fs = process.getBuiltinModule("fs");
@ -228,10 +226,6 @@ class PDFNodeStreamFsRangeReader {
}
}
get isStreamingSupported() {
return this._isStreamingSupported;
}
async read() {
await this._readCapability.promise;
const { value, done } = await this._reader.read();

View File

@ -287,10 +287,6 @@ class PDFDataTransportStreamRangeReader {
this._stream._removeRangeReader(this);
}
get isStreamingSupported() {
return false;
}
async read() {
if (this._queuedChunk) {
const chunk = this._queuedChunk;

View File

@ -145,14 +145,6 @@ class IPDFStreamRangeReader {
this.onProgress = null;
}
/**
* Gets ability of the stream to progressively load binary data.
* @type {boolean}
*/
get isStreamingSupported() {
return false;
}
/**
* Requests a chunk of the binary data. The method returns the promise, which
* is resolved into object with properties "value" and "done". If the done