diff --git a/src/core/worker_stream.js b/src/core/worker_stream.js index eb8f97f3c..6dfc3962a 100644 --- a/src/core/worker_stream.js +++ b/src/core/worker_stream.js @@ -105,7 +105,6 @@ class PDFWorkerStreamReader { class PDFWorkerStreamRangeReader { constructor(begin, end, msgHandler) { this._msgHandler = msgHandler; - this.onProgress = null; const readableStream = this._msgHandler.sendWithStream("GetRangeReader", { begin, diff --git a/src/display/fetch_stream.js b/src/display/fetch_stream.js index dc08637cc..4f603f9b6 100644 --- a/src/display/fetch_stream.js +++ b/src/display/fetch_stream.js @@ -205,7 +205,6 @@ class PDFFetchStreamRangeReader { constructor(stream, begin, end) { this._stream = stream; this._reader = null; - this._loaded = 0; const source = stream.source; this._withCredentials = source.withCredentials || false; this._readCapability = Promise.withResolvers(); @@ -235,8 +234,6 @@ class PDFFetchStreamRangeReader { this._reader = response.body.getReader(); }) .catch(this._readCapability.reject); - - this.onProgress = null; } async read() { @@ -245,9 +242,6 @@ class PDFFetchStreamRangeReader { if (done) { return { value, done }; } - this._loaded += value.byteLength; - this.onProgress?.({ loaded: this._loaded }); - return { value: getArrayBuffer(value), done: false }; } diff --git a/src/display/network.js b/src/display/network.js index 48bf60e2a..6f8a1f356 100644 --- a/src/display/network.js +++ b/src/display/network.js @@ -367,14 +367,12 @@ class PDFNetworkStreamRangeRequestReader { onHeadersReceived: this._onHeadersReceived.bind(this), onDone: this._onDone.bind(this), onError: this._onError.bind(this), - onProgress: this._onProgress.bind(this), + onProgress: null, }); this._requests = []; this._queuedChunk = null; this._done = false; this._storedError = undefined; - - this.onProgress = null; } _onHeadersReceived() { @@ -412,10 +410,6 @@ class PDFNetworkStreamRangeRequestReader { this._queuedChunk = null; } - _onProgress(evt) { - this.onProgress?.({ loaded: evt.loaded }); - } - async read() { if (this._storedError) { throw this._storedError; diff --git a/src/display/node_stream.js b/src/display/node_stream.js index 4c6276505..03266b0fe 100644 --- a/src/display/node_stream.js +++ b/src/display/node_stream.js @@ -206,9 +206,6 @@ class PDFNodeStreamFsRangeReader { _reader = null; constructor(stream, begin, end) { - this.onProgress = null; - this._loaded = 0; - const url = stream.url; const fs = process.getBuiltinModule("fs"); try { @@ -232,9 +229,6 @@ class PDFNodeStreamFsRangeReader { if (done) { return { value, done }; } - this._loaded += value.length; - this.onProgress?.({ loaded: this._loaded }); - return { value: getArrayBuffer(value), done: false }; } diff --git a/src/display/transport_stream.js b/src/display/transport_stream.js index 8c1a21f16..1fb74f521 100644 --- a/src/display/transport_stream.js +++ b/src/display/transport_stream.js @@ -111,10 +111,7 @@ class PDFDataTransportStream { } _onProgress(evt) { - if (evt.total === undefined) { - // Reporting to first range reader, if it exists. - this._rangeReaders[0]?.onProgress?.({ loaded: evt.loaded }); - } else { + if (evt.total !== undefined) { this._fullRequestReader?.onProgress?.({ loaded: evt.loaded, total: evt.total, @@ -265,8 +262,6 @@ class PDFDataTransportStreamRangeReader { this._queuedChunk = null; this._requests = []; this._done = false; - - this.onProgress = null; } _enqueue(chunk) { diff --git a/src/interfaces.js b/src/interfaces.js index 587727327..34c5f95bf 100644 --- a/src/interfaces.js +++ b/src/interfaces.js @@ -135,16 +135,6 @@ class IPDFStreamReader { * @interface */ class IPDFStreamRangeReader { - constructor() { - /** - * Sets or gets the progress callback. The callback can be useful when the - * isStreamingSupported property of the object is defined as false. - * The callback is called with one parameter: an object with the loaded - * property. - */ - this.onProgress = null; - } - /** * 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