Simplify the NetworkManager class, and inline it in the PDFNetworkStream class#20595
Merged
timvandermeij merged 2 commits intomozilla:masterfrom Jan 29, 2026
Merged
Conversation
Store pending requests in a `WeakMap`, which allows working directly with the `XMLHttpRequest`-data and removes the need for a couple of methods. Simplify the `PDFNetworkStreamRangeRequestReader.prototype._onDone` method, since after removing `moz-chunked-arraybuffer` support (see PR 10678) it's never called without an argument. Stop sending the `begin`-property to the `onDone`-callbacks since it's unused. Originally this code was shared with the Firefox PDF Viewer, many years ago, and then that property mattered. Re-factor the `status` validation, to avoid checking for a "bad" range-request response unconditionally.
…lass The `NetworkManager` is very old code at this point, and it predates the introduction of the streaming functionality by many years. To simplify things, especially with upcoming re-factoring patches, let's move this functionality into private (and semi-private) methods in the `PDFNetworkStream` class to avoid having to deal with too many different scopes.
Collaborator
Author
|
Given that the Fetch API is used by default, since many years, running the unit-tests ought to suffice here. /botio unittest |
Collaborator
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/72bb424af01c2ba/output.txt |
Collaborator
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/04397e20c76c2b1/output.txt |
Collaborator
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/72bb424af01c2ba/output.txt Total script time: 2.72 mins
|
Collaborator
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/04397e20c76c2b1/output.txt Total script time: 8.49 mins
|
timvandermeij
approved these changes
Jan 29, 2026
Contributor
|
Nice improvement; thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.