22810 Commits

Author SHA1 Message Date
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
Titus Wormer
a8cf37f6bc
Fix broken enableSelectionRendering: false
Closes GH-21374.
Related-to GH-20981.
2026-06-02 12:57:04 +02:00
Jonas Jenwald
b43ef1c746
Merge pull request #21373 from Snuffleupagus/presentation-mode-test-links
Add an integration-test for clicking on internal links in presentation mode
2026-06-02 10:56:14 +02:00
Jonas Jenwald
065ea625dd
Merge pull request #21371 from Snuffleupagus/BaseStream-clone-fix
Improve the `BaseStream.prototype.clone` implementations
2026-06-02 10:54:36 +02:00
Jonas Jenwald
4e6b7be4d7 Add an integration-test for clicking on internal links in presentation mode 2026-06-01 14:25:55 +02:00
calixteman
69e8d6900f Render gray transparency groups in grayscale
It fixes #7998.
2026-05-31 21:16:29 +02:00
Jonas Jenwald
a6321e7201 Improve the BaseStream.prototype.clone implementations
- The `dict` field is optional, hence avoid an Error if trying to clone a non-existent dictionary.

 - Use the `length` getter in the `Stream` class, to avoid duplication.

 - Fix the `DecodeStream` implementation, since it has a couple of bugs:
    - The `clone` method currently uses `start`/`end` fields, despite these only existing on `Stream` instances.
    - Given the previous point, we ended up creating the cloned `Stream` instance using the *entire* underlying `buffer`. This is problematic since the length of a `DecodeStream` cannot be accurately estimated before decoding, and the `buffer`-length is simply a multiple of two.
       Unless the size of the decoded-data just happens to also be a multiple of two, this causes the cloned `Stream` instance to be "padded" with zeros at the end.
2026-05-31 20:24:39 +02:00
Tim van der Meij
5fbab91f71
Merge pull request #21368 from Snuffleupagus/more-internal-events
Mark a couple of viewer, and editor, EventBus listeners as "internal"
2026-05-31 14:35:18 +02:00
Jonas Jenwald
94fdea15f4
Merge pull request #21366 from Snuffleupagus/StringStream-dict
Update the `StringStream` constructor to accept an optional dictionary argument
2026-05-31 13:01:43 +02:00
Jonas Jenwald
04237100a5 Mark a couple of viewer, and editor, EventBus listeners as "internal"
There's currently a few EventBus listeners that aren't marked as "internal", however I'm assuming that they probably should be (e.g. to reduce the risk of intermittent failures in the integration-tests).
2026-05-31 12:12:41 +02:00
Jonas Jenwald
345089de1f
Merge pull request #21367 from Snuffleupagus/canvas-MathClamp
Use the `MathClamp` helper function in the `src/display/canvas.js` file
2026-05-31 11:55:48 +02:00
Tim van der Meij
add30f3ca0
Fix intermittent failure in the "must check that a freetext is still there after having updated it and scroll the doc" freetext editor integration test
The problem is that we screenshot the page itself rather than the
canvas, even though we specifically care about the latter according to
the comment, which means that we manually have to take care of hiding and
showing the annotation editor. This is problematic because even though
we signal that the annotation editor should be hidden, we don't wait
until that is actually done, which leads to a situation where we can
take the screenshot before the annotation editor is actually invisible
in the view.

This commit fixes the issue by screenshotting the canvas instead, which
avoids the need for manually hiding/showing the annotation editor. This
makes the test less fragile, and matches other tests better.
2026-05-31 11:36:44 +02:00
Jonas Jenwald
06439a95c3 Update the StringStream constructor to accept an optional dictionary argument
There's currently some amount of `StringStream` usage where the `dict`-parameter is manually assigned, and by updating the signature of the constructor this can be avoided.
2026-05-31 11:36:32 +02:00
Tim van der Meij
327822c21f
Merge pull request #21365 from calixteman/cmap_overflow
Skip the format 4 cmap sub-table when it doesn't fit its 16-bits fields
2026-05-31 11:32:58 +02:00
Tim van der Meij
af2380060a
Merge pull request #21364 from timvandermeij/webgpu-logs
Disable WebGPU for Firefox tests
2026-05-31 11:19:22 +02:00
Jonas Jenwald
0e1660700a Use the MathClamp helper function in the src/display/canvas.js file 2026-05-31 11:13:42 +02:00
calixteman
5d28cf5e88 Skip the format 4 cmap sub-table when it doesn't fit its 16-bits fields
It's a follow-up of bug 199861 (see https://bugzilla.mozilla.org/show_bug.cgi?id=1998618#c2).
2026-05-30 21:53:29 +02:00
Tim van der Meij
eef4ea620e
Disable WebGPU for Firefox tests
The GitHub Actions workflow for the integration tests on Windows logs
the following line for every test:

`JavaScript warning: http://127.0.0.1:62313/build/generic/build/pdf.mjs,
line 134934: WebGPU is disabled by blocklist.`

On Linux WebGPU is disabled by default because of missing support, but on
Windows it's enabled by default since bug 1972486, so we try to obtain a
GPU adapter which fails (and logs) if there is no actual GPU like on
GitHub Actions. Coverage data confirms that our own WebGPU code is
already uncovered because of the lack of a GPU, so having WebGPU enabled
or disabled doesn't change that, but if it causes log spam it seems
better to disable it, which this commit does.

Note that Chrome doesn't seem to have a matching flag, but Chrome already
doesn't log anything about this (which is the primary driver for this
change), so that's not a problem.
2026-05-30 19:30:24 +02:00
Tim van der Meij
145feeaa3f
Merge pull request #21360 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-05-30 15:19:21 +02:00
Tim van der Meij
6701ccd86b
Bump the stable version in pdfjs.config 2026-05-30 15:14:47 +02:00
Jonas Jenwald
241dbabbf1
Merge pull request #21355 from Snuffleupagus/INTERNAL_EVT
Re-factor how "internal" EventBus listeners are handled in the viewer
v6.0.227
2026-05-30 11:39:22 +02:00
Jonas Jenwald
74db085794 Re-factor how "internal" EventBus listeners are handled in the viewer
Currently the viewer uses semi-private `EventBus.prototype.{_on, _off}` methods, to try and ensure that all internal viewer state is updated *before* any "external" listeners are invoked.
For all use-cases outside of the viewer, e.g in the integration-tests, the `EventBus.prototype.{on, off}` methods are supposed to be used instead.

Unfortunately this isn't currently enforced in any way, except (hopefully) during review, and generally speaking it's not really possible to prevent the semi-private methods being used (e.g. by third-party users).
Hence this patch adds a new `INTERNAL_EVT` property which is *not* exposed anywhere (neither in the API nor globally), and whose value is generated at build-time, that the viewer uses to mark its `EventBus` listeners are internal.
This allows us to remove the semi-private `EventBus` methods, which helps to simplify that class a little bit.
2026-05-29 22:11:58 +02:00
Tim van der Meij
19d95c8fee
Merge pull request #21285 from timvandermeij/puppeteer-25
Upgrade Puppeteer to version 25.1.0
2026-05-29 21:09:24 +02:00
Tim van der Meij
b9b7661e64
Upgrade Puppeteer to version 25.1.0
This is a major version bump, but the changelog at
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v25.0.0
doesn't indicate any breaking changes that should impact us.

Moreover, this release contains the fix for the memory leak from
puppeteer/puppeteer#14876, so we can remove
the workaround related to that now.

Finally, we rename `.puppeteerrc` to `.puppeteerrc.json` because of
https://github.com/puppeteer/puppeteer/issues/15076, but in general it's
a good idea to be explicit about the file format via its extension, so
even if this upstream bug is fixed we don't need to revert this.
2026-05-29 20:24:42 +02:00
Tim van der Meij
e7f951dc1b
Merge pull request #21357 from timvandermeij/fix-browser-test-exit-code
Fix missing non-zero exit code for failure cases in `test.mjs`
2026-05-29 20:23:22 +02:00
Tim van der Meij
8d5fe521b3
Fix missing non-zero exit code for failure cases in test.mjs
The two affected code paths caught and logged errors, but that wasn't
reflected in the exit code of the process, and that is what GitHub
Actions (and other tools) to determine if process execution was
successful or not. This commit fixes the issue by making sure we
consistently exit with code 1 in case of errors so that GitHub Actions
pipelines correctly reflect the outcome of the test run.
2026-05-29 19:24:31 +02:00
calixteman
80c8e62e65
Merge pull request #21308 from calixteman/bug2036265
Add a pref to postMessage when mozPrintCallback has completed (bug 2036265)
2026-05-29 14:32:29 +02:00
calixteman
c7a32c3db6
Merge pull request #21343 from calixteman/issue9437
Clamp out-of-range BlueScale to Adobe's valid window
2026-05-29 08:58:05 +02:00
calixteman
3fe3321f7a
Merge pull request #21334 from calixteman/merge_images
Allow inserting an image as a new page when editing a PDF (bug 2032967)
2026-05-29 08:22:53 +02:00
calixteman
3e76bfd364
Merge pull request #21354 from mozilla/update-locales
l10n: Update locale files
2026-05-29 08:17:11 +02:00
github-actions[bot]
fc6e19b9cb l10n: Update locale files 2026-05-29 00:55:59 +00:00
Calixte Denizet
600986b51d Allow inserting an image as a new page when editing a PDF
Image files dropped on or selected via the thumbnail viewer's
"add file" picker are now accepted alongside PDFs and inserted
as synthetic pages sized to the document's modal page dimensions.

The image-encoding helper previously embedded in StampAnnotation has
moved to src/core/editor/pdf_images.js so it can be shared between
stamp annotations and page synthesis.
2026-05-28 22:11:13 +02:00
calixteman
389853d473
Merge pull request #21336 from calixteman/issue15292
Parse CID-keyed Type 1 fonts instead of falling back to a system font
2026-05-28 21:45:30 +02:00
Tim van der Meij
7d305ff281
Merge pull request #21335 from calixteman/multiple_merge
Allow merging several PDFs at once via the picker or drag-and-drop
2026-05-28 21:01:05 +02:00
Tim van der Meij
be8a8c4309
Merge pull request #21348 from calixteman/issue21346
Use a black backdrop for Luminosity SMasks when /BC is missing
2026-05-28 20:46:47 +02:00
Tim van der Meij
5d7ec1fb79
Merge pull request #21345 from mozilla/dependabot/github_actions/codecov/codecov-action-6.0.1
Bump codecov/codecov-action from 6.0.0 to 6.0.1
2026-05-28 20:42:47 +02:00
Tim van der Meij
6e9ee9fcdc
Merge pull request #21344 from mozilla/dependabot/github_actions/github/codeql-action-4.35.5
Bump github/codeql-action from 4.35.4 to 4.35.5
2026-05-28 20:42:09 +02:00
calixteman
974f98613f
Merge pull request #21234 from wooorm/wooorm/encrypted-attachments
Add support for encrypted attachments
2026-05-28 16:07:00 +02:00
Titus Wormer
45cdb5d3e8
Add support for encrypted attachments
This PR is related to GH-20732, which is about `AuthEvent` (to delay
promting for a password), but instead adds the actual support for
encrypted attachments.
“Encrypted attachments” means that the main things are plain text.
Note that some PDF viewers, like Preview/QuickLook/Safari or Chrome,
do not support attachments at all.
Note that the file checked into the tests is the same as
`output-no-auth-event.pdf` referenced in
<https://github.com/mozilla/pdf.js/issues/20139#issuecomment-3952462166>.

Closes GH-20139.
2026-05-28 10:30:37 +02:00
Calixte Denizet
a33e06cafb Use a black backdrop for Luminosity SMasks when /BC is missing
It fixes #21346.
2026-05-26 22:36:50 +02:00
Calixte Denizet
8e6e35473f Restore editor layer state for unchanged pages after page mutations
It fixes #21240.
2026-05-26 22:27:35 +02:00
dependabot[bot]
8666bca8ae
Bump codecov/codecov-action from 6.0.0 to 6.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](57e3a136b7...e79a6962e0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-26 19:41:27 +00:00
dependabot[bot]
e1ddc6614b
Bump github/codeql-action from 4.35.4 to 4.35.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.4 to 4.35.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](68bde559de...9e0d7b8d25)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-26 19:41:13 +00:00
calixteman
385b1ca412 Clamp out-of-range BlueScale to Adobe's valid window
Fonts that ship a BlueScale outside the range AFDKO considers valid
for their zone heights (0.5/maxZoneHeight <= BlueScale <= 1/maxZoneHeight)
cause Firefox's CFF rasterizer to misalign overshooting glyphs against
flat-topped ones at body sizes.
Clamp into that window, only apply the lower clamp when BlueScale is
also smaller than the default, so foundry fonts that pair the default
0.039625 with small zones are untouched.

Fixes #9437.
2026-05-26 21:24:51 +02:00
Jonas Jenwald
b849567c10
Merge pull request #21342 from mozilla/revert-21339-remove-unused-variables
Revert "Remove unused variables with the Babel plugin"
2026-05-26 21:04:45 +02:00
Jonas Jenwald
6d8d6f1349
Revert "Remove unused variables with the Babel plugin" 2026-05-26 21:00:25 +02:00
Jonas Jenwald
6a1368ad81
Merge pull request #21339 from nicolo-ribaudo/remove-unused-variables
Remove unused variables with the Babel plugin
2026-05-26 18:59:32 +02:00