23336 Commits

Author SHA1 Message Date
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
Tim van der Meij
ebaa98b854
Run the font/Fluent linter tests if their Python requirements change
The `requirements.txt` files of the two Python-based workflows were not
included in the file-based allowlist, which prevented the font/Fluent
linter tests from running if their contents changed. This commit fixes
that oversight from the original introduction of the workflows.
2026-07-12 16:27:27 +02:00
Tim van der Meij
174fd47973
Run all tests if package-lock.json changes
If one of our dependencies changes it can have an effect on all tests we
have, for instance via the test runner, bundler or coverage collector.
This commit therefore updates all workflows that work with a file-based
allowlist to also trigger on `package-lock.json` changes so that we have
more certainty that any unintended effects of dependency updates can't
go by unnoticed, and thus improve stability.
2026-07-12 16:27:17 +02:00
Tim van der Meij
cbdea64c8a
Merge pull request #21561 from timvandermeij/updates
Update dependencies to the most recent versions
2026-07-12 16:25:02 +02:00
Tim van der Meij
abae23d6aa
Upgrade eslint-plugin-unicorn to version 71.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v71.0.0
doesn't indicate any breaking changes that should impact us.
2026-07-12 16:19:58 +02:00
Tim van der Meij
3435fb0da0
Update dependencies to the most recent versions 2026-07-12 16:19:30 +02:00
Jonas Jenwald
5b26d8d413 Use direct return await a bit more in the src/core/ folder
In these cases there's no need for a temporary variable, since the result of the asynchronous operation is returned as-is without any additional parsing.
2026-07-12 15:59:57 +02:00
Tim van der Meij
54af145989
Merge pull request #21560 from Snuffleupagus/more-for-of-3
Use `for...of` even more in the code-base
2026-07-11 18:14:46 +02:00
calixteman
612fa34760
Merge pull request #21553 from nicolo-ribaudo/fix-text-selection-dark-mode
Bug 2048531 - Improve selection contrast in dark mode
2026-07-11 16:09:41 +02:00
Jonas Jenwald
c46720d893 Use for...of even more in the code-base
This replaces a couple of "standard" `for` loops with the shorter `for...of` format instead.
2026-07-11 13:15:36 +02:00
Nicolò Ribaudo
199d738917
Bug 2048531 - Improve selection contrast in dark mode
On some OSes, the current approach of using `Highlight`/`HighlightText`
colors to draw selected text doesn't work when the OS is set to dark
mode, as we revert the `color-scheme` to `light` to compute them
(because PDFs are normally in light mode) but that does not affect the
`HighlightText` color (which depends not on the `color-scheme` but on
the `currentColor`).

Other than forcing the `color-scheme` to `light`, set the `color` to
`black` and use the `backgroud-color` to compute the `HighlightText`
color instead.

In OSes where `HighlightText` is theme-dependent this will result in the
OS-provided text color, while in OSes where it is `currentColor`-dependent
it will be based on the default color for light themes (i.e. black).
2026-07-10 18:19:28 +02:00
Jonas Jenwald
c4574a5470
Merge pull request #21554 from Snuffleupagus/more-startsWith
Replace a couple of `indexOf` calls with `startsWith`
2026-07-10 15:27:54 +02:00
calixteman
bd845483ac
Merge pull request #21555 from mozilla/update-locales
l10n: Update locale files
2026-07-10 11:06:52 +02:00
github-actions[bot]
4e43e7f1af l10n: Update locale files 2026-07-10 00:42:44 +00:00
Jonas Jenwald
f0822e527e Replace a couple of indexOf calls with startsWith
These cases weren't detected/fixed by the following ESLint plugin rule; see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md

Additionally, replace the `if` with a ternary statement in the `external/builder/builder.mjs` file since this patch touches that code anyway.
2026-07-09 13:56:24 +02:00
Tim van der Meij
8bc2fe68e5
Merge pull request #21550 from Snuffleupagus/WorkerMessageHandler-more-async
Change Promise-returning worker message-handler functions to be asynchronous
2026-07-07 20:10:12 +02:00
Jonas Jenwald
d13c28a044 Change Promise-returning worker message-handler functions to be asynchronous
A number of these functions are old enough that they predate async/await, and making them asynchronous is ever so slightly shorter/simpler.
2026-07-07 13:25:28 +02:00
Jonas Jenwald
f0b5fc3b73 Remove unused parameters from worker message-handler functions
A lot of these (often old) handlers don't need any parameters, hence their `data` parameters needlessly increase code-size.

Also, for the functions that do need parameters, use parameter destructuring consistently throughout the message-handler functions.
2026-07-07 13:25:26 +02:00
Jonas Jenwald
d29293622e Shorten the info-logging in the "GetOperatorList" and "GetTextContent" handlers
By re-using the `WorkerTask`-names these disabled-by-default logging statements become ever so slightly shorter, which cannot hurt.
2026-07-07 13:09:58 +02:00
Jonas Jenwald
0d5a7d8adc Remove TODO-comments in the "GetOperatorList" and "GetTextContent" handlers
Any errors are already propagated via the stream-sinks, since these handlers use `ReadableStream`, and as mentioned in the TODO-comments re-throwing errors will lead to "spam" in the console; hence let's just remove them.
2026-07-07 12:51:49 +02:00
Jonas Jenwald
18f9aa91b6
Merge pull request #21547 from timvandermeij/core-utils-test
Implement unit tests for the `getRotationMatrix` core utility function
2026-07-07 11:02:28 +02:00
Tim van der Meij
67d591f413
Implement unit tests for the getRotationMatrix core utility function
This function is mostly covered indirectly by higher-level tests, but
unlike the other core utility functions it lacked dedicated unit tests.
This commit implements unit tests for it that also cover the previously
uncovered exception case, which brings coverage of the function to 100%
and ever so slighly increases coverage of the overarching file.
2026-07-06 20:43:03 +02:00
Jonas Jenwald
6689097a0a
Merge pull request #21543 from Snuffleupagus/FakeSignatureVerifier
Add a `FakeSignatureVerifier` for development mode and TESTING builds (PR 21247 follow-up)
2026-07-05 23:20:58 +02:00
Jonas Jenwald
98ccc87fdc
Merge pull request #21546 from timvandermeij/murmurhash-test
Implement a unit test for passing unsupported data types to `MurmurHash3_64.update()`
2026-07-05 23:03:05 +02:00
Tim van der Meij
f0818c1860
Implement a unit test for passing unsupported data types to MurmurHash3_64.update()
This commit brings the coverage of `src/shared/murmurhash3.js` to 100%.
2026-07-05 19:55:06 +02:00
calixteman
bf924ff31b
Merge pull request #21521 from calixteman/issue21520
Use `Intl.Segmenter` for the entire-word search matching
2026-07-05 19:20:36 +02:00