Skip to content

[api-major] Remove support for calling getDocument without a parameter object, and remove the PDFDocumentProxy.prototype.destroy method#21245

Merged
timvandermeij merged 2 commits into
mozilla:masterfrom
Snuffleupagus:getDocument-only-DocumentInitParameters
May 10, 2026
Merged

[api-major] Remove support for calling getDocument without a parameter object, and remove the PDFDocumentProxy.prototype.destroy method#21245
timvandermeij merged 2 commits into
mozilla:masterfrom
Snuffleupagus:getDocument-only-DocumentInitParameters

Conversation

@Snuffleupagus
Copy link
Copy Markdown
Collaborator

  • [api-major] Remove support for calling getDocument without a parameter object

    This is a left-over from very old code[1], before there were a lot of getDocument options and when most of the library configuration was done via the (since removed) PDFJS global.
    Given all the functionality added through the years, which require configuration[2], in practice it's now unlikely that calling getDocument without additional options will work except for the most trivial PDFs.


    [1] If the getDocument function was added today, there's no chance that it'd support anything other than a parameter object.

    [2] Note things such as CMaps, standard fonts, wasm-based image decoders, and ICC-based colour spaces.

  • [api-major] Remove the PDFDocumentProxy.prototype.destroy method

    This is a left-over from very old code, which pre-dates the introduction of the PDFDocumentLoadingTask and it's nothing more than an alias for its destroy method.
    Given that PDFDocumentProxy already provides a way to access the underlying PDFDocumentLoadingTask instance, it shouldn't be necessary to have an alias for one of its methods.

    Please note: For any existing code relying on the removed method, updating it should be as simple as replacing pdfDocument.destroy() with pdfDocument.loadingTask.destroy().


    [1] If the PDFDocumentProxy class was added today, there's no chance that it'd include a destroy method.

…ter object

This is a left-over from very old code[1], before there were a lot of `getDocument` options and when most of the library configuration was done via the (since removed) `PDFJS` global.
Given all the functionality added through the years, which require configuration[2], in practice it's now unlikely that calling `getDocument` without additional options will work except for the most trivial PDFs.

---

[1] If the `getDocument` function was added today, there's no chance that it'd support anything other than a parameter object.

[2] Note things such as CMaps, standard fonts, wasm-based image decoders, and ICC-based colour spaces.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.03%. Comparing base (e86e9d9) to head (43ce1bb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21245      +/-   ##
==========================================
+ Coverage   54.57%   56.03%   +1.46%     
==========================================
  Files         216      220       +4     
  Lines       58860    58958      +98     
==========================================
+ Hits        32120    33039     +919     
+ Misses      26740    25919     -821     
Flag Coverage Δ
fonttest 8.65% <ø> (?)
unittest 55.30% <ø> (?)
unittestcli 54.56% <ø> (-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.

This is a left-over from very old code, which pre-dates the introduction of the `PDFDocumentLoadingTask` and it's nothing more than an alias for its `destroy` method.
Given that `PDFDocumentProxy` already provides a way to access the underlying `PDFDocumentLoadingTask` instance, it shouldn't be necessary to have an alias for one of its methods.

*Please note:* For any existing code relying on the removed method, updating it should be as simple as replacing `pdfDocument.destroy()` with `pdfDocument.loadingTask.destroy()`.

---

[1] If the `PDFDocumentProxy` class was added today, there's no chance that it'd include a `destroy` method.
@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/dd473226009f94a/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/08e54aa35776b73/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/dd473226009f94a/output.txt

Total script time: 18.15 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.241.84.105:8877/dd473226009f94a/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/08e54aa35776b73/output.txt

Total script time: 24.11 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

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

Copy link
Copy Markdown
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

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

Good idea; thanks!

@timvandermeij timvandermeij merged commit 02c9051 into mozilla:master May 10, 2026
25 of 26 checks passed
@Snuffleupagus Snuffleupagus deleted the getDocument-only-DocumentInitParameters branch May 10, 2026 13:49
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.

4 participants