From ddd69ce4e0f2bf621fee33bc685e71a4571ee2ed Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 8 Mar 2026 10:13:49 +0100 Subject: [PATCH] Remove the "DocProgress" `loaded` fallback from the `getPdfManager` function Falling back to use the `loaded` byteLength if the server `contentLength` is unknown doesn't make a lot of sense, since it'd lead to the `onProgress` callback reporting `percent === 100` repeatedly while the document is loading despite that being obviously wrong. Instead we'll now report `percent === NaN` in that case, thus showing the indeterminate progressBar, which seems more correct if the `contentLength` is unknown. Please note that this code-path is normally not even reached, since streaming is enabled by default (applies e.g. to the Firefox PDF Viewer). --- src/core/worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/worker.js b/src/core/worker.js index d301bf6f9..29aa80cf8 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -275,7 +275,7 @@ class WorkerMessageHandler { if (!fullReader.isStreamingSupported) { handler.send("DocProgress", { loaded, - total: Math.max(loaded, fullReader.contentLength || 0), + total: fullReader.contentLength, }); }