Skip to content

Report loading progress "automatically" when using the PDFDataTransportStream class, and remove the PDFDataRangeTransport.prototype.onDataProgress method#20615

Merged
Snuffleupagus merged 2 commits intomozilla:masterfrom
Snuffleupagus:transport-onProgress
Feb 1, 2026

Conversation

@Snuffleupagus
Copy link
Collaborator

This is consistent with the other BasePDFStream implementations, and simplifies the API surface of the PDFDataRangeTransport class (note the changes in the viewer).
Given that the onDataProgress method was changed to a no-op this won't affect third-party users, assuming there even are any since this code was written specifically for the Firefox PDF Viewer.

…ortStream` class, and remove the `PDFDataRangeTransport.prototype.onDataProgress` method

This is consistent with the other `BasePDFStream` implementations, and simplifies the API surface of the `PDFDataRangeTransport` class (note the changes in the viewer).
Given that the `onDataProgress` method was changed to a no-op this won't affect third-party users, assuming there even are any since this code was written specifically for the Firefox PDF Viewer.
After https://bugzilla.mozilla.org/show_bug.cgi?id=1985121 this functionality is now guaranteed to be available in Firefox.
Unfortunately general browser support is still somewhat lacking; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sumPrecise#browser_compatibility

Also, while unrelated, use the `MathClamp` helper in the `applyOpacity` function.
Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, with passing tests. Thank you for simplifying this code!

@Snuffleupagus Snuffleupagus removed the request for review from calixteman February 1, 2026 21:14
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/80b483cfa5de63b/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/4ca45cbfb86c310/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/80b483cfa5de63b/output.txt

Total script time: 2.72 mins

  • Unit Tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/4ca45cbfb86c310/output.txt

Total script time: 8.73 mins

  • Unit Tests: FAILED

@Snuffleupagus Snuffleupagus merged commit bfd17b2 into mozilla:master Feb 1, 2026
11 checks passed
@Snuffleupagus Snuffleupagus deleted the transport-onProgress branch February 1, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants