Skip to content

Move a few helper functions/classes out of the src/display/api.js file#19962

Merged
timvandermeij merged 2 commits intomozilla:masterfrom
Snuffleupagus:api_utils
May 24, 2025
Merged

Move a few helper functions/classes out of the src/display/api.js file#19962
timvandermeij merged 2 commits intomozilla:masterfrom
Snuffleupagus:api_utils

Conversation

@Snuffleupagus
Copy link
Collaborator

  • Move a few helper functions/classes out of the src/display/api.js file

    Given that this file represents the official API, it's difficult to avoid it becoming fairly large as we add new functionality. However, it also contains a couple of smaller (and internal) helpers that we can move into a new utils-file.

    Also, we inline the DEFAULT_RANGE_CHUNK_SIZE constant since it's only used once and its value has never been changed in over a decade.

  • Move the PDFObjects class to its own file

    This isn't directly part of the official API, and having this class in its own file could help avoid future changes (e.g. issue 18148) affecting the size of the src/display/api.js file unnecessarily.

Given that this file represents the official API, it's difficult to avoid it becoming fairly large as we add new functionality. However, it also contains a couple of smaller (and internal) helpers that we can move into a new utils-file.

Also, we inline the `DEFAULT_RANGE_CHUNK_SIZE` constant since it's only used *once* and its value has never been changed in over a decade.
This isn't directly part of the official API, and having this class in its own file could help avoid future changes (e.g. issue 18148) affecting the size of the `src/display/api.js` file unnecessarily.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/867e4c74ba4ff70/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/55391e084b715b6/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/55391e084b715b6/output.txt

Total script time: 29.71 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/867e4c74ba4ff70/output.txt

Total script time: 56.17 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@timvandermeij timvandermeij merged commit 21ef454 into mozilla:master May 24, 2025
9 checks passed
@timvandermeij
Copy link
Contributor

timvandermeij commented May 24, 2025

Good idea; thank you!

@Snuffleupagus Snuffleupagus deleted the api_utils branch January 25, 2026 16:20
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