22613 Commits

Author SHA1 Message Date
Tim van der Meij
559e2f2006
Merge pull request #21236 from calixteman/pixel_fallback_smask
Fall back to pixel-buffer SMask filtering when ctx.filter is unavailable
2026-05-10 14:27:52 +02:00
Tim van der Meij
47e32709b3
Merge pull request #21246 from Snuffleupagus/crypto_spec-fromHex
Use `Uint8Array.fromHex` in `test/unit/crypto_spec.js`
2026-05-10 14:12:33 +02:00
Tim van der Meij
33a6f3e206
Merge pull request #21238 from Snuffleupagus/PDFDataRangeTransport-unittest-faster
Make the `PDFDataRangeTransport` streaming unit-tests faster
2026-05-10 14:11:09 +02:00
Tim van der Meij
e8a051cee5
Merge pull request #21248 from mozilla/dependabot/npm_and_yarn/babel/plugin-transform-modules-systemjs-7.29.4
Bump @babel/plugin-transform-modules-systemjs from 7.29.0 to 7.29.4
2026-05-10 14:07:18 +02:00
Tim van der Meij
e511c88f11
Merge pull request #21244 from mozilla/dependabot/npm_and_yarn/fast-uri-3.1.2
Bump fast-uri from 3.1.0 to 3.1.2
2026-05-10 14:06:27 +02:00
Tim van der Meij
58ee4cd18d
Merge pull request #21243 from mozilla/dependabot/npm_and_yarn/fast-xml-builder-1.2.0
Bump fast-xml-builder from 1.1.5 to 1.2.0
2026-05-10 14:06:00 +02:00
dependabot[bot]
f6e69b8a20
Bump @babel/plugin-transform-modules-systemjs from 7.29.0 to 7.29.4
Bumps [@babel/plugin-transform-modules-systemjs](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-modules-systemjs) from 7.29.0 to 7.29.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.29.4/packages/babel-plugin-transform-modules-systemjs)

---
updated-dependencies:
- dependency-name: "@babel/plugin-transform-modules-systemjs"
  dependency-version: 7.29.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 17:40:37 +00:00
Jonas Jenwald
eb184851a8 Use Uint8Array.fromHex in test/unit/crypto_spec.js
This replaces the old `hex2binary` helper function with the native `Uint8Array.fromHex` method.
2026-05-09 17:17:50 +02:00
dependabot[bot]
b5af8151f6
Bump fast-uri from 3.1.0 to 3.1.2
Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.0 to 3.1.2.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](https://github.com/fastify/fast-uri/compare/v3.1.0...v3.1.2)

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 00:28:57 +00:00
dependabot[bot]
e94f9a9797
Bump fast-xml-builder from 1.1.5 to 1.2.0
Bumps [fast-xml-builder](https://github.com/NaturalIntelligence/fast-xml-builder) from 1.1.5 to 1.2.0.
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-builder/blob/main/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-builder/compare/v1.1.5...v1.2.0)

---
updated-dependencies:
- dependency-name: fast-xml-builder
  dependency-version: 1.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-08 18:32:54 +00:00
Jonas Jenwald
15921243d4 Make the PDFDataRangeTransport streaming unit-tests faster
The delay between chunks when testing streaming is necessary to avoid the entire PDF document arriving all at once, since that would render those unit-tests somewhat pointless.
However, the delay is unnecessarily large which causes these unit-tests to be slower than necessary.

Also, update the range unit-tests to check the expected number of fetches *exactly* since those values are not supposed to vary.
2026-05-08 12:44:32 +02:00
calixteman
e86e9d9465
Merge pull request #21237 from mozilla/update-locales
l10n: Update locale files
2026-05-08 08:39:19 +02:00
github-actions[bot]
80dd1b3ecc l10n: Update locale files 2026-05-08 00:45:17 +00:00
calixteman
a5e9940d14
Merge pull request #21231 from calixteman/simplify_extract
Simplify '#getFilteredPageIndices' and '#resolveInsertAfterIndices'
2026-05-07 22:28:48 +02:00
calixteman
b8232710c8
Fall back to pixel-buffer SMask filtering when ctx.filter is unavailable
For now OffscreenCanvas in worker threads doesn't support ctx.filter,
so we need to fall back to a more expensive pixel-buffer SMask filtering in that case.
As a side effect, this also allows to support correctly smask in Safari.
2026-05-07 22:27:04 +02:00
Calixte Denizet
b39440b6e0
Simplify '#getFilteredPageIndices' and '#resolveInsertAfterIndices' 2026-05-07 21:41:37 +02:00
Tim van der Meij
a328294713
Merge pull request #21235 from calixteman/bug2033095
Improve soft mask composition performance (bug 2033095)
2026-05-07 21:35:09 +02:00
Tim van der Meij
e81507c167
Merge pull request #21228 from calixteman/bug2027682
Place new annotations on the correct page when extracting pages (bug 2027682)
2026-05-07 21:12:15 +02:00
Tim van der Meij
9953501a0d
Merge pull request #21223 from calixteman/bug2034827
Make sure the focus moves on the first page of the added pdf after a merge (bug 2034827)
2026-05-07 21:04:29 +02:00
Tim van der Meij
4b4666e302
Merge pull request #21232 from mozilla/dependabot/npm_and_yarn/ip-address-10.2.0
Bump ip-address from 10.1.0 to 10.2.0
2026-05-07 20:54:27 +02:00
Calixte Denizet
1658a792ce Improve soft mask composition performance (bug 2033095)
Prepare reusable soft-mask canvases for filtered and backdrop-dependent masks,
and use a faster destination-in composition path where possible.
Handle Alpha SMask /BC correctly, preserve OOB alpha behavior, and mirror canvas path
operations needed while rendering inside soft-mask mode (mirrored clip was buggy).

Add reftest PDFs covering Alpha masks, transfer functions, backdrop/OOB
alpha, and the optimized composition paths.
2026-05-07 19:06:49 +02:00
dependabot[bot]
175c184956
Bump ip-address from 10.1.0 to 10.2.0
Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.1.0 to 10.2.0.
- [Commits](https://github.com/beaugunderson/ip-address/commits)

---
updated-dependencies:
- dependency-name: ip-address
  dependency-version: 10.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-07 00:37:45 +00:00
Calixte Denizet
4c62a49483
Place new annotations on the correct page when extracting pages (bug 2027682) 2026-05-06 18:44:02 +02:00
Jonas Jenwald
cce61cb7f4
Merge pull request #21229 from Snuffleupagus/WasmImage-private
Tweak the `WasmImage` implementation a little bit (PR 21225 follow-up)
2026-05-06 18:27:44 +02:00
Jonas Jenwald
3f6a2feef6 Tweak the WasmImage implementation a little bit (PR 21225 follow-up)
This fixes two things that I overlooked in PR 21225, more specifically:

 - Use proper, rather than semi, private class fields in `WasmImage`.

 - Make tracking of `WasmImage` instances optional, to avoid keeping data alive permanently in the `IMAGE_DECODERS` build.
2026-05-06 17:52:35 +02:00
Calixte Denizet
a6cb30a9e5
Make sure the focus moves on the first page of the added pdf after a merge (bug 2034827) 2026-05-06 13:42:49 +02:00
Jonas Jenwald
cd1b5f57c7
Merge pull request #21226 from Snuffleupagus/unittestcli-coverage-external
Include the `external/` folder in the coverage report for `gulp unittestcli`
2026-05-05 22:52:39 +02:00
Jonas Jenwald
d33d9fc61d Include the external/ folder in the coverage report for gulp unittestcli
Given that the (browser) `gulp unittest` coverage includes the `external/` folder, it seems reasonable to include that folder in the coverage report when running unit-tests in Node.js as well.
2026-05-05 22:12:18 +02:00
Tim van der Meij
ac51bdf745
Merge pull request #21222 from Snuffleupagus/getPdfFilenameFromUrl-tweaks
A couple of small tweaks of the `getPdfFilenameFromUrl` helper
2026-05-05 20:27:55 +02:00
Tim van der Meij
d36e61d020
Merge pull request #21224 from Snuffleupagus/Node-26
Run unit-tests in Node.js version 26
2026-05-05 20:20:48 +02:00
Tim van der Meij
a1d9f13278
Merge pull request #21219 from calixteman/issue21217
Clear the text layer container when cancelling rendering
2026-05-05 20:19:13 +02:00
Jonas Jenwald
5967f720b9
Merge pull request #21225 from Snuffleupagus/WasmImage
Add an abstract `WasmImage` class, that `JBig2CCITTFaxImage` and `JpxImage` inherit from
2026-05-05 20:10:27 +02:00
Jonas Jenwald
6ff0f8690f Add an abstract WasmImage class, that JBig2CCITTFaxImage and JpxImage inherit from
Given that these classes are, with the exception of their `decode` methods, virtually identical this helps reduce code duplication and simplifies maintenance.

These changes reduce the size of the `gulp mozcentral` build-target by `1292` bytes, which obviously isn't a lot but still cannot hurt.
2026-05-05 17:25:18 +02:00
Jonas Jenwald
9efb4aa4aa Run unit-tests in Node.js version 26
This was just released, see https://nodejs.org/en/blog/release/v26.0.0, hence it seems like a good idea to start running unit-tests in that version.

Also, stop running the unit-tests in Node.js version 25 since it'll soon reach EOL anyway and testing in three separate Node.js versions ought to suffice.
2026-05-05 17:09:19 +02:00
Jonas Jenwald
e8d3d19f67
Merge pull request #21220 from Snuffleupagus/DataBuilder
Replace `TrueTypeTableBuilder` and `CompilerOutput` with a single class
2026-05-05 13:07:31 +02:00
Jonas Jenwald
8fc56772e8 A couple of small tweaks of the getPdfFilenameFromUrl helper
- Shorten the `getURL` function slightly, by re-factoring the try-catch blocks.
 - Change how the `decode` function looks for a decoded ".pdf" name, to skip the regular expression matching when it's not needed and to allow re-using the already defined `pdfRegex`.
2026-05-05 12:16:57 +02:00
Jonas Jenwald
ac6a9230d1 Replace TrueTypeTableBuilder and CompilerOutput with a single class
Given that both of these classes are so similar, let's replace them with a single `DataBuilder` class instead to reduce unnecessary code-duplication.
2026-05-04 15:01:53 +02:00
Calixte Denizet
82f55e7dd9
Clear the text layer container when cancelling rendering
It fixes #21217.
2026-05-04 14:36:12 +02:00
Tim van der Meij
a55cec4a0f
Merge pull request #21216 from Snuffleupagus/CFFCharset-rm-raw
Remove the unused `raw` field from the `CFFCharset` class
2026-05-03 19:31:04 +02:00
Jonas Jenwald
53fd89682c Remove the unused raw field from the CFFCharset class
This was necessary before charset compilation was implemented, however that's been supported for many years and this is just dead code now.
 - PR 9340, back in 2018, stopped using the `raw` field.
 - PR 10591, back in 2019, implemented proper charset compilation.
2026-05-03 18:51:24 +02:00
Tim van der Meij
f54f4b606d
Merge pull request #21215 from Snuffleupagus/compileFDSelect-TypedArray-set
Replace a loop with `TypedArray.prototype.set()` in the `compileFDSelect` method
2026-05-03 18:30:18 +02:00
Jonas Jenwald
027671e6dc Replace a loop with TypedArray.prototype.set() in the compileFDSelect method
Given that the `fdSelect.fdSelect` data is a regular Array, this code can simplified a tiny bit.
2026-05-03 16:32:48 +02:00
Tim van der Meij
c196fa8196
Merge pull request #21214 from Snuffleupagus/CFFFont-improvements
Remove the `CompilerOutput.prototype.finalData` getter, and a few other font improvements (PR 21053 follow-up)
2026-05-03 16:07:22 +02:00
Jonas Jenwald
e5e82b9617 Don't create a DataView for the "CFF " TrueType table in readTableEntry
Given that the "CFF " table may be replaced completely, during font-parsing, it shouldn't make sense to read and/or modify it piecewise.
2026-05-03 13:17:23 +02:00
Jonas Jenwald
b65eedc636 Set the correct data if compilation fails in the CFFFont constructor
The `CFFFont.prototype.data` should contain a `Uint8Array`, however if compilation failed it was being set to a `Stream` instance which will thus fail elsewhere in the font-code.

*Please note:* This was found by code inspection, since I don't have a PDF document that's fixed by this change.
2026-05-03 13:17:18 +02:00
Jonas Jenwald
521f4dc554 Remove the CompilerOutput.prototype.finalData getter (PR 21053 follow-up)
Return the data as-is from the `CFFCompiler.prototype.compile` method, rather than making a copy of it first.
The reason that it was implemented this way in PR 21053 was to avoid keeping a potentially large `ArrayBuffer` alive, see https://github.com/mozilla/pdf.js/pull/21053#discussion_r3045402988

Having traced all the call-sites in the font-code that directly or indirectly invoke that code, I've now managed to conclude that the compiled CFF-data is never stored on the `Font` instance and using the data as-is thus shouldn't increase permanent memory usage.
2026-05-03 13:13:50 +02:00
Tim van der Meij
6d5e8696c4
Merge pull request #21211 from Snuffleupagus/JpxStream-rm-params
Don't provide unused /DecodeParms when initializing `JpxStream`
2026-05-02 14:11:36 +02:00
Tim van der Meij
ccf9e03e18
Merge pull request #21210 from timvandermeij/unit-test-optimize-find
Optimize runtime of the find controller unit tests
2026-05-02 14:10:38 +02:00
Jonas Jenwald
a8715f6f96 Don't provide unused /DecodeParms when initializing JpxStream 2026-05-02 12:20:28 +02:00
Tim van der Meij
038ca33f8e
Optimize runtime of the find controller unit tests
The find controller tests consistently show up in the list of slowest
tests reported by Jasmine. Profiling shows that most of the time is
spent waiting for the find results to arrive, even though the find
command itself is quite fast.

It turns out that the slowdown occurs between receiving the `find` event
and actually triggering the search. The find controller has a hardcoded
delay of 250 milliseconds built in, which was introduced for viewer
performance many years ago because otherwise every keystroke would
trigger a search even though the user's query was not complete yet.

For the unit tests we don't need this delay because, contrary to the
viewer use case, we don't have to account for user interaction and
instead dispatch complete `find` events on the event bus ourselves.
However, since the unit tests were introduced well over a year after
the delay was introduced, due to an oversight it was never made
configurable so we could skip it for the unit tests.

This commit fixes the issue, which locally results in the runtime of
`npx gulp unittest --noChrome` dropping from 39.991 seconds before this
patch to 29.116 seconds afterwards, which is a 27% speedup.
2026-05-01 19:31:13 +02:00