23921 Commits
Author SHA1 Message Date
Tim van der Meij 2581d8f70a Merge pull request #22065 from Snuffleupagus/ChunkedStreamManager-Set-direct-delete
Directly call `Set.prototype.delete` in the `ChunkedStreamManager` code
2026-10-03 19:35:05 +02:00
Tim van der Meij 7445074a76 Merge pull request #22046 from calixteman/rgb-to-rgba-alignment
Fix a few edge cases when converting RGB images in `convertRGBToRGBA` and `ImageResizer`
2026-10-03 19:09:12 +02:00
Tim van der Meij 36692033e1 Merge pull request #22066 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-10-03 19:00:28 +02:00
Tim van der Meij f40ca42ca7 Bump the stable version in pdfjs.config 2026-10-03 18:44:55 +02:00
Jonas Jenwald 1316be0dca Directly call Set.prototype.delete in the ChunkedStreamManager code
There's no point in first checking if a value exists in a Set before deleting it, and this is just a left-over from before the code used Maps and Sets.

Also, remove a couple of unnecessary comments describing how `Set.prototype.add` works (when those where added there wasn't much Set usage in the code-base).
2026-10-03 18:38:26 +02:00
Tim van der Meij d0991a0d53 Merge pull request #22064 from Snuffleupagus/_requestChunks-avoid-pointless-requestId
Avoid creating a pointless `requestId` in the `ChunkedStreamManager.prototype._requestChunks` method
v6.4.299
2026-10-03 17:49:02 +02:00
Tim van der Meij d7e710169d Merge pull request #22062 from timvandermeij/updates
Update dependencies to the most recent versions
2026-10-03 17:46:33 +02:00
Jonas Jenwald bcf89431d5 Avoid creating a pointless requestId in the ChunkedStreamManager.prototype._requestChunks method
In cases where all the requested chunks are already available, and dispatching a range-request thus isn't necessary, there's no point in creating an unused `requestId` nor keeping track of it since it'll never be accessed given the early return.
2026-10-03 17:18:28 +02:00
calixteman 7594737f73 Fix a few edge cases when converting RGB images in convertRGBToRGBA and ImageResizer
- `convertRGBToRGBA` ignored the `byteOffset` of the source, which isn't zero
   when e.g. the data of an uncompressed image is read directly from the file,
   and it threw when the source wasn't 4-byte aligned. In that case all the
   pixels are now converted one by one.
   It also used `len >> 2`, which overflows for sources larger than 2 GiB.
 - In `ImageResizer.#rescaleImageData`, when the image had to be converted in
   several chunks:
   - if the chunk height divided the image height, the last chunk was converted
     with the full image height;
   - the rows were sampled relatively to each chunk, hence a chunk height which
     isn't a multiple of `2 ** K` shifted the sub-sampling grid and left the
     last rows of the result empty. They're now sampled on the image grid;
   - the chunk height is rounded to a multiple of 4 when possible, in order to
     keep the RGB data aligned;
   - if not even a single row fitted in the buffer, the loop never ended.
2026-10-03 17:04:16 +02:00
Tim van der Meij d03359cb57 Merge pull request #22061 from Snuffleupagus/SupportedImageMimeTypes-Set
Convert `SupportedImageMimeTypes` into a Set
2026-10-03 16:47:25 +02:00
Tim van der Meij 76f6eb6356 Fix vulnerability in the fast-uri dependency
This patch is automatically generated with `npm audit fix` and fixes
CVE-2026-86472.
2026-10-03 16:33:26 +02:00
Tim van der Meij e987c74cd6 Upgrade eslint-plugin-unicorn to version 77.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v77.0.0
doesn't indicate any breaking changes that should impact us.

Note that it does require a number of code changes due to improvements
that were made for the `unicorn/prefer-logical-operator-over-ternary`
(allowing us to remove previously added ignore lines; see
https://github.com/sindresorhus/eslint-plugin-unicorn/issues/3766)
and `unicorn/prefer-ternary` (to detect a new case) rules.
2026-10-03 16:27:45 +02:00
Tim van der Meij bf5f6ea4b1 Upgrade eslint-plugin-jsdoc to version 65.0.2
This is a major version bump, but the changelogs at
https://github.com/gajus/eslint-plugin-jsdoc/releases
don't indicate any breaking changes that should impact us.
2026-10-03 16:27:44 +02:00
Tim van der Meij 7dc3cf0421 Update dependencies to the most recent versions 2026-10-03 16:27:44 +02:00
calixteman e9d1c85c7c Merge pull request #22041 from calixteman/sampled-fn-arity
Check shading function dimensions and bound sampled interpolation
2026-10-03 16:26:30 +02:00
calixteman c67fe1529d Check shading function dimensions and bound sampled interpolation
Expose function input/output counts and reject incompatible shading and
stitching functions.

Reuse interpolation buffers instead of allocating cube vertices per call.
Skip axes at integer sample coordinates, fixing invalid sample accesses
for Size=1 axes.

For functions with more than eight inputs, use simplex interpolation.
It reads at most m + 1 sample-table entries per output for m inputs,
instead of up to 2^m. It can produce different values from multilinear
interpolation.
2026-10-03 16:22:43 +02:00
Tim van der Meij c1c20f6d56 Merge pull request #22060 from Snuffleupagus/FontInfo-rm-numbers
Stop exporting the Font `ascent` and `descent` by default, and remove handling of standalone number entries in the compiled font-info
2026-10-03 16:04:12 +02:00
Jonas Jenwald 1d29095df7 Convert SupportedImageMimeTypes into a Set
Using `Set.prototype.has` should be preferable to `Array.prototype.includes`, and given that `Iterator.prototype.join` is [supported in Firefox](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/join#browser_compatibility) (and polyfilled elsewhere) creating the string-representation isn't a problem.
2026-10-03 16:03:17 +02:00
calixteman fecf042a90 Merge pull request #22058 from calixteman/text-layer-stale-font-cache
Avoid resetting the text-layer measurement font
2026-10-03 15:53:14 +02:00
Jonas Jenwald edd591f54b Remove handling of standalone number entries in the compiled font-info
After the previous patch this code is no longer used.
2026-10-03 14:11:31 +02:00
Jonas Jenwald e43c8ebf23 Stop exporting the Font ascent and descent by default
The only main-thread usage of these properties are in a fallback code-path in the `TextLayer` code, see below, however in that case these properties are accessed via the `TextStyle` object rather than through the font-info:
 - https://github.com/mozilla/pdf.js/blob/87a106c03447d05ab8d759d5f9fa888310a7299e/src/display/text_layer.js#L566-L579

 - https://github.com/mozilla/pdf.js/blob/87a106c03447d05ab8d759d5f9fa888310a7299e/src/display/api.js#L1187-L1194

*Note:* The code to write and read numbers in the compiled font-info will be removed in a follow-up, to make it easier to re-instate that code in the future.
2026-10-03 14:03:49 +02:00
Tim van der Meij 87a106c034 Merge pull request #22059 from Snuffleupagus/FontInfo-rm-extra
Stop passing `extra` properties to the `FontInfo` class
2026-10-03 12:51:53 +02:00
Tim van der Meij b5809f83d6 Merge pull request #22057 from Snuffleupagus/rm-name-export
Stop exporting the Font `name` by default
2026-10-03 12:51:11 +02:00
calixteman 62984d48db Avoid resetting the text-layer measurement font
Resizing the canvas in #getAscent reset ctx.font to 10px sans-serif
without updating #canvasCtxFonts. A subsequent 30px run using the
same family could skip setting the font and get an incorrect width.

Remove the resizing left over from the pixel-based fallback removed
in PR #19399. Add a regression test comparing 30px and 33px runs.
2026-10-03 12:21:10 +02:00
Jonas Jenwald 02aa7f5e91 Stop passing extra properties to the FontInfo class
The `FontInfo` class doesn't use the `extra` properties for anything, and they are already exposed via the `FontFaceObject` instance which is how the debuggers access those properties.
2026-10-03 11:28:43 +02:00
Jonas Jenwald f8e53e0e0c Stop exporting the Font name by default
The only main-thread usage of this property is in the debuggers, hence we don't need to export it as part of the "compiled" font-info.
2026-10-02 23:14:11 +02:00
Jonas Jenwald ef62f31f24 Merge pull request #22035 from Snuffleupagus/FontInfo-shadow
Shadow the getters in `FontInfo`, `CssFontInfo`, and `SystemFontInfo` (PR 20197 follow-up)
2026-10-02 16:41:09 +02:00
Tim van der Meij c7e2fe4d29 Merge pull request #22012 from calixteman/tiling-pattern-tiny-steps-dos
Bound tiling pattern folding work for tiny steps
2026-10-02 15:31:33 +02:00
Tim van der Meij 8496056b9a Merge pull request #22056 from Snuffleupagus/charCodeToGlyphId-cidToGidMap-skip-has
Directly lookup entries in the `cidToGidMap` when building the `charCodeToGlyphId` map, for embedded composite fonts
2026-10-02 15:26:48 +02:00
Jonas Jenwald db561fecc6 Shadow the getters in FontInfo, CssFontInfo, and SystemFontInfo (PR 20197 follow-up)
Prior to PR 20197 each font-instance had just a single copy of all its relevant font-properties on the main-thread, however that's unfortunately no longer the case.
Given how the compilation was implemented, every single time that a font-property is accessed on the main-thread it'll now be re-parsed. Not only does this seem inefficient, especially for properties needed e.g. during text-rendering, but it'll lead to (potentially) a lot of duplicated object creation.

Consider what currently happens when rendering all pages of the following PDFs:
 - `tracemonkey.pdf` contains `24` separate fonts, but the `fontMatrix`-property is re-parsed a whopping `1009` times (once per `showText` operator).

 - `standard_fonts.pdf` contains `14` separate fonts, however we create no less than `186` separate `StandardFontInfo` instances.

 - `xfa_bug1716816.pdf` contains `4` separate fonts, however we create no less than `45` separate `CssFontInfo` instances.

This is obviously not limited to just the font-properties listed above, but those are mere examples to illustrate the problem.
By shadowing the font-property getters on the main-thread, obviously with the exception of `FontInfo.prototype.data`, we only need to parse each font-property *once* per font-instance.

*Note:* Unfortunately this *increases* the size of the `gulp mozcentral` bundle by `792` bytes, but that cannot really be helped since this seems like the correct thing to do regardless.
2026-10-02 15:25:24 +02:00
Jonas Jenwald a00ad131fd Introduce a helper to reduce duplication when reading compiled buffer-data from fonts
Currently the `FontInfo.prototype.{data, cssFontInfo, systemFontInfo}` getters duplicate virtually the same code when reading buffer-data, which seems completely unnecessary.

*Note:* This reduces the size of the `gulp mozcentral` bundle by `738` bytes, and with the upcoming worker-rendering this saving will be doubled.
2026-10-02 15:25:09 +02:00
Tim van der Meij 20b2e11213 Merge pull request #22038 from Snuffleupagus/rm-mimetype-export
Stop exporting the Font `mimetype` property
2026-10-02 15:12:44 +02:00
Tim van der Meij 0f116c95da Merge pull request #22033 from mozilla/dependabot/github_actions/github/codeql-action/init-4.38.1
Bump github/codeql-action/init from 4.38.0 to 4.38.1
2026-10-02 15:10:12 +02:00
Tim van der Meij f576c25bcd Merge pull request #22032 from mozilla/dependabot/github_actions/github/codeql-action/autobuild-4.38.1
Bump github/codeql-action/autobuild from 4.38.0 to 4.38.1
2026-10-02 15:09:47 +02:00
Tim van der Meij fecddae585 Merge pull request #22030 from mozilla/dependabot/github_actions/github/codeql-action/analyze-4.38.1
Bump github/codeql-action/analyze from 4.38.0 to 4.38.1
2026-10-02 15:09:17 +02:00
Tim van der Meij 637ed4cfe3 Merge pull request #22031 from mozilla/dependabot/github_actions/codecov/codecov-action-7.1.1
Bump codecov/codecov-action from 7.1.0 to 7.1.1
2026-10-02 14:53:14 +02:00
Tim van der Meij 5baa62329e Merge pull request #22054 from mozilla/dependabot/npm_and_yarn/multi-581aeff57e
Bump brace-expansion
2026-10-02 14:50:44 +02:00
Tim van der Meij fe0e9afdb1 Merge pull request #22053 from mozilla/dependabot/npm_and_yarn/undici-7.30.0
Bump undici from 7.29.0 to 7.30.0
2026-10-02 14:45:47 +02:00
Tim van der Meij 90448db27e Merge pull request #22055 from mozilla/dependabot/npm_and_yarn/markdown-it-14.3.2
Bump markdown-it from 14.2.0 to 14.3.2
2026-10-02 14:45:15 +02:00
Jonas Jenwald dc7ac33fcd Directly lookup entries in the cidToGidMap when building the charCodeToGlyphId map, for embedded composite fonts
Rather than first checking if the entry exists in the `cidToGidMap`, we can lookup it directly and instead fallback to `-1` when it doesn't exist.
2026-10-02 14:14:09 +02:00
dependabot[bot] b6753b1bf3 Bump markdown-it from 14.2.0 to 14.3.2
Bumps [markdown-it](https://github.com/markdown-it/markdown-it) from 14.2.0 to 14.3.2.
- [Changelog](https://github.com/markdown-it/markdown-it/blob/14.3.2/CHANGELOG.md)
- [Commits](https://github.com/markdown-it/markdown-it/compare/14.2.0...14.3.2)

---
updated-dependencies:
- dependency-name: markdown-it
  dependency-version: 14.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-02 10:34:54 +00:00
dependabot[bot] 1d43a5a956 Bump brace-expansion
Bumps  and [brace-expansion](https://github.com/juliangruber/brace-expansion). These dependencies needed to be updated together.

Updates `brace-expansion` from 2.1.4 to 2.1.7
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v2.1.4...v2.1.7)

Updates `brace-expansion` from 5.0.9 to 5.0.12
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v2.1.4...v2.1.7)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 2.1.7
  dependency-type: indirect
- dependency-name: brace-expansion
  dependency-version: 5.0.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-02 10:34:39 +00:00
dependabot[bot] c58ed927af Bump undici from 7.29.0 to 7.30.0
Bumps [undici](https://github.com/nodejs/undici) from 7.29.0 to 7.30.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v7.29.0...v7.30.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 7.30.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-02 10:34:39 +00:00
calixteman c33c32aed4 Merge pull request #22049 from calixteman/update_openjpeg3
Update OpenJpeg to 8314119b067c0fc77834731168daaebd379fdb12
2026-10-01 17:17:58 +02:00
calixteman d9080794fa Merge pull request #22034 from calixteman/sandbox-resetform-non-terminal
Reset the descendants of non-terminal fields in Doc.resetForm
2026-10-01 16:11:29 +02:00
calixteman f786355550 Update OpenJpeg to 8314119b067c0fc77834731168daaebd379fdb12 2026-10-01 15:43:30 +02:00
calixteman e3e606de23 Merge pull request #22047 from calixteman/vertical-default-vx
Use the glyph width for the default vertical origin
2026-10-01 15:05:55 +02:00
Jonas Jenwald 05566bd110 Stop exporting the Font mimetype property
- All embedded font data, regardless of how it's specified in the PDF, is always converted into OpenType in the worker-thread. This has been the case since "forever" in the PDF.js project, hence the value of `Font.prototype.mimetype` never varies (when actually set).

 - With the introduction of the CSS Font Loading API, in the font-loading code, the `mimetype` property is no longer used *by default* in the main-thread.

 - Given that `Font.prototype.mimetype` is either a string or `null`, the way that PR 20197 implemented the serialization/deserialization isn't actually correct since an explicit `null` value is being converted into a `"null"` string.
2026-10-01 14:14:26 +02:00
Jonas Jenwald 62de7c55e1 Merge pull request #22042 from Snuffleupagus/rm-defaultVMetrics-export
Stop exporting the Font `defaultVMetrics` by default
2026-10-01 14:09:30 +02:00
calixteman 29a06285dc Use the glyph width for the default vertical origin
Without a W2 entry, use half the glyph's horizontal width for vx
(PDF 32000-1, 9.7.4.3), retaining the DW2 vertical metrics.

Follow-up to #20933.
2026-10-01 13:21:23 +02:00