Skip to content

Re-factor the XRef class to use private fields#21631

Merged
Snuffleupagus merged 2 commits into
mozilla:masterfrom
Snuffleupagus:XRef-private-fields
Jul 25, 2026
Merged

Re-factor the XRef class to use private fields#21631
Snuffleupagus merged 2 commits into
mozilla:masterfrom
Snuffleupagus:XRef-private-fields

Conversation

@Snuffleupagus

Copy link
Copy Markdown
Collaborator
  • Re-factor the XRef class to use private fields

    Part of this is very old code, hence modernizing it a little bit more really shouldn't hurt.
    This patch also shortens some XRef code by using nullish coalescing assignment respectively ternary operators more.

    Finally, adds the recently introduced countUpdatesAfter method to the XRefMock/XRefWrapper classes to avoid having to check for its existence.

  • Re-factor the "nested trailer dictionary" check (PR 4731 follow-up)

    In the pr4731.pdf document the trailer is actually a Stream, rather than the expected Dictionary, hence update the "nested trailer dictionary" check to make that clearer.

    Note: This is something that I happened to noticed while working on the previous patch.

Part of this is very old code, hence modernizing it a little bit more really shouldn't hurt.
This patch also shortens some `XRef` code by using nullish coalescing assignment respectively ternary operators more.

Finally, adds the recently introduced `countUpdatesAfter` method to the `XRefMock`/`XRefWrapper` classes to avoid having to check for its existence.
In the `pr4731.pdf` document the trailer is actually a Stream, rather than the expected Dictionary, hence update the "nested trailer dictionary" check to make that clearer.

*Note:* This is something that I happened to noticed while working on the previous patch.
@codecov-commenter

codecov-commenter commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.52941% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.85%. Comparing base (05e100c) to head (a7b7cec).

Files with missing lines Patch % Lines
src/core/editor/pdf_editor.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21631   +/-   ##
=======================================
  Coverage   89.84%   89.85%           
=======================================
  Files         263      263           
  Lines       66811    66802    -9     
=======================================
- Hits        60029    60023    -6     
+ Misses       6782     6779    -3     
Flag Coverage Δ
browsertest 66.53% <92.64%> (+0.01%) ⬆️
fonttest 9.05% <ø> (ø)
integrationtest 69.24% <64.70%> (-0.02%) ⬇️
unittest 57.49% <83.82%> (-0.01%) ⬇️
unittestcli 56.47% <83.82%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Snuffleupagus

Copy link
Copy Markdown
Collaborator Author

/botio browsertest

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/fcd096ae68bc8af/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/aa3507aedadde49/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/fcd096ae68bc8af/output.txt

Total script time: 18.02 mins

  • Regression tests: Passed

@Snuffleupagus
Snuffleupagus marked this pull request as ready for review July 25, 2026 11:11
@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/aa3507aedadde49/output.txt

Total script time: 23.06 mins

  • Regression tests: Passed

@calixteman calixteman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thank you.

@Snuffleupagus
Snuffleupagus merged commit 83844f1 into mozilla:master Jul 25, 2026
23 of 25 checks passed
@Snuffleupagus
Snuffleupagus deleted the XRef-private-fields branch July 25, 2026 20:33
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.

4 participants