Update PDF.js to new version 72feb4c25694d1e4dcfe44a3243a5c91605be513 from 2025-04-06 16:32:37
Categories
(Firefox :: PDF Viewer, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox139 | --- | fixed |
People
(Reporter: update-bot, Assigned: calixte)
References
(Blocks 1 open bug)
Details
(Whiteboard: [3pl-filed][task_id: Ny2aOgF3Rbq4VrfXA5QlWQ])
Attachments
(1 file)
This update covers 28 commits. Here are the overall diff statistics, and then the commit information.
toolkit/components/pdfjs/content/build/pdf.mjs | 534 +-
toolkit/components/pdfjs/content/build/pdf.scripting.mjs | 8 +-
toolkit/components/pdfjs/content/build/pdf.worker.mjs | 4501 ++++++------
toolkit/components/pdfjs/content/web/viewer-geckoview.mjs | 6 +-
toolkit/components/pdfjs/content/web/viewer.mjs | 6 +-
toolkit/components/pdfjs/moz.yaml | 4 +-
6 files changed, 2650 insertions(+), 2409 deletions(-)
18617eb7923d34763e8cedf5d93c78044383ce98 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/18617eb7923d34763e8cedf5d93c78044383ce98
Authored: 2025-04-06 14:32:36 +0200
Committed: 2025-04-06 14:32:36 +0200
Tweak the Node.js version listed in "engines", to ensure that process.getBuiltinModule
is available
In order to use the PDF.js library in Node.js environments the process.getBuiltinModule
functionality must be available, which was released in version 20.16.0
, however we've seen repeated issues filed by users on older 20.x
versions.
Files Modified:
- gulpfile.mjs
- package-lock.json
- package.json
ec5b5184d3d3839cd63d9b91fa700d2e2cd4aaea by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/ec5b5184d3d3839cd63d9b91fa700d2e2cd4aaea
Authored: 2025-04-06 12:12:37 +0200
Committed: 2025-04-06 12:12:37 +0200
Remove Array.prototype.reduce
usage from the unit-tests
Using Array.prototype.reduce
often leads to less readable code, and in these cases we can replace it with other Array-methods instead.
Files Modified:
- test/unit/ui_utils_spec.js
0845552ff983dc33225cd8a718f918f3e9ecf36e by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/0845552ff983dc33225cd8a718f918f3e9ecf36e
Authored: 2025-04-06 11:44:08 +0200
Committed: 2025-04-06 11:44:08 +0200
Use Array-destructuring when computing MIN/MAX in AFSimple_Calculate
This appears to work fine with QuickJS, as evident by the added unit-test, and allows us to remove more Array.prototype.reduce
usage.
Files Modified:
- src/scripting_api/aform.js
- test/unit/scripting_spec.js
4c63905a183b3043c14e6546309e246eac4d185b by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/4c63905a183b3043c14e6546309e246eac4d185b
Authored: 2025-04-05 18:27:31 +0200
Committed: 2025-04-05 20:45:26 +0200
Avoid to create an array when setting the text matrix
Files Modified:
- src/core/evaluator.js
- src/core/operator_list.js
- src/display/canvas.js
010b6ad886aa264e6c8bd94ce5b902373ebee71b by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/010b6ad886aa264e6c8bd94ce5b902373ebee71b
Authored: 2025-04-05 15:03:06 +0200
Committed: 2025-04-05 15:03:06 +0200
Change how (most) fields are initialized in the CanvasExtraState
class
The majority of the class fields don't depend on any parameters, hence we can re-factor and shorten by this using modern JavaScript features.
Files Modified:
- src/display/canvas.js
624d8a418e239fab0c5f0633568b77bc7bd7fdef by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/624d8a418e239fab0c5f0633568b77bc7bd7fdef
Authored: 2025-04-05 14:59:04 +0200
Committed: 2025-04-05 14:59:04 +0200
Remove "unnecessary" inline function names in the src/display/canvas.js
file
This is ever so slightly shorter, which cannot hurt.
Files Modified:
- src/display/canvas.js
e7a951547da57f8244aa3e3b2488ecf308be1302 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/e7a951547da57f8244aa3e3b2488ecf308be1302
Authored: 2025-04-03 21:01:55 +0200
Committed: 2025-04-04 19:57:55 +0200
Replace UpdateRectMinMax by getAxialAlignedBoundingBox
and don't use array destructuring because it induces a memory and perf penalties.
Files Modified:
- src/core/annotation.js
- src/display/canvas.js
- src/display/pattern_helper.js
- src/shared/util.js
dad6febc393042f1612058384504844447e2f8fd by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/dad6febc393042f1612058384504844447e2f8fd
Authored: 2025-04-04 13:36:13 +0200
Committed: 2025-04-04 13:36:13 +0200
Pass the /Info-strings as a Map
to the src/core/writer.js
code
We want to iterate through the data in the computeMD5
function, and Map
s have "nicer" support for that than generic objects.
(Somewhat recently Map
performance was improved in Firefox, however this also isn't really performance sensitive code.)
Files Modified:
- src/core/worker.js
- src/core/writer.js
- test/unit/writer_spec.js
20e06c4bb538ea16c52a3667e397f051157db256 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/20e06c4bb538ea16c52a3667e397f051157db256
Authored: 2025-04-04 11:33:43 +0200
Committed: 2025-04-04 11:45:54 +0200
Attempt to get bundlers to leave Emscripten Compiler generated URL
s alone (issue 19761)
Note that we load all wasm-files manually, however the Emscripten Compiler (emcc) unfortunately generates URL
s for fallback wasm-file loading.
In the PDF.js build-scripts we work-around that by using suitable Webpack-options, however that apparently doesn't work when third-party users re-bundle our code and we thus try to work-around this by adding "ignore comments" to these URL
s (similar to how we handle import
-statements).
Files Added:
- external/builder/fixtures_babel/ignore-expected.js
- external/builder/fixtures_babel/ignore.js
Files Modified:
- external/builder/babel-plugin-pdfjs-preprocessor.mjs
bd418de6b01a2fef944282c81440451250498c7c by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/bd418de6b01a2fef944282c81440451250498c7c
Authored: 2025-04-04 08:54:06 +0200
Committed: 2025-04-04 08:54:06 +0200
Bump library version to 5.2
Files Modified:
- pdfjs.config
8c5fb7979f6340394e02d0998bcfff6681483725 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/8c5fb7979f6340394e02d0998bcfff6681483725
Authored: 2025-04-03 17:53:27 +0200
Committed: 2025-04-03 18:50:39 +0200
Also transfer ImageBitmap
s for image masks and inline images
Currently we're only transferring TypedArrays, however there's no reason (as far as I can tell) to not also transfer ImageBitmap
s in these cases.
Files Modified:
- src/core/operator_list.js
41bed561f09be9147c542d3ef2fa90a513705672 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/41bed561f09be9147c542d3ef2fa90a513705672
Authored: 2025-04-01 22:16:27 +0200
Committed: 2025-04-03 17:06:58 +0200
Simplify updateRectMinMax in order to use slightly less memory
Files Modified:
- src/core/evaluator.js
- src/core/operator_list.js
- src/display/canvas.js
4a6c47489e02fccf21624c470656e682ec46d18c by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/4a6c47489e02fccf21624c470656e682ec46d18c
Authored: 2025-04-03 14:00:07 +0200
Committed: 2025-04-03 14:00:07 +0200
Initialize the isOffscreenCanvasSupported
option, in the OperatorList
class, once per document
Currently we're setting this option for each small inline image, which seems unnecessary since it should suffice to do that once per document.
Files Modified:
- src/core/evaluator.js
- src/core/operator_list.js
- src/core/pdf_manager.js
0c78b46184372665d72ed73242a90598d29643d8 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/0c78b46184372665d72ed73242a90598d29643d8
Authored: 2025-04-03 12:20:24 +0200
Committed: 2025-04-03 12:30:29 +0200
Use ctx.filter
unconditionally in the src/display/canvas.js
file
It seems that the @napi-rs/canvas
dependency has basic canvas-filter support, whereas the "old" canvas
dependency didn't, hence we no longer need the Node.js-specific checks in the src/display/canvas.js
file.
Note that I've successfully tested the pdf2png
example with this patch applied and things appear to work as before.
Files Modified:
- src/display/canvas.js
4262603b0683aff5174c0ccd9ab8035d6c1f6d00 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/4262603b0683aff5174c0ccd9ab8035d6c1f6d00
Authored: 2025-04-01 23:03:50 +0200
Committed: 2025-04-01 23:03:50 +0200
Re-name the Util.applyTransformToBezierInPlace
method
Given that all Util.apply...
methods are now using in/out parameters, we can slightly shorten the name of this one.
Files Modified:
- src/core/operator_list.js
- src/shared/util.js
c852e877d8c5ac2bcff6d5b900cc2d0458643321 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/c852e877d8c5ac2bcff6d5b900cc2d0458643321
Authored: 2025-04-01 23:03:44 +0200
Committed: 2025-04-01 23:03:44 +0200
Change Util.applyInverseTransform
to use the point-argument as an in/out parameter
This will help reduce the total number of Array allocations, which cannot hurt.
Files Modified:
- src/display/display_utils.js
- src/shared/util.js
fa643bb22fff6bb489602da461221e0cc04cc2c3 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/fa643bb22fff6bb489602da461221e0cc04cc2c3
Authored: 2025-04-01 23:03:36 +0200
Committed: 2025-04-01 23:03:36 +0200
Change Util.applyTransform
to use the point-argument as an in/out parameter
This will help reduce the total number of Array allocations, which cannot hurt, and also allows us to remove the Util.applyTransformInPlace
method.
Files Modified:
- src/core/annotation.js
- src/core/operator_list.js
- src/display/canvas.js
- src/display/display_utils.js
- src/shared/util.js
a35443ff45c80728de0e7e9d92b03614ca265005 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/a35443ff45c80728de0e7e9d92b03614ca265005
Authored: 2025-03-28 15:48:11 +0100
Committed: 2025-04-01 16:02:38 +0200
Remove few useless beginPaths.
The ctx current path is no more changed since we use some Path2D when we want to fill/stroke them.
It makes calling ctx.beginPath useless.
Files Modified:
- src/display/canvas.js
9cd5a9658ab00b8a65cfa2dca742ef0a87c12452 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/9cd5a9658ab00b8a65cfa2dca742ef0a87c12452
Authored: 2025-03-29 12:06:12 +0100
Committed: 2025-04-01 09:09:00 +0200
[api-minor] Move Type3-glyph compilation to the worker-thread
After PR 19731 the format of compiled Type3-glyphs is now simple enough that the compilation can be moved to the worker-thread, without introducing any significant additional complexity.
This allows us to, ever so slightly, simplify the implementation in src/display/canvas.js
since the Type3 operatorLists will now directly include standard path-rendering operators (using the format introduced in PR 19689).
As part of these changes we also stop caching Type3 image masks since: we've not come across any cases where that actually helps, they're usually fairly small, and it simplifies the code.
Note that one "negative" change introduced in this patch is that we'll now compile Type3-glyphs eagerly, whereas previously we'd only do that lazily upon their first use.
However, this doesn't seem to impact performance in any noticeable way since the compilation is fast enough (way below 1 ms/glyph in my testing) and Type3-fonts are also limited to just 256 glyphs. Also, many (or most?) Type3-fonts don't even use image masks and are thus not affected by these changes.
Files Modified:
- src/core/evaluator.js
- src/core/fonts_utils.js
- src/core/operator_list.js
- src/display/canvas.js
- src/shared/util.js
213830f44f35ee517f5bbd36d8829d2f6be67e90 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/213830f44f35ee517f5bbd36d8829d2f6be67e90
Authored: 2025-03-31 10:49:47 +0200
Committed: 2025-03-31 10:57:04 +0200
Use, and re-name, the addLocallyCachedImageOps
helper for global images too
This avoids having to "manually" set the image operators for globally cached images.
Files Modified:
- src/core/evaluator.js
e0e59eaf010140495d1f3e2251b472adb101e30c by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/e0e59eaf010140495d1f3e2251b472adb101e30c
Authored: 2025-03-31 10:29:29 +0200
Committed: 2025-03-31 10:29:29 +0200
Define the global cache-data once in buildPaintImageXObject
Currently we duplicate the same identical code three times, which seems both unnecessary and error prone.
Files Modified:
- src/core/evaluator.js
6e9fbd942034b577a630984ebb1e34b9ae517426 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/6e9fbd942034b577a630984ebb1e34b9ae517426
Authored: 2025-03-25 17:12:47 +0100
Committed: 2025-03-31 10:28:01 +0200
Simplify singularValueDecompose2dScale in order to make it using less memory
In using the Firefox profiler (with JS allocations tracking) and wuppertal.pdf, I noticed
we were using a bit too much memory for a function which is supposed to just compute 2 numbers.
The memory used by itself isn't so important but having a too much objects lead to waste some time
to gc them.
So this patch aims to simplify it a bit.
Files Modified:
- src/display/canvas.js
- src/display/pattern_helper.js
- src/shared/util.js
ed08a6a9886fc6c337915f0f7e589de58df09736 by Tim van der Meij <timvandermeij@gmail.com>
https://github.com/mozilla/pdf.js/commit/ed08a6a9886fc6c337915f0f7e589de58df09736
Authored: 2025-03-30 18:40:21 +0200
Committed: 2025-03-30 18:52:19 +0200
Isolate the "basic operations" freetext editor integration tests
This commit reduces the number of freetext editor integration test suite
failures, in full isolation, from 5 to 0 by fixing the following issues
in the "basic operations" block:
- Most tests relied on the first test to enable freetext editing mode.
For isolation we now do it explicitly in all tests. - Most tests relied on the other tests having created editors. For
isolation we now create the editors explicitly in the tests themselves. - Most tests relied on previous tests for the editor numbering. For
isolation we change the editor numbering to the one after initial
document load. Since we can't have state (editors) from a previous
test anymore we can remove variousclearAll
calls as well.
Files Modified:
- test/integration/freetext_editor_spec.mjs
040e9c7be4f480589cdf90d3f7468ad7c2212667 by Tim van der Meij <timvandermeij@gmail.com>
https://github.com/mozilla/pdf.js/commit/040e9c7be4f480589cdf90d3f7468ad7c2212667
Authored: 2025-03-30 15:46:00 +0200
Committed: 2025-03-30 15:46:00 +0200
Update translations to the most recent versions
Files Modified:
- l10n/ar/viewer.ftl
- l10n/be/viewer.ftl
- l10n/cs/viewer.ftl
- l10n/cy/viewer.ftl
- l10n/da/viewer.ftl
- l10n/de/viewer.ftl
- l10n/dsb/viewer.ftl
- l10n/el/viewer.ftl
- l10n/en-CA/viewer.ftl
- l10n/en-GB/viewer.ftl
- l10n/eo/viewer.ftl
- l10n/es-AR/viewer.ftl
- l10n/es-CL/viewer.ftl
- l10n/es-ES/viewer.ftl
- l10n/es-MX/viewer.ftl
- l10n/eu/viewer.ftl
- l10n/fi/viewer.ftl
- l10n/fr/viewer.ftl
- l10n/fur/viewer.ftl
- l10n/fy-NL/viewer.ftl
- l10n/gn/viewer.ftl
- l10n/he/viewer.ftl
- l10n/hr/viewer.ftl
- l10n/hsb/viewer.ftl
- l10n/hu/viewer.ftl
- l10n/ia/viewer.ftl
- l10n/id/viewer.ftl
- l10n/is/viewer.ftl
- l10n/it/viewer.ftl
- l10n/ka/viewer.ftl
- l10n/kk/viewer.ftl
- l10n/ko/viewer.ftl
- l10n/ml/viewer.ftl
- l10n/nb-NO/viewer.ftl
- l10n/nl/viewer.ftl
- l10n/nn-NO/viewer.ftl
- l10n/pa-IN/viewer.ftl
- l10n/pl/viewer.ftl
- l10n/pt-BR/viewer.ftl
- l10n/pt-PT/viewer.ftl
- l10n/rm/viewer.ftl
- l10n/ru/viewer.ftl
- l10n/sk/viewer.ftl
- l10n/skr/viewer.ftl
- l10n/sl/viewer.ftl
- l10n/sq/viewer.ftl
- l10n/sv-SE/viewer.ftl
- l10n/tg/viewer.ftl
- l10n/th/viewer.ftl
- l10n/tr/viewer.ftl
- l10n/uk/viewer.ftl
- l10n/vi/viewer.ftl
- l10n/zh-CN/viewer.ftl
- l10n/zh-TW/viewer.ftl
bb8fb74b722af7910f0652a1af2ef6abaae918df by Tim van der Meij <timvandermeij@gmail.com>
https://github.com/mozilla/pdf.js/commit/bb8fb74b722af7910f0652a1af2ef6abaae918df
Authored: 2025-03-30 15:44:51 +0200
Committed: 2025-03-30 15:44:51 +0200
Upgrade eslint-plugin-unicorn
to version 58.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v58.0.0
doesn't indicate any breaking changes that should impact us.
Files Modified:
- package-lock.json
- package.json
a6db2d9f47abbaae14b8ae7fe301a8be199b7859 by Tim van der Meij <timvandermeij@gmail.com>
https://github.com/mozilla/pdf.js/commit/a6db2d9f47abbaae14b8ae7fe301a8be199b7859
Authored: 2025-03-30 15:42:59 +0200
Committed: 2025-03-30 15:43:55 +0200
Update dependencies to the most recent versions
Files Modified:
- package-lock.json
- package.json
7a1ff7f36c56cc6901bacd73c844b98c549e03fc by Tim van der Meij <timvandermeij@gmail.com>
https://github.com/mozilla/pdf.js/commit/7a1ff7f36c56cc6901bacd73c844b98c549e03fc
Authored: 2025-03-30 15:30:08 +0200
Committed: 2025-03-30 15:30:08 +0200
Bump the stable version in pdfjs.config
Files Modified:
- pdfjs.config
6146e5fee7b54bdb88987db835c81000bac79078 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/6146e5fee7b54bdb88987db835c81000bac79078
Authored: 2025-03-23 16:09:21 +0100
Committed: 2025-03-25 15:31:45 +0100
Optimize save-transform-constructPath-restore
The 4 operations can be replaced with just one in applying the transform to the points coordinates.
Files Modified:
- src/core/operator_list.js
- src/shared/util.js
Reporter | ||
Comment 1•20 days ago
|
||
Ny2aOgF3Rbq4VrfXA5QlWQ |
I've submitted a try run for this commit: https://treeherder.mozilla.org/jobs?repo=try&revision=2c37a4b0812e73869abdcd3d006e544acdc3cc9f
Reporter | ||
Comment 2•20 days ago
|
||
Reporter | ||
Comment 3•20 days ago
|
||
ROpUYrP0RR2PAG-vUNrbLA |
All the jobs in the try run succeeded. Like literally all of them, there weren't
even any intermittents. That is pretty surprising to me, so maybe you should double
check to make sure I didn't misinterpret things and that the correct tests ran...
Anyway, I've done all I can, so I'm passing to you to review and land the patch.
When reviewing, please note that this is external code, which needs a full and
careful inspection - not a rubberstamp.
Comment 5•18 days ago
|
||
bugherder |
Description
•