Update PDF.js to new version b48717a99e32377831c6098bd833b592756e0335 from 2025-01-31 15:14:02
Categories
(Firefox :: PDF Viewer, enhancement)
Tracking
()
People
(Reporter: update-bot, Assigned: calixte)
References
(Blocks 1 open bug)
Details
(Whiteboard: [3pl-filed][task_id: eaMBd8NHQza_HvaFZsOj3g])
Attachments
(1 file)
This update covers 14 commits. Here are the overall diff statistics, and then the commit information.
toolkit/components/pdfjs/PdfJsDefaultPrefs.js | 1 +
toolkit/components/pdfjs/content/build/pdf.mjs | 706 +-
toolkit/components/pdfjs/content/build/pdf.scripting.mjs | 4 +-
toolkit/components/pdfjs/content/build/pdf.worker.mjs | 5309 +++++----
toolkit/components/pdfjs/content/web/images/toolbarButton-editorSignature.svg | 6 +
toolkit/components/pdfjs/content/web/viewer-geckoview.mjs | 25 +-
toolkit/components/pdfjs/content/web/viewer.css | 20 +-
toolkit/components/pdfjs/content/web/viewer.html | 12 +
toolkit/components/pdfjs/content/web/viewer.mjs | 51 +-
toolkit/components/pdfjs/moz.yaml | 4 +-
10 files changed, 3416 insertions(+), 2722 deletions(-)
20992e87f54795d5ded3eeff4c59a829f04396b7 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/20992e87f54795d5ded3eeff4c59a829f04396b7
Authored: 2025-01-31 13:19:26 +0100
Committed: 2025-01-31 14:59:58 +0100
[Editor] Add some functions in order to extract contours from text and to generate a drawing from a drawn signature
Files Modified:
- src/display/editor/drawers/inkdraw.js
- src/display/editor/drawers/signaturedraw.js
- src/display/editor/signature.js
6f2966628cc6973d14d5158cfdd7a76ccf254f1d by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/6f2966628cc6973d14d5158cfdd7a76ccf254f1d
Authored: 2025-01-31 13:08:04 +0100
Committed: 2025-01-31 13:21:53 +0100
Add width/height getters in the Annotation
class
Currently we're manually computing the width/height of the /Rect-entry in a number of spots throughout the worker-thread Annotation code, which these new getters help avoid.
Files Modified:
- src/core/annotation.js
eca1e6c52ecd91d4407488223d9c65f614c6c770 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/eca1e6c52ecd91d4407488223d9c65f614c6c770
Authored: 2025-01-30 16:13:48 +0100
Committed: 2025-01-30 16:13:48 +0100
Avoid to remove the active overlay when a cancelled dialog (like the file picker) was called from a dialog
Files Modified:
- web/overlay_manager.js
2c737bc420c12cf4ed016f46313b4708f36ba9da by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/2c737bc420c12cf4ed016f46313b4708f36ba9da
Authored: 2025-01-30 15:14:29 +0100
Committed: 2025-01-30 15:35:17 +0100
Move the array containing the supported image mime types in display_utils
and make it available for the viewer (it'll be used in the signature UI).
Files Modified:
- src/display/display_utils.js
- src/display/editor/signature.js
- src/display/editor/stamp.js
- src/pdf.js
- test/unit/pdf_spec.js
- web/pdfjs.js
9e227de3c5a7586e09509ac118dcda28656afb88 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/9e227de3c5a7586e09509ac118dcda28656afb88
Authored: 2025-01-30 13:38:57 +0100
Committed: 2025-01-30 13:38:57 +0100
Use fewer hasFieldFlag
calls in the src/core/annotation.js
file
We lookup a number of field-flags multiple times, which seems unnecessary.
Files Modified:
- src/core/annotation.js
db53320da81499c643783250af059f18e923f3f0 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/db53320da81499c643783250af059f18e923f3f0
Authored: 2025-01-30 11:46:38 +0100
Committed: 2025-01-30 11:52:15 +0100
Initialize the image-options, on the worker-thread, once per document
Currently we're initializing the image-options for every page, which seems unnecessary since it should suffice to do that once per document.
Also, changes the BasePdfManager
constructor to improve readability/documentation a little bit.
Files Modified:
- src/core/evaluator.js
- src/core/pdf_manager.js
2f828c7bf43fc6ab773a688dd66e0c537000d9e8 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/2f828c7bf43fc6ab773a688dd66e0c537000d9e8
Authored: 2025-01-17 18:04:34 +0100
Committed: 2025-01-29 21:52:14 +0100
[Editor] (WIP) Add a new tool in order to add an handwritten signature to a pdf (bug 1942343)
This patch is adding some code in order to extract a drawing as curves from an image.
The algorithm is basically the following:
- reduce the dimensions
- make it gray
- apply a bilateral filter in order to add some blurryness while keeping the edges
- compute the histogram
- guess what's the background color which should contain a large majority of the pixels
- make a binary image
- extract the contours in using the Suzuki algorithm
- apply the Douglas-Peucker algorithm in order to reduce the number of points
The algorithm is improvable but it should work pretty well if there's a clear difference between
the background and the drawing.
In a v2 we could use a ML model in order to improve the extraction.
There's few changes related to the UI in order to make the tool usable, but they're very basic
for the moment.
Files Added:
- src/display/editor/drawers/contour.js
- src/display/editor/drawers/signaturedraw.js
- src/display/editor/signature.js
- web/images/toolbarButton-editorSignature.svg
Files Modified:
- extensions/chromium/preferences_schema.json
- src/display/editor/annotation_editor_layer.js
- src/display/editor/draw.js
- src/display/editor/toolbar.js
- src/shared/util.js
- web/annotation_editor_layer_builder.css
- web/annotation_editor_params.js
- web/app.js
- web/app_options.js
- web/editor_undo_bar.js
- web/toolbar.js
- web/viewer.css
- web/viewer.html
- web/viewer.js
6f2706fad6d5181da087df07423b64ce0192abdd by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/6f2706fad6d5181da087df07423b64ce0192abdd
Authored: 2025-01-29 12:35:09 +0100
Committed: 2025-01-29 12:40:09 +0100
Support the password field-flag in TextWidgetAnnotation (issue 19389)
Files Added:
- test/pdfs/issue19389.pdf
Files Modified:
- src/core/annotation.js
- src/display/annotation_layer.js
- test/pdfs/.gitignore
- test/test_manifest.json
237a17ad56396bedfa070e527ad11393279e9080 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/237a17ad56396bedfa070e527ad11393279e9080
Authored: 2025-01-28 17:13:42 +0100
Committed: 2025-01-29 10:14:23 +0100
Introduce a readInt16
helper function in the src/core/core_utils.js
file
Rather than manually repeating code needed to get an int16, we can move and re-use an existing helper function instead.
Files Modified:
- src/core/cff_parser.js
- src/core/core_utils.js
- src/core/font_renderer.js
6281a8977853b9bbef5a3d0262c3ee4cc0bf2e03 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/6281a8977853b9bbef5a3d0262c3ee4cc0bf2e03
Authored: 2025-01-27 12:54:22 +0100
Committed: 2025-01-27 12:57:47 +0100
Handle empty BigInt64Array/BigUint64Array in the isNumberArray
helper
The current checks would accidentally allow empty BigInt64Array/BigUint64Array, which we can fix by instead checking directly for those types.
This should be fine since those types are available in all environments that we support, see:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array#browser_compatibility
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array#browser_compatibility
Files Modified:
- src/core/core_utils.js
85a6c1ea6b0f0f97d9a71919a1b908b92ec4ca33 by dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
https://github.com/mozilla/pdf.js/commit/85a6c1ea6b0f0f97d9a71919a1b908b92ec4ca33
Authored: 2025-01-26 15:37:40 +0000
Committed: 2025-01-26 15:37:40 +0000
Bump undici from 6.19.8 to 6.21.1
Bumps undici from 6.19.8 to 6.21.1.
updated-dependencies:
- dependency-name: undici
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Files Modified:
- package-lock.json
b02274e5d609e69a787076a103596f560b764b0e by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/b02274e5d609e69a787076a103596f560b764b0e
Authored: 2025-01-25 13:17:25 +0100
Committed: 2025-01-25 13:17:25 +0100
Remove unused isInEditingMode
method (PR 19311 follow-up)
This method was added in PR 19311, however it's not actually used anywhere in the code-base.
Files Modified:
- src/display/editor/tools.js
9241e1be8c0fb74a13bf110e172c64de2b319149 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/9241e1be8c0fb74a13bf110e172c64de2b319149
Authored: 2025-01-22 11:02:16 +0100
Committed: 2025-01-22 12:19:44 +0100
[api-minor] Simplify clean-up of page resources after rendering
After PR 2317, which landed in 2012, we'd immediately clean-up after rendering for pages with large image resources. This had the effect that re-rendering, e.g. after zooming, would force us to re-parse the entire page which could easily lead to bad performance.
In PR 16108, which landed in 2023, we tried to lessen the impact of that by slightly delaying clean-up however that's obviously not a perfect solution (and it increased the complexity of the relevant code).
Furthermore, the condition for this "immediate" clean-up seems a bit arbitrary to me since a page could easily contain a large number of smaller images whose total size vastly exceeds the threshold.
Hence this patch, which suggests that we remove the conditional and delayed clean-up after rendering. Compared to the situation back in 2012, a number of things have improved since:
- We have multiple caches for repeated image-resources on the worker-thread[1], which helps reduce overall memory usage and improves performance.
- We downsize huge images on the worker-thread, which means that the images we're using on the main-thread cannot be arbitrarily large.
- The amount of available RAM on devices should be a lot higher, since more than a decade has passed.
A future improvement here, for more resource constrained environments, could be to instead clean-up when actually needed using e.g. WeakRef
s (see issue 18148).
[1] More specifically:
LocalImageCache
, which caches image-data by /Name and /Ref on thePartialEvaluator.prototype.getOperatorList
level.RegionalImageCache
, which caches image-data by /Ref on thePartialEvaluator
-instance (i.e. at the page) level.GlobalImageCache
, which caches image-data by /Ref globally at the document level.
Files Modified:
- src/core/image_utils.js
- src/display/api.js
- src/shared/util.js
0790d946740a09d2acd2257210990733669ac8d5 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/0790d946740a09d2acd2257210990733669ac8d5
Authored: 2025-01-20 22:10:36 +0100
Committed: 2025-01-20 22:10:36 +0100
Enable the "checks that the viewer re-exports the expected API functionality" unit-test in Node.js
By also running gulp generic-legacy
before the Node.js unit-tests, we can enable one more test-case in Node.js environments.
Files Modified:
- gulpfile.mjs
- test/unit/pdf_spec.js
Reporter | ||
Comment 1•21 days ago
|
||
eaMBd8NHQza_HvaFZsOj3g |
I've submitted a try run for this commit: https://treeherder.mozilla.org/jobs?repo=try&revision=b3ffdfb66b2e5cec60f7054a7e04684878f08731
Reporter | ||
Comment 2•21 days ago
|
||
Updated•21 days ago
|
Reporter | ||
Comment 3•21 days ago
|
||
SNOTKuvTQoKbPA3UpFDjCQ |
The try push is done, we found jobs with unclassified failures.
Needs Close Investigation:
- test-windows10-64-2009-qr/debug-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: e2Cz8grsRNKZQtzfVCjbbg, KMn3QteBQN-HjhfquH7M0A, LXgG0kwlSN2NkjdVHLT5Qw, WuGgA5r2R0KysJTH3Sj1PQ)
- test-windows11-64-24h2/debug-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: TnOAYYCxQ0iuObtBX9vqSw, B_PVFprESteSBZGwV-WhTg, Gdp0nLAzQ0izQJ7VkKW7tw, LrFYUudsQzGg0T4JQKV-og)
- test-linux1804-64-qr/debug-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: aGkYYkmLRz6W9DS1CL5BjA, eXnvv_9jSNaRkXm28RnIug, KYhYwv-BT76yMoNi2DNLxw, WeV2EYAcS9CuWCmQ6bG9og)
- test-macosx1470-64/debug-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: dKaBXSCMQruVcwyGy56a5g, SiNpMwfCSnSfrJfz0nniLQ, VUHoOFeiRKiJJaxaafZ_GA, YiLWxDUSTZuMbCoZACVoRg)
- test-macosx1470-64/opt-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: K2jNDi_FSmef6bgO-ntq-g, ASO2raiWTVmvNC91PwwwZg, blWoQDVwSuGK1_tZJkfVQQ, eoYmZ3USQPyANwMYy0zdlA)
- test-windows11-64-24h2/opt-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: KPZ-eXLARo63u-zLsDaqxw, c4-1WmlnQKG5hbIpLCjZcg, DmyDfd6XSK-zUOaZzIVnHg, Vtu3TymzRXuZYvsM8dzarw)
- test-windows10-64-2009-qr/opt-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: QVc3FBAXSqOceq_GWuwy1w, eo6tDSYiRD63k01FZUMl0w, KLBJ-OftTj-g60uuLWSa-A, TQKpMBqhS5Kqts3uNmgF-A)
- test-linux1804-64-qr/opt-mochitest-plain-ioi - 4 of 4 failed on the same (retriggered) task (failed: G4hsutctQEuTNQtBD211ww, Jp0cQvl-TGimBlsh8C14Xg, P97GdMWRQJagrgTwYy1_7g, TbCfi6YESP2MbJs9gIhN0g)
These failures could mean that the library update changed something and caused
tests to fail. You'll need to review them yourself and decide where to go from here.
In either event, I have done all I can and you will need to take it from here. If you
don't want to land my patch, you can replicate it locally for editing with
./mach vendor toolkit/components/pdfjs/moz.yaml
When reviewing, please note that this is external code, which needs a full and
careful inspection - not a rubberstamp.
Reporter | ||
Updated•19 days ago
|
Comment 5•18 days ago
|
||
bugherder |
Updated•18 days ago
|
Description
•