Skip to content

Commit ddd69ce

Browse files
committed
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).
1 parent 1f69cf9 commit ddd69ce

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/core/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class WorkerMessageHandler {
275275
if (!fullReader.isStreamingSupported) {
276276
handler.send("DocProgress", {
277277
loaded,
278-
total: Math.max(loaded, fullReader.contentLength || 0),
278+
total: fullReader.contentLength,
279279
});
280280
}
281281

0 commit comments

Comments
 (0)