22857 Commits

Author SHA1 Message Date
Jonas Jenwald
4a01dd669a
Merge pull request #21400 from Snuffleupagus/workflows-test-external-folder
Run various test-suite when the `external/` folder is modified
2026-06-07 16:52:39 +02:00
Jonas Jenwald
9c0b56ac07 Run various test-suite when the external/ folder is modified
Given that the `external/` folder contains various imported code/resources, all of which could affect functionality and/or rendering, it seems safest to simply run browser/font/integration/unit tests whenever any part of that folder is touched.
2026-06-07 16:03:40 +02:00
Tim van der Meij
f86b5abb05
Merge pull request #21398 from timvandermeij/codecov-ci-fix
Upgrade `codecov/codecov-action` to version 7.0.0
2026-06-07 15:39:39 +02:00
Tim van der Meij
b8ad7c8d0f
Upgrade codecov/codecov-action to version 7.0.0
Codecov had to migrate to a new Keybase account after losing access to
their old Keybase account, and because of that the old account got
bricked to prevent misuse [1] which resulted in GPG verification
failures in our builds [2]. This new version of the action fixes the
issue by using the new account.

Fixes #21394.

[1] https://github.com/codecov/codecov-action/issues/1956
[2] https://github.com/codecov/codecov-action/issues/1955
2026-06-07 14:52:24 +02:00
Tim van der Meij
d9eea18876
Merge pull request #21396 from Snuffleupagus/injectLinkAnnotations-move-call
Prevent intermittent issues when invoking the `PDFPageView.prototype.#injectLinkAnnotations` method
2026-06-07 14:42:14 +02:00
Tim van der Meij
bfc33678da
Merge pull request #21395 from Snuffleupagus/DrawLayerBuilder-cancel-optional-chaining
Shorten the `DrawLayerBuilder.prototype.cancel` method a tiny bit
2026-06-07 14:35:40 +02:00
Jonas Jenwald
43dd2781a0 Prevent intermittent issues when invoking the PDFPageView.prototype.#injectLinkAnnotations method
Looking at the coverage data there are cases where we attempt to insert inferred link-annotations *before* the annotationLayer has rendered, see [here](2348365874/blob/web/annotation_layer_builder.js (L246)), which shouldn't happen and why that's treated as an Error.

This is most likely caused by the asynchronicity of all the relevant code, since the `Autolinker` functionality can only be invoked after both the annotationLayer *and* the textLayer have finished rendering.
Given that those operations are asynchronous, by the time that they complete it's possible that the annotationLayer (and also the textLayer) has been replaced by a new instance. In that case we might thus attempt to inject inferred link-annotations before the "new" annotationLayer has rendered.

To avoid this intermittent issue, we now ensure that the annotationLayer and textLayer haven't changed between those layers rendering and the `Autolinker` functionality being invoked. (If they did change, then a future `render` call will trigger the inferred link-annotations handling).
2026-06-07 11:28:57 +02:00
Jonas Jenwald
0eca809589 Shorten the DrawLayerBuilder.prototype.cancel method a tiny bit
By replacing the early return with optional chaining, a pattern that we already use in lots of places, the code becomes a tiny bit shorter and more importantly the code coverage for this file becomes 100 percent.
2026-06-06 23:41:31 +02:00
Tim van der Meij
f12c463452
Merge pull request #21393 from Snuffleupagus/PDFCursorTools-tests
Add basic integration-tests for the `PDFCursorTools` functionality
2026-06-06 19:51:52 +02:00
Tim van der Meij
81f15c3437
Merge pull request #21390 from Snuffleupagus/getDocument-binary-string-unit-test
Add a unit-test for passing a binary string to `getDocument`
2026-06-06 19:46:45 +02:00
Tim van der Meij
f4d6b4ef85
Merge pull request #21391 from Snuffleupagus/getDocument-Node-fs-unit-test
Add a unit-test for passing a filesystem URL-string (in Node.js) to `getDocument`
2026-06-06 19:45:26 +02:00
Jonas Jenwald
0b3b101dbc Remove the unused GrabToPan.prototype.toggle method
Given that the cursor tools are managed via the `PDFCursorTools` class, of which the `GrabToPan` instance is essentially a (semi) private implementation detail, the `GrabToPan.prototype.toggle` method is completely unused and can thus be removed.
2026-06-06 17:27:19 +02:00
Jonas Jenwald
a5333f2a92 Add a unit-test for passing a binary string to getDocument
This format is obviously not very efficient however it's been supported since "forever" and there's even examples using, hence it seems like a good idea to actually test this.
2026-06-06 14:37:25 +02:00
Jonas Jenwald
ae30748956 Add basic integration-tests for the PDFCursorTools functionality 2026-06-06 14:32:15 +02:00
calixteman
2348365874
Merge pull request #21392 from Snuffleupagus/Autolinker-invalid-email-domain-test
Add one more unit-test case for invalid email domains in the `Autolinker` class
2026-06-06 13:17:11 +02:00
Jonas Jenwald
08b704d4b1 Add one more unit-test case for invalid email domains in the Autolinker class
This improves coverage for a branch of the `Autolinker` class that wasn't previously tested.
2026-06-06 11:57:22 +02:00
Jonas Jenwald
a7d32f4518 Add a unit-test for passing a filesystem URL-string (in Node.js) to getDocument
This improves coverage for a part of the API that previously wasn't tested.
2026-06-05 23:17:11 +02:00
Tim van der Meij
9c437e6ab4
Merge pull request #21388 from calixteman/strip_jbig2_header
Strip the JBIG2 file header from JBIG2Decode streams
2026-06-05 20:06:02 +02:00
Tim van der Meij
4ed78beb38
Merge pull request #21387 from Snuffleupagus/ChunkedStream-abort-reject
Reject the stream-capability when aborting the `ChunkedStreamManager`
2026-06-05 20:02:02 +02:00
Tim van der Meij
e34e11cf78
Merge pull request #21386 from KonstantinRight/print-params-flag-fix
fix typo in bit flag value for suppressCropClip
2026-06-05 19:58:58 +02:00
Tim van der Meij
c8fb1be7b6
Merge pull request #21389 from calixteman/readme_ccov
Update the README in order to add some info about code coverage
2026-06-05 19:57:18 +02:00
Calixte Denizet
9ab6b743ea Update the README in order to add some info about code coverage 2026-06-05 17:45:20 +02:00
calixteman
173e083c71
Merge pull request #21350 from calixteman/kb_shortcuts_l10n
Match editor keyboard shortcuts by event.code as a fallback
2026-06-05 17:19:17 +02:00
Calixte Denizet
88c52a1523 Strip the JBIG2 file header from JBIG2Decode streams
It's rendering correctly in Acrobat and PdfBox.
2026-06-05 16:31:44 +02:00
Jonas Jenwald
959ce38f5b Reject the stream-capability when aborting the ChunkedStreamManager
Given that any incoming data is already being ignored after loading has been aborted, it seems reasonable to reject the stream-capability to avoid it remaining in a pending state indefinitely.

*Note:* This is something that I noticed while looking at the coverage data, since the `ChunkedStreamManager.prototype.onError` method is not used and from a brief look at the history of the code it never appears to have been used either.
2026-06-05 12:25:53 +02:00
Konstantin
a66782615e fix typo in bit flag value for suppressCropClip 2026-06-05 11:30:20 +03:00
calixteman
091f459d2e
Merge pull request #21358 from sfoster/bug-203525-viewer-favicon
Bug 2035251 - Use toolkit's pdf icon as favicon
2026-06-04 21:35:28 +02:00
Tim van der Meij
23ea0810d9
Merge pull request #21379 from calixteman/dedup_stream_merging
Deduplicate shared font/image streams when merging PDFs
2026-06-04 20:58:22 +02:00
Sam Foster
b9e3a6b5d0 Bug 2035251 - Use toolkit's pdf icon as favicon 2026-06-04 11:58:12 -07:00
Tim van der Meij
7f15bd6591
Merge pull request #21383 from calixteman/ko_inner_bd
Add knockout_inner_backdrop ref test
2026-06-04 20:41:50 +02:00
Tim van der Meij
dc3696f23c
Merge pull request #21384 from Snuffleupagus/Stream-getBytes-shorten
Shorten the `getBytes` method in the `Stream`/`ChunkedStream` classes
2026-06-04 20:41:07 +02:00
Tim van der Meij
0cc139fdfc
Merge pull request #21385 from Snuffleupagus/AppOptions-unittest-EVENT_DISPATCH
Extend the `AppOptions` unit-tests to also cover the `EVENT_DISPATCH` option-kind
2026-06-04 20:36:17 +02:00
Tim van der Meij
d619ff3207
Merge pull request #21380 from Snuffleupagus/AnnotationLayerBuilder-rm-#externalHide
Remove the `#externalHide` field from the `AnnotationLayerBuilder` class
2026-06-04 20:35:14 +02:00
Tim van der Meij
f45a1b4df5
Merge pull request #21382 from mozilla/dependabot/github_actions/github/codeql-action-4.36.0
Bump github/codeql-action from 4.35.5 to 4.36.0
2026-06-04 20:32:41 +02:00
Jonas Jenwald
dc602ae543 Extend the AppOptions unit-tests to also cover the EVENT_DISPATCH option-kind 2026-06-04 17:51:41 +02:00
Jonas Jenwald
d36d3ab893 Shorten the getBytes method in the Stream/ChunkedStream classes
This is very old code and there's currently a bit of unneeded duplication in these methods, especially in the `ChunkedStream` class.
2026-06-04 13:10:24 +02:00
Calixte Denizet
e4a3e91444 Add knockout_inner_backdrop ref test
Non-isolated subgroup needing isolation (Multiply BM) nested in a KO
group, exercising the inner-backdrop blend path.
2026-06-04 09:13:43 +02:00
dependabot[bot]
936a472f05
Bump github/codeql-action from 4.35.5 to 4.36.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.5 to 4.36.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9e0d7b8d25...7211b7c807)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-04 00:19:24 +00:00
calixteman
9071f451a5
Merge pull request #21359 from Snuffleupagus/coverage-browser-tests
Run browser tests to collect code coverage data
2026-06-03 19:01:52 +02:00
Jonas Jenwald
890edc9265 Run browser tests to collect code coverage data
Obviously it's not yet possible to just migrate `gulp browsertest` to GitHub Actions, however it's already possible to at least run the browser tests there which allows collection of more code coverage data.
This should thus give us more realistic coverage numbers, since currently there's many `src/` files that have very low code coverage.

By taking advantage of the fact that the GitHub Actions runners provide multiple cores, these tests are also fairly fast:
 - The ubuntu-latest/firefox job complete in ~9 minutes.
2026-06-03 18:15:18 +02:00
Jonas Jenwald
b168293c17
Merge pull request #21351 from wooorm/wooorm/auth-event-and-encrypted-attachments
[api-minor] Add support for `/AuthEvent`, on-demand decryption
2026-06-03 18:13:44 +02:00
Titus Wormer
4db9e45b8c
Add support for /AuthEvent, on-demand decryption
Normally entire PDFs are encrypted (or not).
But it is also possible to only encrypt attachments.
It is then also possible to *only* prompt for a password when the user opens
them.

In the existing flow, prompting for passwords happens because things are decrypted.
A specific error is thrown, caught, and the user is prompted.
To keep this flow working, this PR changes to decrypting attachments on demand,
instead of eagerly.
This sounds logical: to not read attachments on startup.

I’ve extensively tested this, not only with regular attachments, but also with outline items
and attachments in annotations.

This PR builds on GH-21234.
It’s an alternative to the naïve GH-20732.

Closes GH-20049.
2026-06-03 16:44:57 +02:00
Jonas Jenwald
5907d87774 Remove the #externalHide field from the AnnotationLayerBuilder class
Prior to PR 20321 the annotationLayer was hidden when there was no regular annotations on the page, which meant that if there were any inferred links (from the textLayer) the annotationLayer needed to be made visible but in such a way that it wouldn't override an explicit `hide`-call from the `PDFPageView` class.

With the changes in the aforementioned PR the annotationLayer is now always "visible", and this code can thus be simplified a little bit.
2026-06-03 13:56:43 +02:00
Calixte Denizet
836a08084e Match editor keyboard shortcuts by event.code as a fallback
So that Ctrl+A, Ctrl+Z, etc. still fire on non-US keyboard layouts where
the physical "A" key produces a non-Latin character (Cyrillic, Greek,
some AZERTY combinations, ...). KeyboardManager now tries event.key first
and falls back to a US-layout translation of event.code (KeyA => a,
Digit1 => 1, Numpad1 => 1) when no shortcut is bound on event.key.

Also refactors KeyboardManager to store modifiers as a bitmask instead
of a serialized string, and treats a shortcut array without any
"mac+"-prefixed entry as applying on all platforms, letting us drop the
redundant "mac+X" duplicates of bare "X" entries across the editor code.
2026-06-03 10:13:41 +02:00
Calixte Denizet
1a7821ab13 Deduplicate shared font/image streams when merging PDFs
Identical embedded fonts and images across the merged documents are now
written once and shared, instead of being copied per source file.
And avoid to compress already compressed stream with Brotli.
2026-06-02 22:08:21 +02:00
Jonas Jenwald
19046a6949
Merge pull request #21349 from Snuffleupagus/OptionalContentConfig-serializable
Implement proper serialization of `OptionalContentConfig`
2026-06-02 21:57:16 +02:00
Tim van der Meij
e9a946ec0b
Merge pull request #21378 from wooorm/wooorm/fix-selection-rendering-off
Fix broken `enableSelectionRendering: false`
2026-06-02 21:02:18 +02:00
Tim van der Meij
744c1e6d7a
Merge pull request #21372 from calixteman/issue7998
Render gray transparency groups in grayscale
2026-06-02 20:10:18 +02:00
Tim van der Meij
e9ee61f67c
Merge pull request #21347 from calixteman/issue21240
Restore editor layer state for unchanged pages after page mutations
2026-06-02 20:08:14 +02:00
Tim van der Meij
27b345a61e
Merge pull request #21361 from timvandermeij/is-canvas-monochrome
Fix intermittent failure in the "must check that a freetext is still here after having updated it and scroll the doc" freetext editor integration test
2026-06-02 20:01:24 +02:00