Skip to content

Fix AcroForm appearance resources when merging pages - #21577

Merged
timvandermeij merged 1 commit into
mozilla:masterfrom
calixteman:fix/pdf-editor-acroform-resource-xref
Jul 16, 2026
Merged

timvandermeij merged 1 commit into
mozilla:masterfrom
calixteman:fix/pdf-editor-acroform-resource-xref

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

Merging pages with conflicting AcroForm /DR must inline the resources each field's appearance relies on, since only one /DR survives in the output. That fixup:

  • resolved the appearance /Resources ref against the source document's xref instead of the merged one, so the lookup failed and merging threw (null.has(...));
  • skipped checkbox/radio widgets, whose /AP /N is a sub-dictionary of appearance states rather than a single stream;
  • threw on a non-dictionary /Resources (e.g. a stray name) instead of falling back to the default resources.

Merging pages with conflicting AcroForm /DR must inline the resources
each field's appearance relies on, since only one /DR survives in the
output. That fixup:
- resolved the appearance /Resources ref against the source document's
  xref instead of the merged one, so the lookup failed and merging threw
  (null.has(...));
- skipped checkbox/radio widgets, whose /AP /N is a sub-dictionary of
  appearance states rather than a single stream;
- threw on a non-dictionary /Resources (e.g. a stray name) instead of
  falling back to the default resources.
@calixteman
calixteman requested a review from timvandermeij July 15, 2026 15:55
@codecov-commenter

codecov-commenter commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (c661ba1) to head (914545d).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/core/editor/pdf_editor.js 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21577      +/-   ##
==========================================
+ Coverage   89.74%   89.77%   +0.02%     
==========================================
  Files         262      262              
  Lines       66751    66746       -5     
==========================================
+ Hits        59907    59921      +14     
+ Misses       6844     6825      -19     
Flag Coverage Δ
browsertest 66.55% <0.00%> (+0.01%) ⬆️
fonttest 9.04% <ø> (-0.02%) ⬇️
integrationtest 69.27% <0.00%> (+0.01%) ⬆️
unittest 57.37% <89.47%> (+0.01%) ⬆️
unittestcli 56.34% <89.47%> (+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.

@timvandermeij
timvandermeij merged commit d473678 into mozilla:master Jul 16, 2026
21 checks passed
@timvandermeij

Copy link
Copy Markdown
Collaborator

Looks good. Thank you for fixing this and including more tests!

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