Skip to content

Send 'Terminate' to the worker when destroy races the load-time handshake (bug 1942304)#21175

Merged
calixteman merged 1 commit into
mozilla:masterfrom
calixteman:bug1942304
Apr 28, 2026
Merged

Send 'Terminate' to the worker when destroy races the load-time handshake (bug 1942304)#21175
calixteman merged 1 commit into
mozilla:masterfrom
calixteman:bug1942304

Conversation

@calixteman
Copy link
Copy Markdown
Contributor

If PDFDocumentLoadingTask.destroy ran while workerIdPromise was pending, the inner .then in getDocument threw "Loading aborted" before WorkerTransport was constructed, so _transport was never set and the "Terminate" message was never posted.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.76%. Comparing base (8d3d370) to head (cffb19e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21175      +/-   ##
==========================================
- Coverage   63.76%   63.76%   -0.01%     
==========================================
  Files         213      213              
  Lines      134580   134605      +25     
==========================================
+ Hits        85812    85827      +15     
- Misses      48768    48778      +10     
Flag Coverage Δ
fonttest 8.66% <ø> (ø)
unittest 38.87% <100.00%> (-0.03%) ⬇️
unittestcli 63.31% <100.00%> (+0.01%) ⬆️

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.

Comment thread src/display/api.js
Comment thread src/display/api.js Outdated
…hake (bug 1942304)

If `PDFDocumentLoadingTask.destroy` ran while `workerIdPromise` was
pending, the inner `.then` in `getDocument` threw "Loading aborted"
before `WorkerTransport` was constructed, so `_transport` was never set
and the "Terminate" message was never posted.
Copy link
Copy Markdown
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

I believe that this should be safe, and in "normal" (i.e. non-test) usage destruction won't happen in the middle of loading anyway.

r=me, assuming that you've checked that this actually fixes the referenced bug; thanks.

@Snuffleupagus
Copy link
Copy Markdown
Collaborator

/botio browsertest

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

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

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

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

Total script time: 18.24 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.241.84.105:8877/d3fb7c743aead17/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

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

Total script time: 24.23 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/af56c44b7fe5ff6/reftest-analyzer.html#web=eq.log

@calixteman calixteman merged commit 30ea321 into mozilla:master Apr 28, 2026
17 checks passed
@calixteman calixteman deleted the bug1942304 branch April 28, 2026 13:22
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.

5 participants