23354 Commits

Author SHA1 Message Date
calixteman
a93bd42724
Enable a few more eslint-plugin-regexp rules
The remaining rules from the plugin's "Best Practices" category that the
recommended config leaves off, plus the two it only warns about, all of
which the code already complies with.

`regexp/prefer-regexp-test` is left off, since `unicorn/prefer-regexp-test`
already covers it.
2026-08-04 20:58:02 +02:00
Tim van der Meij
729ddf907f
Merge pull request #21709 from calixteman/postscript-number-regex
Remove the ambiguity from the PostScript number regex
2026-08-04 20:52:03 +02:00
Tim van der Meij
7aac9fbc6c
Merge pull request #21712 from mozilla/dependabot/npm_and_yarn/fast-uri-3.1.5
Bump fast-uri from 3.1.4 to 3.1.5
2026-08-04 20:50:37 +02:00
Tim van der Meij
724950b457
Merge pull request #21708 from calixteman/regexp-no-super-linear-move
Enable the `regexp/no-super-linear-move` ESLint rule
2026-08-04 20:50:14 +02:00
Tim van der Meij
b75d2b62a3
Merge pull request #21700 from Snuffleupagus/Menu-constructor-shorten
Shorten the `Menu` constructor a tiny bit
2026-08-04 20:47:42 +02:00
Tim van der Meij
27744881e8
Merge pull request #21703 from mozilla/dependabot/github_actions/github/codeql-action/autobuild-4.37.3
Bump github/codeql-action/autobuild from 4.37.2 to 4.37.3
2026-08-04 20:46:35 +02:00
dependabot[bot]
31bf4a09e3
Bump fast-uri from 3.1.4 to 3.1.5
Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](https://github.com/fastify/fast-uri/compare/v3.1.4...v3.1.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 18:46:28 +00:00
Tim van der Meij
1e824bd4e1
Merge pull request #21704 from mozilla/dependabot/github_actions/github/codeql-action/init-4.37.3
Bump github/codeql-action/init from 4.37.2 to 4.37.3
2026-08-04 20:46:19 +02:00
Tim van der Meij
cc1e80cea4
Merge pull request #21705 from mozilla/dependabot/github_actions/github/codeql-action/analyze-4.37.3
Bump github/codeql-action/analyze from 4.37.2 to 4.37.3
2026-08-04 20:46:03 +02:00
Tim van der Meij
ba02df40c1
Merge pull request #21701 from mozilla/dependabot/npm_and_yarn/undici-7.29.0
Bump undici from 7.28.0 to 7.29.0
2026-08-04 20:44:58 +02:00
calixteman
16f5691df7
Remove the ambiguity from the PostScript number regex
`\d+\.?\d*` can split a run of digits in as many ways as it is long, so
it would backtrack polynomially if anything following it could reject.
The optional exponent can't, hence no bug today, but `\d+(?:\.\d*)?`
accepts the same numbers unambiguously.
2026-08-04 18:48:25 +02:00
calixteman
fc01f7d033
Enable the regexp/no-super-linear-move ESLint rule
It flags the regexes whose search is quadratic in the input length, like
the autolinker and XFA-path ones fixed recently.

The three existing offenders: `\s*` matched the CSS indentation but also
the line terminators that make `^` match with the `m` flag (the
preprocessed CSS is unchanged), `(\d+)` made every digit of a number a
candidate start position, and `/T.*$/` could fail on the `$` and
backtrack since `.` doesn't match a line terminator.
2026-08-04 18:29:27 +02:00
calixteman
e57a46436f
Merge pull request #21706 from calixteman/test-menu-first-last
Add integration tests for the Home/End keys in the `Menu` class
2026-08-04 16:16:41 +02:00
calixteman
12cde32086
Add integration tests for the Home/End keys in the Menu class
Follow-up to PR #21690: these tests check that pressing Home/End
correctly updates the last focused menu-item index, so that a following
ArrowUp/ArrowDown press doesn't move focus to an unexpected menu-item.
2026-08-04 15:02:01 +02:00
dependabot[bot]
8f7f98e19f
Bump github/codeql-action/analyze from 4.37.2 to 4.37.3
Bumps [github/codeql-action/analyze](https://github.com/github/codeql-action) from 4.37.2 to 4.37.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e0647621c2...e4fba868fa)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 12:16:57 +00:00
dependabot[bot]
93441b8451
Bump github/codeql-action/init from 4.37.2 to 4.37.3
Bumps [github/codeql-action/init](https://github.com/github/codeql-action) from 4.37.2 to 4.37.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e0647621c2...e4fba868fa)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 12:15:21 +00:00
dependabot[bot]
aff4b451e1
Bump github/codeql-action/autobuild from 4.37.2 to 4.37.3
Bumps [github/codeql-action/autobuild](https://github.com/github/codeql-action) from 4.37.2 to 4.37.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e0647621c2...e4fba868fa)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 12:14:06 +00:00
dependabot[bot]
39b973801f
Bump undici from 7.28.0 to 7.29.0
Bumps [undici](https://github.com/nodejs/undici) from 7.28.0 to 7.29.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v7.28.0...v7.29.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 11:15:39 +00:00
Jonas Jenwald
1e2c571075 Shorten the Menu constructor a tiny bit
The fallback path used when the `menuItems` aren't provided/correct can be simplified, since the manual loop isn't necessary.
2026-08-04 12:41:46 +02:00
Jonas Jenwald
4806d8294e
Merge pull request #21695 from martinthomson/open-instructions
Document how to use the viewer to open files
2026-08-04 12:18:00 +02:00
Jonas Jenwald
72a76e585b
Merge pull request #21690 from Snuffleupagus/Menu-#goToInitial
Add a go to first/last menu-item helper method in the `Menu` class
2026-08-04 10:20:46 +02:00
Martin Thomson
ca44b47751 Document how to use the viewer to open files
This is not an option that appears in the Firefox integration,
so it is not obvious how to find it.
2026-08-04 09:40:34 +10:00
Jonas Jenwald
fc610d3e59 Add a go to first/last menu-item helper method in the Menu class
This fixes a bug when using the <kbd>Home</kbd> and <kbd>End</kbd> keyboard shortcuts to navigate through a `Menu` instance. These two buttons didn't update the `#lastIndex` field, which means that e.g. a following <kbd>ArrowDown</kbd> or <kbd>ArrowUp</kbd> press could make focus "jump" to an unexpected menu-item.

Also, the helper method reduces a little bit of code duplication in the event handlers.
2026-08-03 22:25:52 +02:00
calixteman
b4ba666b0c
Merge pull request #21694 from calixteman/improve_font_familly_san
Safely serialize CSS font family names
2026-08-03 21:12:10 +02:00
calixteman
4c4e8feafd
Merge pull request #21693 from calixteman/fix/quad-regex-autolinker
Bound the email parts in the autolinker regex
2026-08-03 18:03:43 +02:00
calixteman
f21fe34747
Safely serialize CSS font family names 2026-08-03 18:02:10 +02:00
calixteman
ba7bf7b26c
Merge pull request #21683 from calixteman/fix/quad-regex-writer
Don't write numbers in exponential notation when saving a pdf
2026-08-03 17:49:23 +02:00
calixteman
1da36fb6bf
Merge pull request #21686 from calixteman/fix/quad-regex-xfa-path
Anchor the regex used to extract the XFA path positions
2026-08-03 17:46:24 +02:00
calixteman
92d027eaeb
Anchor the regex used to extract the XFA path positions
Matching the name with a leading `.+` is quadratic in the length of
a component which doesn't end with a position, and every AcroForm
field name goes through this.
2026-08-03 17:07:48 +02:00
calixteman
5375bff642
Don't write numbers in exponential notation when saving a pdf
`toFixed(10)` switches to the exponential notation from 1e21 on, which isn't
valid PDF syntax, and removing the trailing zeros then dropped a digit of the
exponent: 1e30 was written "1e+3" and 1e100 "1e+1". Such a number, necessarily
an integer, is now written with all its digits.

The trailing zeros are removed with a backward scan, since `toFixed(10)` always
produces exactly 10 decimals. Below the 1e21 limit its output is at most 33
characters long, so the previous `$`-anchored regex wasn't a performance issue.
2026-08-03 16:59:12 +02:00
calixteman
b1f51818ae
Bound the email parts in the autolinker regex
The local part and the domain labels were unbounded, making the
search quadratic in the length of a run of characters preceding
an "@": scanning the text of a single page could take seconds.
2026-08-03 16:38:02 +02:00
Tim van der Meij
ae976b924b
Merge pull request #21671 from Snuffleupagus/getFieldObjects-Map
[api-minor] Convert `getFieldObjects` to return data in a Map
2026-08-02 22:37:22 +02:00
Tim van der Meij
ec691130e6
Merge pull request #21692 from calixteman/fix/quad-regex-xml-entities
Exclude "&" from the XML entity names
2026-08-02 22:24:11 +02:00
Jonas Jenwald
88716313d6 Bump library version to 6.3
See commit ce4ff55faaa83b39b0137dc458af6eea6f96235f
2026-08-02 21:27:09 +02:00
Jonas Jenwald
82624a5e50 [api-minor] Convert getFieldObjects 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.

In the Firefox PDF Viewer sending Maps to the scripting-implementation should be fine, since it uses the browser `Cu.cloneInto` functionality; see https://searchfox.org/firefox-main/source/toolkit/components/pdfjs/content/PdfSandbox.sys.mjs
However with QuickJS, used by the GENERIC viewer, all data needs to be stringified and Maps are converted into regular Objects (see also PR 21664). Hence the `objects` property, in the scripting-implementation, is converted back into a Map using the (renamed) `createMap` helper function.
2026-08-02 21:27:07 +02:00
Jonas Jenwald
7590ad5312
Merge pull request #21689 from timvandermeij/updates
Update dependencies to the most recent versions
2026-08-02 21:25:38 +02:00
Jonas Jenwald
923d48ead4
Merge pull request #21691 from Snuffleupagus/Field-setAction-Map
Add scripts correctly in `Field.prototype.setAction` (PR 12569 follow-up)
2026-08-02 21:24:24 +02:00
Jonas Jenwald
1f9fbc764e Add scripts correctly in Field.prototype.setAction (PR 12569 follow-up)
In PR 12569 the `_actions` class-field was changed from an Object into a Map, with *most* of the code updated to reflect that.
However, in the `setAction` method it's still treated as an Object which means that any added script will simply be ignored. Most likely that part of the scripting-implementation isn't being used, since this code has been "wrong" for close to six years now.
2026-08-02 20:31:15 +02:00
calixteman
f7f30dd844
Exclude "&" from the XML entity names
Scanning to the end of the string for every "&" made the entity
resolution quadratic. Stopping at the next "&" also fixes a bare
ampersand swallowing the reference which follows it.
2026-08-02 18:59:19 +02:00
Tim van der Meij
d2ebbd10de
Fix vulnerability in the brace-expansion dependency
This patch is automatically generated with `npm audit fix` and fixes
CVE-2026-14257.
2026-08-02 13:23:04 +02:00
Tim van der Meij
09ad726a3f
Update dependencies to the most recent versions 2026-08-02 13:22:33 +02:00
Tim van der Meij
d0779c411e
Merge pull request #21687 from calixteman/fix/quad-regex-delete-word
Scan backwards to delete a word in a text field
2026-08-02 13:04:00 +02:00
Tim van der Meij
89852881b8
Merge pull request #21685 from calixteman/fix/quad-regex-pdf-filename
Find the PDF filename in a URL hash in two linear steps
2026-08-02 12:57:49 +02:00
Tim van der Meij
eb8f6af8cc
Merge pull request #21684 from calixteman/fix/quad-regex-headers
Trim the response headers with a backward scan
2026-08-02 12:46:03 +02:00
Tim van der Meij
f73978083d
Merge pull request #21680 from calixteman/fix/quad-regex
Fix the regex used to normalize css fonts in XFA
2026-08-02 12:43:14 +02:00
Tim van der Meij
5dc1d0c5d5
Merge pull request #21682 from calixteman/fix/xml-invalid-char-ref
Don't throw on an invalid XML character reference
2026-08-02 12:26:49 +02:00
Tim van der Meij
2475c4ec91
Merge pull request #21678 from Snuffleupagus/ViewHistory-findIndex
Shorten the `ViewHistory` class a little bit
2026-08-02 12:10:21 +02:00
calixteman
08f6769390
Scan backwards to delete a word in a text field
Finding the word to delete with a regex is quadratic in the value
length, so each "delete word backward" keystroke could take a long
time in a large field.
2026-08-01 22:13:27 +02:00
calixteman
7862875438
Find the PDF filename in a URL hash in two linear steps
Searching for a name followed by ".pdf" is quadratic on a hash which
doesn't contain one, so locate the last ".pdf" first and then extend
it to the left.
2026-08-01 21:17:43 +02:00
calixteman
cba911df86
Trim the response headers with a backward scan
Removing the trailing whitespace with a `$`-anchored regex is
quadratic in the length of the run, which a server controls.
The helper lives in network_utils.js, to be unit testable.
2026-08-01 20:56:01 +02:00