Skip to content

Add a no-op helper function for catch handlers that ignore errors - #22511

Merged
Snuffleupagus merged 1 commit into
mozilla:masterfrom
Snuffleupagus:catch-noopFn
Nov 12, 2026
Merged

Snuffleupagus merged 1 commit into
mozilla:masterfrom
Snuffleupagus:catch-noopFn

Conversation

@Snuffleupagus

Copy link
Copy Markdown
Collaborator

Currently there's a fair number of catch handlers that just suppress "uncaught exceptions", and rather than creating potentially a lot of inline functions we can re-use just a single helper instead.

Note that such a function already existed, in the src/shared/message_handler.js file, hence that one is simply moved and re-named.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Reference tests

Results for 30c5523 (run, references from mozilla/pdf.js.refs@70a2e10bb1).

Platform Status Tests Total runtime Errors Different FBF No reference Report
Linux ✅ 1420 13m 41s 0 0 0 0
Windows ✅ 1420 17m 14s 0 0 0 0

The report is kept for 30 days and replaced by the next run.

sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Viewer preview

🗑️ Viewer previews removed.

@codecov-commenter

codecov-commenter commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.57%. Comparing base (cf5e897) to head (30c5523).

Files with missing lines Patch % Lines
src/core/editor/pdf_images.js 0.00% 1 Missing ⚠️
src/display/api.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #22511   +/-   ##
=======================================
  Coverage   90.56%   90.57%           
=======================================
  Files         276      276           
  Lines       68676    68676           
=======================================
+ Hits        62196    62200    +4     
+ Misses       6480     6476    -4     
Flag Coverage Δ
fonttest 9.08% <0.00%> (ø)
integrationtest 69.67% <73.33%> (+<0.01%) ⬆️
unittest 63.10% <66.66%> (+<0.01%) ⬆️
unittestcli 60.68% <62.50%> (+<0.01%) ⬆️

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.

sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 12, 2026
sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 12, 2026
@codspeed

codspeed Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.38%

1 warning

⚠️ 2 benchmarks with a significant change ran in a different software environment

Their base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the changes might come from this difference rather than from the code. Open an affected benchmark to see what changed.

See affected benchmarks

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 86 untouched benchmarks
⏩ 174 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ Autolinker.processLinks: 2 links in each of 5000 text items 65.9 ms 78.5 ms -16.06%
⚡ MetadataParser: XMP (issue11144_reduced.pdf) 4.9 ms 4.4 ms +11.21%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Snuffleupagus:catch-noopFn (30c5523) with master (cf5e897)

Open in CodSpeed

Footnotes

  1. 174 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@nicolo-ribaudo nicolo-ribaudo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some other places where it can be used:

pdf.js/src/display/api.js

Lines 2179 to 2182 in cf5e897

this.#messageHandler.on("ready", () => {
// Ignoring "ready" event -- MessageHandler should already be initialized
// and ready to accept messages.
});

tmpLexer._hexStringWarn = () => {};

pdf.js/web/app.js

Line 2839 in cf5e897

this._unblockDocumentLoadEvent = () => {};

Currently there's a fair number of `catch` handlers that just suppress "uncaught exceptions", and rather than creating potentially a lot of inline functions we can re-use just a single helper instead.

Note that such a function already existed, in the `src/shared/message_handler.js` file, hence that one is simply moved and re-named.
sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 12, 2026
sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 12, 2026
@Snuffleupagus
Snuffleupagus merged commit 2b5c986 into mozilla:master Nov 12, 2026
30 of 32 checks passed
sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 12, 2026
@Snuffleupagus
Snuffleupagus deleted the catch-noopFn branch November 12, 2026 12:33

This branch was successfully deployed

1 active deployment
sync_pdfs — 30c5523f Deployed Nov 12, 2026 by Snuffleupagus via request #811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants