Avoid parsing skipped range requests in ChunkedStreamManager (PR 10694 follow-up)#20652
Conversation
…694 follow-up) While we don't dispatch the actual range request after PR 10694 we still parse the returned data, which ends up being an *empty* `ArrayBuffer` and thus cannot affect the `ChunkedStream.prototype._loadedChunks` property. Given that no actual data arrived, it's thus pointless[1] to invoke the `ChunkedStreamManager.prototype.onReceiveData` method in this case (and it also avoids sending effectively duplicate "DocProgress" messages). --- [1] With the *possible* exception of `disableAutoFetch === false` being set, see https://github.com/mozilla/pdf.js/blob/f24768d7b4ef0f64976a7f9e80e15ef50c759356/src/core/chunked_stream.js#L499-L517 however that never happens when streaming is being used; note https://github.com/mozilla/pdf.js/blob/f24768d7b4ef0f64976a7f9e80e15ef50c759356/src/core/worker.js#L237-L238
|
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/da63b1de95195a6/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/71aa23b7d82a447/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/71aa23b7d82a447/output.txt Total script time: 60.00 mins |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/da63b1de95195a6/output.txt Total script time: 81.62 mins
Image differences available at: http://54.193.163.58:8877/da63b1de95195a6/reftest-analyzer.html#web=eq.log |
|
/botio-linux test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/d88d1b9b44d1a1e/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/d88d1b9b44d1a1e/output.txt Total script time: 41.52 mins
Image differences available at: http://54.241.84.105:8877/d88d1b9b44d1a1e/reftest-analyzer.html#web=eq.log |
|
Looks good; thank you! |
While we don't dispatch the actual range request after PR #10694 we still parse the returned data, which ends up being an empty
ArrayBufferand thus cannot affect theChunkedStream.prototype._loadedChunksproperty.Given that no actual data arrived, it's thus pointless[1] to invoke the
ChunkedStreamManager.prototype.onReceiveDatamethod in this case (and it also avoids sending effectively duplicate "DocProgress" messages).[1] With the possible exception of
disableAutoFetch === falsebeing set, seepdf.js/src/core/chunked_stream.js
Lines 499 to 517 in f24768d
pdf.js/src/core/worker.js
Lines 237 to 238 in f24768d