23311 Commits

Author SHA1 Message Date
Tim van der Meij
be89d6475d
Merge pull request #21585 from Snuffleupagus/Iterator-join
Start using `Iterator.prototype.join` in the code-base
2026-07-19 13:48:06 +02:00
Tim van der Meij
f12c6f64ad
Merge pull request #21592 from Snuffleupagus/Iterator-helpers
Use Iterator methods to avoid some unnecessary Array creation
2026-07-19 13:46:58 +02:00
Tim van der Meij
e624336b2e
Merge pull request #21590 from Snuffleupagus/canvas-_getPattern-getOrInsertComputed
Use `getOrInsertComputed` in the `CanvasGraphics.prototype._getPattern` method
2026-07-19 13:45:56 +02:00
Jonas Jenwald
6fbd2227db [api-minor] Convert getDestinations to return data in a Map
Compared to regular Objects there's a number of advantages to using Maps:
 - They support proper iteration.
 - They have a simple way to check for the existence of data.
 - They have a simple/efficient way to check the number of elements.

If this functionality was added today, I cannot imagine that we'd choose an Object for this data.
2026-07-19 12:07:08 +02:00
Jonas Jenwald
344736bcad Re-factor the bCache, used with /Mesh Shadings
- Initialize the `bCache` lazily, since many/most PDF documents don't need it.
 - Change the `bCache` to a `Map`, rather than an Object, which thanks to `getOrInsertComputed` allows the `buildB` function to be inlined.

Also, while unrelated here, move the `this.matrix = null;` definition to the `BaseShadingPattern` class to reduce (a tiny bit of) unnecessary duplication.
2026-07-18 14:15:24 +02:00
Jonas Jenwald
b2cf8527c6 Change the CompiledFont glyph/charCode caches to use Maps
This code is old enough that it predates the general availability of `Map`, and these changes allow us to shorten the code a tiny bit.
2026-07-18 11:44:27 +02:00
Jonas Jenwald
47f2b22842 Use Iterator methods to avoid some unnecessary Array creation
Currently there are some spots in the code-base where intermediate Arrays are unnecessarily created from Iterators, before `filter` and `map` is used to create a final Array.
Thanks to newer Iterators methods, see e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/filter, that can be now be avoided.
2026-07-17 21:23:08 +02:00
Calixte Denizet
922d57631b Rebuild missing AcroForm fields 2026-07-17 13:51:08 +02:00
Jonas Jenwald
0f060e1e64 Use getOrInsertComputed in the CanvasGraphics.prototype._getPattern method 2026-07-17 12:49:29 +02:00
calixteman
dd7e3731d1
Merge pull request #21589 from mozilla/update-locales
l10n: Update locale files
2026-07-17 08:08:07 +02:00
github-actions[bot]
9720182511 l10n: Update locale files 2026-07-17 00:38:00 +00:00
Calixte Denizet
eb58ccc100 Handle revisioned structure attributes 2026-07-16 22:18:26 +02:00
Calixte Denizet
f554d0c9c8 Implement SmaskInData == 2 for JPX images 2026-07-16 21:04:45 +02:00
Jonas Jenwald
9a7335d26b Start using Iterator.prototype.join in the code-base
This is an upcoming JavaScript feature, which helps avoid creating intermediate Arrays in some cases; see https://github.com/tc39/proposal-iterator-join

Firefox implemented this in [bug 2004803](https://bugzilla.mozilla.org/show_bug.cgi?id=2004803), and it was enabled by default in [bug 2047995](https://bugzilla.mozilla.org/show_bug.cgi?id=2047995).

This patch changes two Objects to Maps, in the XFA-parsing respectively the find-implementation, to make use of the new feature.
2026-07-16 20:45:01 +02:00
Tim van der Meij
16290afa3b
Merge pull request #21586 from Snuffleupagus/web-more-getOrInsertComputed
Use `Map.prototype.getOrInsertComputed` more in the `web/` folder
2026-07-16 20:32:34 +02:00
Tim van der Meij
d473678201
Merge pull request #21577 from calixteman/fix/pdf-editor-acroform-resource-xref
Fix AcroForm appearance resources when merging pages
2026-07-16 20:13:44 +02:00
Tim van der Meij
f472cb081c
Merge pull request #21575 from calixteman/fix/signature-fields-with-widget-kids
Fix signature fields with widget children
2026-07-16 20:08:35 +02:00
Jonas Jenwald
6d7bca521b Use Map.prototype.getOrInsertComputed more in the web/ folder 2026-07-16 19:37:13 +02:00
calixteman
6e18a52b86
Merge pull request #21583 from calixteman/sasl_prep
Support SASLprep for AES-256 revision 6 passwords
2026-07-16 19:21:39 +02:00
Jonas Jenwald
244fb9e822
Merge pull request #21581 from Snuffleupagus/createCipherTransform-rm-AES256Cipher-duplication
Reduce duplication in `CipherTransformFactory.prototype.createCipherTransform`
2026-07-16 17:03:26 +02:00
Calixte Denizet
2ea9c26d77 Support SASLprep for AES-256 revision 6 passwords 2026-07-16 16:58:58 +02:00
calixteman
e909f1f64f
Merge pull request #21580 from calixteman/issue21579
Fix decryption of AES-256 revision 5 PDFs with non-ASCII passwords
2026-07-16 16:42:42 +02:00
Calixte Denizet
5f09f797ab Fix decryption of AES-256 revision 5 PDFs with non-ASCII passwords
It fixes #21579.
2026-07-16 16:34:15 +02:00
Jonas Jenwald
01454570a7 Reduce duplication in CipherTransformFactory.prototype.createCipherTransform
After PR 21485 the `AES256Cipher` case is effectively duplicated, and while it's not a lot of code it's easy enough to avoid that.
2026-07-16 15:31:36 +02:00
Jonas Jenwald
e39b23904c
Merge pull request #21576 from Snuffleupagus/RefSetCache-getOrPutComputed
Add a `getOrPutComputed` method in the `RefSetCache` class
2026-07-15 17:45:47 +02:00
Calixte Denizet
914545dea3 Fix AcroForm appearance resources when merging pages
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.
2026-07-15 16:56:04 +02:00
Jonas Jenwald
a3a7247366 Add a makeSet helper, to reduce function creation
This replaces inline `() => new Set()` statements, and also makes some `getOrInsertComputed` calls slightly shorter.
2026-07-15 15:24:25 +02:00
Jonas Jenwald
a18b581f00 Add a getOrPutComputed method in the RefSetCache class
This is equivalent to the native `Map.prototype.getOrInsertComputed()` method, and it helps simplify/shorten some existing code.
2026-07-15 15:24:22 +02:00
calixteman
82c6046e1d
Fix signature fields with widget children 2026-07-14 22:38:43 +02:00
Tim van der Meij
c661ba1408
Merge pull request #21573 from mozilla/dependabot/github_actions/github/codeql-action/analyze-4.36.3
Bump github/codeql-action/analyze from 4.36.2 to 4.36.3
2026-07-14 19:41:34 +02:00
Tim van der Meij
ff075a9c67
Merge pull request #21572 from mozilla/dependabot/github_actions/github/codeql-action/autobuild-4.36.3
Bump github/codeql-action/autobuild from 4.36.2 to 4.36.3
2026-07-14 19:41:24 +02:00
Tim van der Meij
4c0dcff572
Merge pull request #21571 from mozilla/dependabot/github_actions/github/codeql-action/init-4.36.3
Bump github/codeql-action/init from 4.36.2 to 4.36.3
2026-07-14 19:41:09 +02:00
Tim van der Meij
f62702068a
Merge pull request #21574 from Snuffleupagus/issue-21570
Skip setFillColorN/setStrokeColorN operators without valid arguments (issue 21570)
2026-07-14 19:39:55 +02:00
Jonas Jenwald
2cf7d30763 Skip setFillColorN/setStrokeColorN operators without valid arguments (issue 21570)
The PDF document in question is corrupt, and note that even Adobe Reader (i.e. the PDF reference implementation) cannot render it correctly.

Also, guard all other set fill/stroke color operators similarly.
2026-07-14 16:08:59 +02:00
dependabot[bot]
d12d215302
Bump github/codeql-action/analyze from 4.36.2 to 4.36.3
Bumps [github/codeql-action/analyze](https://github.com/github/codeql-action) from 4.36.2 to 4.36.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8aad20d150...54f647b7e1)

---
updated-dependencies:
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 12:17:00 +00:00
dependabot[bot]
127470d994
Bump github/codeql-action/autobuild from 4.36.2 to 4.36.3
Bumps [github/codeql-action/autobuild](https://github.com/github/codeql-action) from 4.36.2 to 4.36.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8aad20d150...54f647b7e1)

---
updated-dependencies:
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 12:15:31 +00:00
dependabot[bot]
e5c0130b80
Bump github/codeql-action/init from 4.36.2 to 4.36.3
Bumps [github/codeql-action/init](https://github.com/github/codeql-action) from 4.36.2 to 4.36.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8aad20d150...54f647b7e1)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 12:14:01 +00:00
calixteman
accfa9a162
Merge pull request #21569 from calixteman/fix/pdf-editor-struct-tree-objr
Preserve OBJR children without restoring deleted pages
2026-07-13 22:55:15 +02:00
Calixte Denizet
8070e9dce1 Preserve OBJR children without restoring deleted pages
Skip OBJR entries whose targets were not copied with a retained page.
2026-07-13 22:25:28 +02:00
calixteman
0b613612ed
Merge pull request #21567 from calixteman/fix/pdf-editor-struct-tree-root-k
Handle indirect and dangling structure tree root kids
2026-07-13 22:01:59 +02:00
Calixte Denizet
dae773d74a Handle indirect and dangling structure tree root kids
Preserve indirect root kids and marked content from removed link annotations. Ignore dangling kid references instead of throwing.
2026-07-13 21:48:30 +02:00
calixteman
b19cc7c746
Merge pull request #21566 from calixteman/fix/pdf-editor-unicode-name-trees
Preserve Unicode destination and attachment names
2026-07-13 21:46:35 +02:00
Calixte Denizet
850dccbc17 Preserve Unicode destination and attachment names
Name-tree keys are PDF text strings, so encode named destinations with
stringToAsciiOrUTF16BE when writing the /Dests tree; otherwise a non-ASCII
name (e.g. "名") is truncated to a single byte and lost on round-trip. Sort
the name/number tree by byte value rather than localeCompare, matching the
order used when the tree is read back.

Apply the same encoding to deduplicated /EmbeddedFiles names: those are
rebuilt from a decoded display string, so a non-ASCII attachment name would
otherwise be corrupted when its duplicate is written.
2026-07-13 21:19:23 +02:00
Tim van der Meij
7505eeaeb4
Merge pull request #21565 from calixteman/fix/pdf-editor-link-destinations
Preserve non-local PDF link destinations
2026-07-13 21:05:13 +02:00
Tim van der Meij
ac25471588
Merge pull request #21568 from calixteman/bug2047516
Commit the current editing session before saving (bug 2047516)
2026-07-13 21:02:58 +02:00
Calixte Denizet
125f692589 Commit the current editing session before saving (bug 2047516)
When saving or downloading a document, an annotation that was still
being edited (e.g. an in-progress ink drawing) wasn't committed first,
so its content was missing from the saved file.
2026-07-13 19:08:42 +02:00
Calixte Denizet
a36e5acb30 Preserve non-local PDF link destinations 2026-07-13 14:27:47 +02:00
Tim van der Meij
5e3272c929
Merge pull request #21562 from timvandermeij/workflow-improvements
Improve the GitHub Actions workflow triggers and requirements
2026-07-12 18:06:41 +02:00
Tim van der Meij
e6a80f4893
Merge pull request #21563 from Snuffleupagus/src-core-return-await
Use direct `return await` a bit more in the `src/core/` folder
2026-07-12 18:06:20 +02:00
Tim van der Meij
ae179be764
Pin the full dependency trees of the font/Fluent linter test requirements
The `requirements.txt` files of the two Python-based builds only listed
the top-level dependency, and thus not the full dependency tree, and
only limited it via a version range. This means that the actual versions
we use for the builds are determined at runtime, and can thus easily
change if a new version gets published. This causes the builds to not be
deterministic, and it's in contrast to the JavaScript-based builds where
`package-lock.json` pins the full dependency tree with fixed versions.

This commit changes the `requirements.txt` files to follow the same
approach as `package-lock.json` and thus pin the full dependency tree to
fixed versions. This ensures deterministic builds, improves consistency
and provides better protection against e.g. supply chain attacks by not
automatically pulling in new versions as they are published (but rather
make updating versions a conscious and verifiable/auditable action). To
simplify the update process, and make it repeatable, we document the
full one-line generation commands inline.
2026-07-12 16:27:31 +02:00