23311 Commits

Author SHA1 Message Date
Tim van der Meij
e58091a769
Merge pull request #21621 from Snuffleupagus/openAction-Map
[api-minor] Convert `getOpenAction` to return data in a Map
2026-07-23 20:57:42 +02:00
Tim van der Meij
890f2add63
Merge pull request #21618 from Snuffleupagus/Ref-str
Improve the `Ref.prototype.toString` method a tiny bit
2026-07-23 20:31:48 +02:00
LuShadowX
388168a2b8 Document the preserve and dependencyLists params for recordOperation 2026-07-23 19:31:33 +05:30
Jonas Jenwald
c474a97932 [api-minor] Convert getOpenAction to return data in a Map
Compared to regular Objects there's a number of advantages to using Maps:
 - They support proper iteration.
 - They have a simple way to check for the existence of data.
 - They have a simple/efficient way to check the number of elements.

If this functionality was added today, I cannot imagine that we'd choose an Object for this data.
2026-07-23 13:52:02 +02:00
Calixte Denizet
ed81227557 Improve the detection of the changes made after a document has been signed 2026-07-23 12:44:20 +02:00
Calixte Denizet
4ea07c2431
Only handle scripting updates that target a known field
Collect the ids of the document field annotations and ignore any id
coming from the scripting sandbox that isn't among them.
2026-07-22 16:11:57 +02:00
Jonas Jenwald
27a8002f7e Improve the Ref.prototype.toString method a tiny bit
When getting/creating a new `Ref` instance, via the static `Ref.get` method, we already need to compute a cache-key.
Since this key is identical to the format used by the `toString` method, we can avoid having to re-create that string (a lot) by also providing it to the `Ref` constructor.
2026-07-22 13:27:26 +02:00
Calixte Denizet
6c18df5768
Restrict the elements, attributes and styles the XFA layer can render
Only create a known set of HTML/SVG elements, and only apply a known set
of attributes and CSS properties, when building the XFA/rich-text DOM;
anything else is now ignored.
2026-07-22 12:12:08 +02:00
calixteman
0c8f67059e
Merge pull request #21616 from calixteman/fix/pdf-editor-indirect-default-resources
Preserve indirect AcroForm resources
2026-07-21 21:45:13 +02:00
Tim van der Meij
f988c56394
Merge pull request #21615 from Snuffleupagus/Binder-reuse-NS_DATASETS
Re-use the `NS_DATASETS` constant more in the `src/core/xfa/bind.js` file
2026-07-21 20:16:39 +02:00
Tim van der Meij
1b48daa461
Merge pull request #21614 from mozilla/dependabot/github_actions/github/codeql-action/autobuild-4.37.0
Bump github/codeql-action/autobuild from 4.36.3 to 4.37.0
2026-07-21 20:10:19 +02:00
Tim van der Meij
2bdd9e3d9c
Merge pull request #21613 from mozilla/dependabot/github_actions/github/codeql-action/init-4.37.0
Bump github/codeql-action/init from 4.36.3 to 4.37.0
2026-07-21 20:10:05 +02:00
Tim van der Meij
34268e38fc
Merge pull request #21611 from mozilla/dependabot/github_actions/github/codeql-action/analyze-4.37.0
Bump github/codeql-action/analyze from 4.36.3 to 4.37.0
2026-07-21 20:09:53 +02:00
Tim van der Meij
876ec4bd96
Merge pull request #21612 from mozilla/dependabot/github_actions/actions/setup-node-7.0.0
Bump actions/setup-node from 6.4.0 to 7.0.0
2026-07-21 20:06:47 +02:00
Calixte Denizet
f0bbfa6f9e Preserve indirect AcroForm resources 2026-07-21 19:41:45 +02:00
Jonas Jenwald
69e26ad319 Re-use the NS_DATASETS constant more in the src/core/xfa/bind.js file 2026-07-21 16:04:24 +02:00
dependabot[bot]
cfb92313fa
Bump github/codeql-action/autobuild from 4.36.3 to 4.37.0
Bumps [github/codeql-action/autobuild](https://github.com/github/codeql-action) from 4.36.3 to 4.37.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](54f647b7e1...99df26d4f1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 12:16:47 +00:00
dependabot[bot]
569bae5900
Bump github/codeql-action/init from 4.36.3 to 4.37.0
Bumps [github/codeql-action/init](https://github.com/github/codeql-action) from 4.36.3 to 4.37.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](54f647b7e1...99df26d4f1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 12:15:32 +00:00
dependabot[bot]
6509517da3
Bump actions/setup-node from 6.4.0 to 7.0.0
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.4.0 to 7.0.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](48b55a011b...8207627860)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 12:14:16 +00:00
dependabot[bot]
f97e61a7a2
Bump github/codeql-action/analyze from 4.36.3 to 4.37.0
Bumps [github/codeql-action/analyze](https://github.com/github/codeql-action) from 4.36.3 to 4.37.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](54f647b7e1...99df26d4f1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 12:14:00 +00:00
Jonas Jenwald
028c02f539
Merge pull request #21607 from Snuffleupagus/viewerPreferences-Map
[api-minor] Convert `getViewerPreferences` to return data in a Map
2026-07-20 22:14:55 +02:00
Tim van der Meij
d314788368
Merge pull request #21604 from calixteman/issue21593
Copy the backdrop for non-isolated groups with a soft mask
2026-07-20 20:00:28 +02:00
Tim van der Meij
1a1090a0ae
Merge pull request #21602 from timvandermeij/updates
Update dependencies to the most recent versions
2026-07-20 19:53:39 +02:00
Tim van der Meij
559ab148a9
Merge pull request #21603 from timvandermeij/gitattributes
Update the file format entries in `.gitattributes`
2026-07-20 19:53:15 +02:00
calixteman
997dabf5a9
Merge pull request #21606 from calixteman/fix/ambiguous-date-format
Fix parsing of ambiguous date formats like `Hm`
2026-07-20 17:05:01 +02:00
Jonas Jenwald
67ed457bb8 Bump library version to 6.2
See commit eddd70a2ca1054ad2e0792972c3f2774b89f0cd2
2026-07-20 16:52:39 +02:00
Jonas Jenwald
de3eecca11 [api-minor] Convert getViewerPreferences to return data in a Map
Compared to regular Objects there's a number of advantages to using Maps:
 - They support proper iteration.
 - They have a simple way to check for the existence of data.
 - They have a simple/efficient way to check the number of elements.

If this functionality was added today, I cannot imagine that we'd choose an Object for this data.
2026-07-20 16:52:36 +02:00
calixteman
09a45ad2af
Merge pull request #21601 from uwezkhan/fix-postscript-wasm-i32const-sleb128
Encode i32.const immediates as signed LEB128 in the PostScript Wasm compiler
2026-07-20 15:29:20 +02:00
Calixte Denizet
d5661f801f Fix parsing of ambiguous date formats like Hm
We support having hours/minutes numbers with one or two digits for strings like "1:30:31" but
if the format is for example Hm, then "12" is really ambiguous.
So the idea is to match the longest string as possible.
2026-07-20 15:23:23 +02:00
uwezkhan
778aa450d9 Encode i32.const immediates as signed LEB128 in the PostScript Wasm compiler
The Type-4 PostScript -> Wasm compiler emitted i32.const immediates with the
unsigned LEB128 encoder (_emitULEB128). Wasm decodes i32.const as a *signed*
LEB128, so any immediate whose final 7-bit group has bit 0x40 set is
mis-decoded (e.g. 64 -> single byte 0x40 -> read back as -64).

The output-store address for the i-th result is emitted as i32.const (i*8).
For a function with >= 9 outputs the 9th offset is 64, which decodes as -64, so
f64.store targets 0xFFFFFFC0 and traps (memory access out of bounds). The module
still validates and instantiates, so the JS fallback in function.js is not
engaged; the trap only surfaces at render time (the affected shading / tint
transform silently fails to render). The same mis-encoding affects the constant
bitshift amount.

Add a signed-LEB128 emitter (_emitSLEB128) and use it for the three i32.const
immediate sites; local/import/type indices remain unsigned (correct). Add a unit
test covering functions with 9+ outputs, and a reference test rendering a shading
whose colour function has 9 outputs.
2026-07-20 14:56:04 +05:30
Jonas Jenwald
cd03276d60
Merge pull request #21594 from Snuffleupagus/issue-21582
Ignore Annotations with `fieldValue = null` when saving (issue 21582)
2026-07-20 11:13:03 +02:00
calixteman
547236bcd5
Merge pull request #21605 from calixteman/followup_21598
Address follow-up review comments in coverage_search.mjs
2026-07-19 23:19:55 +02:00
Jonas Jenwald
ee56dc7719 Ignore Annotations with fieldValue = null when saving (issue 21582)
Some Annotations, e.g. `SignatureWidgetAnnotation`, set `fieldValue = null` which may causing saving to fail during `writeXFADataForAcroform`, hence we simply ignore any such Annotation-data during saving.
2026-07-19 23:00:31 +02:00
calixteman
850020a84e
Address follow-up review comments in coverage_search.mjs
Use a Headers object for the request and log informational progress
messages via console.log instead of console.error.
2026-07-19 21:54:45 +02:00
calixteman
50601d0341
Copy the backdrop for non-isolated groups with a soft mask
PR #21455 drew non-isolated blend-mode groups against their backdrop via a
direct path on the parent canvas, but a soft mask forces the group onto an
intermediate canvas instead. There the inner blend modes composited against
transparency, so e.g. a /Multiply highlight was painted opaquely over the
text behind it, hiding it.

Copy the backdrop into that intermediate canvas so the blends see the real
background. The copy is limited to groups that would otherwise have taken
the direct path (source-over, alpha 1, not knockout/gray) but were displaced
onto the intermediate canvas by the soft mask.

It fixes #21593.
2026-07-19 21:01:28 +02:00
Tim van der Meij
154e82871a
Update the file format entries in .gitattributes
Several extensions (`.coffee`, `.jade`, `.inc` and others) became
obsolete in e.g. the conversion to Wintersmith/Fluent/other tools, while
other new extensions (`.mjs`, `.njk`, `.py` and others) were missing.

This commit removes all obsolete file format entries, adds all missing
ones and orders the list alphatically (so it can more easily be matched
against tooling that lists all in-use file extensions in the repository).
2026-07-19 19:33:10 +02:00
Tim van der Meij
a3a0d5d9a0
Upgrade eslint-plugin-unicorn to version 72.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v72.0.0
doesn't indicate any breaking changes that should impact us.
2026-07-19 18:53:34 +02:00
Tim van der Meij
299624a2d3
Update dependencies to the most recent versions 2026-07-19 18:52:20 +02:00
Tim van der Meij
5266f13ea4
Merge pull request #21599 from Snuffleupagus/CompiledFont-rm-hasBuiltPath
Combine the `getPathJs` and `hasBuiltPath` methods in the `CompiledFont` class
2026-07-19 18:39:16 +02:00
Jonas Jenwald
02027ba381 Combine the getPathJs and hasBuiltPath methods in the CompiledFont class
This avoids duplicating the charCode/glyphId lookup, and (slightly) shortens the code. In particular:
 - Given that the path-data is returned as a TypedArray, it's easy enough to instead return `null` to indicate that the glyph was previously compiled.

 - The charCode-cache can be changed into a Set, since we only need to track the "seen" charCodes and not their relation to the glyphIds.

 - The `compileFontPathInfo` call is moved into `CompiledFont` class, since that simplifies the `src/core/evaluator.js` code a tiny bit.
2026-07-19 16:48:07 +02:00
calixteman
ee6d5f2102
Merge pull request #21598 from calixteman/use_per_test
Download the per-test coverage index
2026-07-19 16:45:19 +02:00
calixteman
e6c7ab5425
Skip the cache existence check when --no-download is set
Move the `fs.existsSync(indexPath)` check below the `--no-download`
early return: in that mode the check is unused (the read after
refreshIndex already validates existence), so it's wasted disk I/O.
2026-07-19 16:42:05 +02:00
calixteman
c7dc7d7dd0
Sanitize the cached ETag and index to satisfy CodeQL
Address two CodeQL findings on the per-test index downloader:

- "File data in outbound network request": validate the cached ETag
  against the RFC 7232 grammar before sending it as If-None-Match, so
  the cache file's contents can't be injected into the request header.
- "Network data written to file": cache the re-serialized JSON
  (JSON.stringify(JSON.parse(...))) instead of the raw response body,
  so only well-formed JSON produced by our own serializer is written.
2026-07-19 16:13:20 +02:00
Jonas Jenwald
eddd70a2ca
Merge pull request #21597 from Snuffleupagus/destinations-Map
[api-minor] Convert `getDestinations` to return data in a Map
2026-07-19 16:06:12 +02:00
calixteman
d504000012
Download the per-test coverage index
`coverage_search` now fetches `per-test-index.json` from the pdf.js.refs
gh-pages branch, caches it locally, and only re-downloads it (via ETag)
when it changed, so querying which ref tests cover a line/function no
longer needs a local `--coverage-per-test` build. `--no-download` reuses
the cached index offline and `--index` points at a local one.

`browsertest` and `makeref` accept the same `--code` filter to run (or
regenerate refs for) only the covering tests, dropping any covered IDs
that aren't in this branch's manifest so the run isn't rejected.
2026-07-19 15:37:05 +02:00
Tim van der Meij
b83274803c
Merge pull request #21588 from calixteman/fix/pdf-editor-struct-attribute-revisions
Handle revisioned structure attributes
2026-07-19 14:11:08 +02:00
Tim van der Meij
fd77b3ea9f
Merge pull request #21591 from calixteman/fix/pdf-editor-missing-acroform-fields
Rebuild missing AcroForm fields
2026-07-19 14:08:40 +02:00
Tim van der Meij
4f7f3baed4
Merge pull request #21587 from calixteman/smask_in_data
Implement SmaskInData == 2 for JPX images
2026-07-19 13:57:41 +02:00
Tim van der Meij
8c3941a0d5
Merge pull request #21595 from Snuffleupagus/CompiledFont-Maps
Change the `CompiledFont` glyph/charCode caches to use `Map`s
2026-07-19 13:53:12 +02:00
Tim van der Meij
0a3ed983be
Merge pull request #21596 from Snuffleupagus/pattern-bCache-Map
Re-factor the `bCache`, used with /Mesh Shadings
2026-07-19 13:50:44 +02:00