Skip to content

[api-minor] Simplify BaseCMapReaderFactory by having the worker-thread create the filename#20939

Open
Snuffleupagus wants to merge 1 commit intomozilla:masterfrom
Snuffleupagus:BaseCMapReaderFactory-filename
Open

[api-minor] Simplify BaseCMapReaderFactory by having the worker-thread create the filename#20939
Snuffleupagus wants to merge 1 commit intomozilla:masterfrom
Snuffleupagus:BaseCMapReaderFactory-filename

Conversation

@Snuffleupagus
Copy link
Collaborator

The BaseCMapReaderFactory, BaseStandardFontDataFactory, and BaseWasmFactory classes are all very similar, and the only difference is really in their respective fetch methods.
By have the worker-thread "compute" the complete filename it's possible to simplify the BaseCMapReaderFactory.prototype.fetch method, which will allow future improvements to all of these classes.

A couple of things to note:

  • This code is unused, and it's not even bundled, in the Firefox PDF Viewer.
  • In browsers it's unused by default, and worker-thread fetching will always be used when possible since that's more efficient.

Please note: For users that provide a custom CMapReaderFactory instance when calling getDocument this could be a breaking change, however it's unlikely that any such users exist.
(The internal format of this data was changed previously in PR #18951, and there hasn't been a single question/complaint about it in well over a year.)

…ead create the `filename`

The `BaseCMapReaderFactory`, `BaseStandardFontDataFactory`, and `BaseWasmFactory` classes are all very similar, and the only difference is really in their respective `fetch` methods.
By have the worker-thread "compute" the complete `filename` it's possible to simplify the `BaseCMapReaderFactory.prototype.fetch` method, which will allow future improvements to all of these classes.

A couple of things to note:
 - This code is unused, and it's not even bundled, in the Firefox PDF Viewer.
 - In browsers it's unused by default, and worker-thread fetching will always be used when possible since that's more efficient.

*Please note:* For users that provide a custom `CMapReaderFactory` instance when calling `getDocument` this could be a breaking change, however it's unlikely that any such users exist.
(The *internal* format of this data was changed previously in PR 18951, and there hasn't been a single question/complaint about it in well over a year.)
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux test

@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/95dfb407c6c415f/output.txt

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 62.61%. Comparing base (918a319) to head (262aeef).

Files with missing lines Patch % Lines
src/display/cmap_reader_factory.js 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #20939       +/-   ##
===========================================
+ Coverage    7.66%   62.61%   +54.95%     
===========================================
  Files          48      174      +126     
  Lines       18839   121931   +103092     
===========================================
+ Hits         1444    76353    +74909     
- Misses      17395    45578    +28183     
Flag Coverage Δ
fonttest 7.66% <ø> (ø)
unittestcli 62.59% <94.73%> (?)

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

☔ View full report in Codecov by Sentry.
📢 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.

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/95dfb407c6c415f/output.txt

Total script time: 46.12 mins

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

@Snuffleupagus Snuffleupagus marked this pull request as ready for review March 21, 2026 16:37
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