21087 Commits

Author SHA1 Message Date
Nicolò Ribaudo
0596f03d4e
Show the op dispatched by constructPath in the debugger
The `constructPath` op receives as arguments not only the
information to construct the path, but also the op to apply
the path to (such as "fill", or "stroke").

This commit updates the Stepper tool in the debugger to decode
that op, showing its name rather than just its numeric ID.
2025-05-19 19:33:14 +02:00
calixteman
fc68a9f3ee
Merge pull request #19958 from calixteman/rm_useless_subarray_flate_stream
Don't create a useless subarray when getting image data from a flate stream
2025-05-19 19:29:25 +02:00
Jonas Jenwald
e921533577
Merge pull request #19960 from Snuffleupagus/version-5.3
Bump library version to `5.3`
2025-05-19 18:00:47 +02:00
Jonas Jenwald
6c803e89e6 Bump library version to 5.3 2025-05-19 17:57:28 +02:00
calixteman
f148106cb1
Merge pull request #19957 from calixteman/rm_qcms_subarray
Remove all the useless subarrays when using qcms.
2025-05-19 17:33:52 +02:00
calixteman
72faeeab93
Merge pull request #19959 from calixteman/undefined_worker_port
Fix pdfjsPreloadedWorker when it's undefined
2025-05-19 17:29:18 +02:00
Jonas Jenwald
36b40d959b
Merge pull request #19955 from Snuffleupagus/issue-19954
Support Type3 fonts with an incomplete /FontDescriptor dictionary (issue 19954)
2025-05-19 17:26:46 +02:00
Calixte Denizet
69231e2dbd Fix pdfjsPreloadedWorker when it's undefined 2025-05-19 17:05:37 +02:00
Calixte Denizet
3ecbef516d Don't create a useless subarray when getting image data from a flate stream 2025-05-19 16:48:23 +02:00
Calixte Denizet
782e883a87 Remove all the useless subarrays when using qcms.
It reduces the memory use and the newly added function `getRgbHex` is 4 times faster.
2025-05-19 16:07:57 +02:00
calixteman
2b9f621087
Merge pull request #19953 from calixteman/rm_useless_arrays
[api-minor] Create the css color to use with the canvas in the worker
2025-05-19 16:02:08 +02:00
Jonas Jenwald
c02ea0c681 Simplify how we handle Type3 fonts without a /FontDescriptor dictionary
Part of this is very old code, which we can now simplify a little bit.
2025-05-19 15:26:11 +02:00
Jonas Jenwald
97a42486f5 Improve how the PDF.js version/commit information is exposed in the *built* files
To make it easier to tell which PDF.js version/commit that the *built* files correspond to, they have (since many years) included `pdfjsVersion` and `pdfjsBuild` constants with that information.

As currently implemented this has a few shortcomings:
 - It requires manually adding the code, with its preprocessor statements, in all relevant files.

 - It requires ESLint disable statements, since it's obviously unused code.

 - Being unused, this code is removed in the minified builds.

 - This information would be more appropriate as comments, however Babel discards all comments during building.

 - It would be helpful to have this information at the top of the *built* files, however it's being moved during building.

To address all of these issues, we'll instead utilize Webpack to insert the version/commit information as a comment placed just after the license header.
2025-05-19 15:01:05 +02:00
Calixte Denizet
5789afd3f8 Create the css color to use with the canvas in the worker
It slightly reduces the time spent to draw and the memory used.
2025-05-19 14:52:24 +02:00
Jonas Jenwald
5f5d9dfc28 Support Type3 fonts with an incomplete /FontDescriptor dictionary (issue 19954)
We have a fallback for the common case of Type3 fonts without a /FontDescriptor dictionary, however we also need to handle the case where it's present but lacking the required /FontName entry.
2025-05-19 12:56:14 +02:00
Tim van der Meij
60574fb7e3
Merge pull request #19950 from timvandermeij/intermittent-all-await
Fix missing `await` for asynchronous method calls in the integration tests
2025-05-18 19:12:48 +02:00
Tim van der Meij
393e799e49
Fix missing await for asynchronous method calls in the integration tests
The `Page.evaluate()` and `Mouse.click()` APIs in Puppeteer both return
a promise; see https://pptr.dev/api/puppeteer.page.evaluate and
https://pptr.dev/api/puppeteer.mouse.click, and should therefore be
awaited before proceeding in tests to make sure that the test's behavior
is deterministic and avoid intermittent failures.

The following command was used to find potential places to fix:
`grep -nEr "[^await|return] page\." test/integration/*`
2025-05-18 18:19:46 +02:00
Tim van der Meij
819671d42f
Merge pull request #19949 from timvandermeij/intermittent-stamp-undo
Fix intermittent failure in the stamp editor's undo-related integration tests
2025-05-18 15:17:41 +02:00
Tim van der Meij
6355dd7ded
Fix intermittent failure in the stamp editor's undo-related integration tests
The clipboard, used via the `copyImage` helper function, is a shared
resource, so access to it cannot happen concurrently because it could
result in tests overwriting each other's contents. Most tests using
the clipboard are therefore run sequentially, but only the stamp
editor's undo-related tests weren't, so this commit fixes the issue
by running those tests sequentially too.
2025-05-18 14:36:19 +02:00
Tim van der Meij
f6e4b1cf4a
Merge pull request #19945 from Snuffleupagus/NetworkStream-rm-Node-Error
Remove Node.js-specific checks when using the Fetch API
2025-05-18 12:05:13 +02:00
Tim van der Meij
30bba5f165
Merge pull request #19944 from Snuffleupagus/PDFDataRangeTransport-private-fields
Use private fields in the `PDFDataRangeTransport` class
2025-05-18 12:01:03 +02:00
Jonas Jenwald
a882195e9b Remove Node.js-specific checks when using the Fetch API
Given that Node.js has full support for the Fetch API since version 21, see the "History" data at https://nodejs.org/api/globals.html#fetch, it seems unnecessary for us to manually check for various globals before using it.

Since our primary development target is browsers in general, and Firefox in particular, being able to remove Node.js-specific compatibility code is always helpful.

Note that we still, for now, support Node.js version 20 and if the relevant globals are not available then Errors will instead be thrown from within the `PDFFetchStream` class.
2025-05-18 10:49:02 +02:00
Jonas Jenwald
99b23ea1f6 Use private fields in the PDFDataRangeTransport class 2025-05-18 10:16:46 +02:00
Jonas Jenwald
f72f240699
Merge pull request #19939 from Snuffleupagus/disableWorker-clear-workerPort
Ensure that the viewer clears the `workerPort` option when using "fake" workers
2025-05-18 08:38:48 +02:00
Tim van der Meij
23f269b353
Merge pull request #19942 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-05-17 20:41:48 +02:00
Tim van der Meij
91679ece4b
Merge pull request #19943 from Snuffleupagus/PDFWorker-create
Replace `PDFWorker.fromPort` with a generic `PDFWorker.create` method
2025-05-17 19:12:38 +02:00
Jonas Jenwald
fc697b3602 Utilize private fields and methods more in the PDFWorker class
This replaces, wherever possible, the old semi-private fields and methods with actually private ones.
2025-05-17 18:05:49 +02:00
Jonas Jenwald
ab672f0b77 Replace PDFWorker.fromPort with a generic PDFWorker.create method
This allows us to simply invoke `PDFWorker.create` unconditionally from the `getDocument` function, without having to manually check if a global `workerPort` is available first.
2025-05-17 16:13:41 +02:00
Tim van der Meij
1e4ba0b8bf
Update translations to the most recent versions 2025-05-17 15:58:38 +02:00
Tim van der Meij
d297e44f3f
Update dependencies to the most recent versions 2025-05-17 15:50:54 +02:00
Tim van der Meij
278fc064eb
Merge pull request #19917 from Snuffleupagus/unicorn-59-rule-updates
Add a couple of new `eslint-plugin-unicorn` rules
2025-05-17 13:55:52 +02:00
Jonas Jenwald
b81b9ce00d Add a couple of new eslint-plugin-unicorn rules
The recent `eslint-plugin-unicorn` update added, and replaced, a few rules that seem useful for us; please refer to https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v59.0.0

Note that none of the following rules required any code-changes:
 - Replace `no-array-push-push` with `prefer-single-call`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-call.md

 - Add `no-unnecessary-slice-end`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-slice-end.md

 - Add `no-unnecessary-array-flat-depth`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md

 - Add `no-unnecessary-array-splice-count`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md
2025-05-17 13:49:11 +02:00
Tim van der Meij
b05351ceae
Merge pull request #19937 from studystill/master
chore: remove redundant word in comment
2025-05-17 13:34:39 +02:00
Tim van der Meij
57cbaae8e4
Merge pull request #19916 from Snuffleupagus/prefer-import-meta-properties
Enable the `unicorn/prefer-import-meta-properties` ESLint plugin rule
2025-05-17 13:33:48 +02:00
Jonas Jenwald
eef1e3e87f Ensure that the viewer clears the workerPort option when using "fake" workers
Without this "fake" workers may be ignored in the API, which isn't really what you want when manually providing the `disableWorker=true` hash parameter. (Note that this requires the `pdfBugEnabled` option/preference to be set as well.)

Also, after the changes in PR 19810 we can just load the "fake" worker directly in development mode and don't need to manually assign it to the global scope.
2025-05-17 11:41:33 +02:00
studystill
b585937340 chore: remove redundant word in comment
Signed-off-by: studystill <chenghuiyue@outlook.com>
2025-05-16 15:16:26 +08:00
Jonas Jenwald
13c9995455 Enable the unicorn/prefer-import-meta-properties ESLint plugin rule
Given that we require Node.js versions `>=20.16.0 || >=22.3.0` using this should be fine, based on the "History" data in https://nodejs.org/api/esm.html#importmetadirname respectively https://nodejs.org/api/esm.html#importmetafilename.

Please also see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-import-meta-properties.md
2025-05-16 07:47:08 +02:00
Jonas Jenwald
d97b65378f
Merge pull request #19933 from mozilla/dependabot/npm_and_yarn/undici-6.21.3
Bump undici from 6.21.1 to 6.21.3
2025-05-15 23:28:00 +02:00
calixteman
f4a3e47018
Merge pull request #19935 from calixteman/bug1966721
Use the worker created in the child actor (bug 1966721)
2025-05-15 21:21:06 +02:00
Calixte Denizet
f01b13d332 Use the worker created in the child actor (bug 1966721) 2025-05-15 21:17:44 +02:00
Jonas Jenwald
b3ccc55c1d
Merge pull request #19936 from Snuffleupagus/workerPort-firefox
Allow using the `workerPort` option in Firefox
2025-05-15 21:09:08 +02:00
calixteman
be463f0e0c
Merge pull request #19934 from calixteman/minify
Minify the js code when building for Firefox (bug 1965003)
2025-05-15 20:11:11 +02:00
Jonas Jenwald
e5e9d18289 Allow using the workerPort option in Firefox 2025-05-15 19:30:43 +02:00
Calixte Denizet
8129ccc9a7 Minify the js code when building for Firefox (bug 1965003)
It helps to improve the loading time in the worker by around 25% on Windows, Mac and Android.
2025-05-15 19:01:52 +02:00
dependabot[bot]
64c1e07f22
Bump undici from 6.21.1 to 6.21.3
Bumps [undici](https://github.com/nodejs/undici) from 6.21.1 to 6.21.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.21.1...v6.21.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-15 15:23:50 +00:00
Jonas Jenwald
b070a502c3
Merge pull request #19929 from Snuffleupagus/bug-1966086
Prefer the /Metadata, when available, in the document properties dialog (bug 1966086)
2025-05-15 15:54:42 +02:00
Jonas Jenwald
ab89773e49 Prefer the /Metadata, when available, in the document properties dialog (bug 1966086) 2025-05-15 15:12:09 +02:00
Jonas Jenwald
d4d0081ac9
Merge pull request #19923 from nicolo-ribaudo/fix-new-url
Remove unused OpenJPEG wasm fallback logic
2025-05-14 08:11:37 +02:00
Marco Castelluccio
2ed959d75a
Merge pull request #19897 from Snuffleupagus/ci-Node-24
Run CI tests in Node.js version 24
2025-05-14 00:09:06 +02:00
calixteman
a4b5b7c4bb
Merge pull request #19925 from calixteman/bug1962819
[Editor] Keep aspect ratio when rescaling an image before being processed for a signature (bug 1962819)
2025-05-13 20:07:11 +02:00