Update PDF.js to new version bb1539a2c9b5b76d070284cca9091717133d8bf1 from 2026-11-15 19:48:28 UTC
Categories
(Firefox :: PDF Viewer, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: update-bot, Assigned: calixte)
References
(Blocks 1 open bug)
Details
(Whiteboard: [3pl-filed][task_id: O1WtmpAISLKqjfyRPHCr2g])
Attachments
(1 external file)
This update covers 22 commits, including 1 new upstream commit I've never filed a bug on before. (It's the top one.). Here are the overall diff statistics, and then the commit information.
toolkit/components/pdfjs/content/PdfJsVersion.sys.mjs | 2 +-
toolkit/components/pdfjs/content/build/pdf.mjs | 347 +-
toolkit/components/pdfjs/content/build/pdf.renderer.mjs | 49 +-
toolkit/components/pdfjs/content/build/pdf.sandbox.external.sys.mjs | 39 +-
toolkit/components/pdfjs/content/build/pdf.scripting.mjs | 8 +-
toolkit/components/pdfjs/content/build/pdf.worker.mjs | 7599 +++++----
toolkit/components/pdfjs/content/web/cmaps/Adobe-GB1-4.bcmap.br | 4 +-
toolkit/components/pdfjs/content/web/cmaps/CNS2-H.bcmap.br | 2 +-
toolkit/components/pdfjs/content/web/cmaps/H.bcmap.br | 4 +-
toolkit/components/pdfjs/content/web/standard_fonts/unicode.bin | Bin
toolkit/components/pdfjs/content/web/viewer-geckoview.mjs | 239 +-
toolkit/components/pdfjs/content/web/viewer.mjs | 245 +-
toolkit/components/pdfjs/content/web/wasm/hellbox_bg.wasm | Bin
toolkit/components/pdfjs/content/web/wasm/hellbox_nowasm_fallback.js.br | Bin
toolkit/components/pdfjs/moz.yaml | 4 +-
15 files changed, 5140 insertions(+), 3402 deletions(-)
Commits by author:
12 Calixte Denizet <calixte.denizet@gmail.com> (all unsigned)
4 Jonas Jenwald <jonas.jenwald@gmail.com> (all unsigned)
4 calixteman <calixte.denizet@gmail.com> (1 signed but unverified, 3 unsigned)
2 Tim van der Meij <info@timvandermeij.nl> (all signed but unverified)
ae629c08bf4e34513d6baebad52b3472c1569d1a by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/ae629c08bf4e34513d6baebad52b3472c1569d1a
Authored: 2026-11-15 17:26:59 +0100
Committed: 2026-11-15 17:29:07 +0100
Update Hellbox
The Unicode tables are coded with the range coder of Hellbox: unicode.bin is 2,639 bytes instead of 14,262, the Wasm module 131,848 bytes instead of 132,729, and the JS fallback 60,131 bytes with Brotli instead of 59,029.
Files Modified:
- external/hellbox/hellbox_bg.wasm
- external/hellbox/hellbox_nowasm_fallback.js
- external/hellbox/unicode.bin
0322a85c191cc84f65f8388230cb84e3453ea2fb by calixteman <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/0322a85c191cc84f65f8388230cb84e3453ea2fb
Authored: 2026-10-01 16:28:50 +0200
Committed: 2026-11-15 16:41:03 +0100
Support flattening in Firefox save events (bug 2075337)
Forward flatten and intent through saving and extraction, including
unedited PDFs. Run WillPrint/DidPrint for print flattening.
Files Modified:
- test/integration/scripting_spec.mjs
- web/app.js
- web/firefoxcom.js
bef7c2f025d49c4a382b596f6e25d1b4be55eada by calixteman <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/bef7c2f025d49c4a382b596f6e25d1b4be55eada
Authored: 2026-10-01 16:28:50 +0200
Committed: 2026-11-15 15:55:49 +0100
[api-minor] Support annotation flattening in extractPages (bug 2075337)
Reuse the save path to flatten extracted pages. Remap pending form edits
to copied annotations and reload with the encryption source's password.
Rebuild the PDF to discard the unflattened revision.
Files Modified:
- src/core/editor/pdf_editor.js
- src/core/worker.js
- src/display/api.js
- test/unit/api_flattening_spec.js
cf8aa3c83557fc979286d69f5db378cfe53025ec by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/cf8aa3c83557fc979286d69f5db378cfe53025ec
Authored: 2026-11-09 20:28:37 +0100
Committed: 2026-11-15 15:05:22 +0100
Require a user gesture to print, save, download or follow a link
A script can trigger some events on its own, e.g. a timer, or focus an
element under the pointer or the keyboard, hence the viewer has to decide
by itself whether an action comes from the user.
The events caused by a trusted user gesture (Action, Mouse Down and Mouse
Up) and the Open event, which may only print, get a one-time token. The
host keeps it out of the sandbox and attaches it to the commands sent
while the event is handled. The annotation actions which print, save,
download or follow a link are checked the same way, and only one of them
is honored per gesture. A gesture is ignored when the keyboard activates
an element focused by a script, or when it follows a layout change made
by a script too closely.
Files Modified:
- src/display/annotation_layer.js
- src/pdf.sandbox.external.js
- test/integration/scripting_commands_spec.mjs
- test/unit/scripting_spec.js
- web/generic_scripting.js
- web/pdf_scripting_manager.js
290290c247d700e2b16796ae808837b19894719f by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/290290c247d700e2b16796ae808837b19894719f
Authored: 2026-11-09 20:28:29 +0100
Committed: 2026-11-15 15:01:19 +0100
Only show a dialog from the sandbox while handling an event allowed by the viewer
Nothing coming from the sandbox can be trusted: it grants itself a user
activation for any event, and a script can trigger some events on its own
(e.g. a timer calling setFocus).
Hence the host only shows a dialog, once, while handling an event for
which the viewer allows it: the ones caused by the user, Open, and the
print/save ones. A focus change requested by a script no longer counts
as a user activation.
Files Added:
- test/pdfs/scripting_user_activation.pdf
Files Modified:
- src/display/annotation_layer.js
- src/pdf.sandbox.external.js
- src/scripting_api/event.js
- test/integration/scripting_commands_spec.mjs
- test/pdfs/.gitignore
- test/unit/scripting_spec.js
- web/pdf_scripting_manager.js
ad1c3b7f691cb179a999a5fd69310f3c799d678b by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/ad1c3b7f691cb179a999a5fd69310f3c799d678b
Authored: 2026-11-09 20:25:08 +0100
Committed: 2026-11-15 15:01:12 +0100
Coalesce repeated SaveAs requests into a single download
A script can request many downloads in a row: start a new one only once
the previous one is done.
Files Added:
- test/integration/scripting_commands_spec.mjs
Files Modified:
- test/integration/jasmine-boot.js
- test/integration/scripting_spec.mjs
- test/integration/test_utils.mjs
- web/app.js
cbf87af2d664fb44e63b2e6069e45afd42031ec5 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/cbf87af2d664fb44e63b2e6069e45afd42031ec5
Authored: 2026-11-04 16:01:48 +0100
Committed: 2026-11-15 14:47:30 +0100
Update the structure tree when flattening annotations (bug 2075337)
Replace the OBJR of a flattened annotation with a marked-content reference to
its drawing in the page content; a parent tree with kids is rewritten flat.
If the parent tree can't be read, only remove the OBJR.
Files Modified:
- src/core/flattener.js
- src/core/worker.js
- test/unit/api_flattening_spec.js
a629483b62e9192813ef85d78cb370e7a891df0e by Tim van der Meij <info@timvandermeij.nl>
https://github.com/mozilla/pdf.js/commit/a629483b62e9192813ef85d78cb370e7a891df0e
Authored: 2026-11-15 13:10:12 +0100
Committed: 2026-11-15 13:10:12 +0100
Update Python dependencies to the most recent versions
Files Modified:
- .github/font_tests_requirements.txt
b61069cbf72b8148acfcc0484b9a64135d34360d by Tim van der Meij <info@timvandermeij.nl>
https://github.com/mozilla/pdf.js/commit/b61069cbf72b8148acfcc0484b9a64135d34360d
Authored: 2026-11-15 13:03:45 +0100
Committed: 2026-11-15 13:09:07 +0100
Update JavaScript dependencies to the most recent versions
Files Modified:
- gulpfile.mjs
- package-lock.json
- package.json
5a07cb077bdf3501b383fb1abd771925cb58a36c by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/5a07cb077bdf3501b383fb1abd771925cb58a36c
Authored: 2026-11-15 13:05:17 +0100
Committed: 2026-11-15 13:05:17 +0100
Remove the fetchBuiltInCMap check from the createBuiltInCMap function
If the fetchBuiltInCMap parameter is missing trying to access it will already throw TypeError: fetchBuiltInCMap is not a function (in Firefox), hence an explicit error shouldn't be necessary here.
Please also note that this isn't something that a PDF document can cause, since a missing fetchBuiltInCMap would only be an implementation defect elsewhere in the code-base.
Files Modified:
- src/core/cmap.js
0af3e3ca2e9db31481b6fcbf5ccf36deeab3eb63 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/0af3e3ca2e9db31481b6fcbf5ccf36deeab3eb63
Authored: 2026-11-13 13:29:46 +0100
Committed: 2026-11-15 13:04:20 +0100
Avoid unnecessary parsing when reading comments in binary CMap files
Given that comments are just ignored, it's possible to skip unneeded allocations and the string-conversion.
Files Modified:
- src/core/binary_cmap.js
3e336f6e0fee84dc18c2ed9771c46639f15b8e85 by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/3e336f6e0fee84dc18c2ed9771c46639f15b8e85
Authored: 2026-11-13 13:18:29 +0100
Committed: 2026-11-15 13:04:20 +0100
Use the bytesToString function in the src/core/binary_cmap.js code
Files Modified:
- src/core/binary_cmap.js
9eea18756f377105daddaec92269dbf2b1f3f035 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/9eea18756f377105daddaec92269dbf2b1f3f035
Authored: 2026-11-14 22:58:01 +0100
Committed: 2026-11-14 23:17:00 +0100
Preserve blend modes across soft-mask changes
Track the blend mode in the graphics state; the soft-mask scratch
context uses source-over.
It fixes #22489.
Files Added:
- test/pdfs/issue22489.pdf
Files Modified:
- src/display/canvas.js
- test/pdfs/.gitignore
- test/test_manifest.json
0b230df276c8c598859c46653a76414220e7dc6e by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/0b230df276c8c598859c46653a76414220e7dc6e
Authored: 2026-11-04 19:41:50 +0100
Committed: 2026-11-14 21:14:58 +0100
[api-minor] Support form field flattening in saveDocument (bug 2075337)
With flatten: true, also draw the widgets, generating their appearances
from the stored values, and remove the ones hidden for the intent. Prune
the removed fields from the AcroForm, and remove it when no page widget
remains, unless it declares signatures. Add a "non-forms" value to keep the
form fields.
Files Modified:
- src/core/annotation.js
- src/core/document.js
- src/core/flattener.js
- src/core/worker.js
- src/display/api.js
- test/unit/api_flattening_spec.js
4bbb1840aae8e38864e4276739be4a23a5660f0b by calixteman <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/4bbb1840aae8e38864e4276739be4a23a5660f0b
Authored: 2026-10-01 16:28:50 +0200
Committed: 2026-11-14 20:27:15 +0100
[api-minor] Support annotation flattening in saveDocument (bug 2075337)
Add flatten and intent options to draw supported annotation appearances
into page content. Use print or display visibility. Keep the widgets and
the interactive annotations.
Android 14's PdfRenderer calls PDFium without FPDF_ANNOT [1].
Files Added:
- src/core/flattener.js
- test/unit/api_flattening_spec.js
Files Modified:
- src/core/annotation.js
- src/core/core_utils.js
- src/core/document.js
- src/core/editor/print_appearances.js
- src/core/worker.js
- src/core/writer.js
- src/display/api.js
- test/unit/api_spec.js
- test/unit/clitests.json
- test/unit/jasmine-boot.js
- test/unit/test_utils.js
dff205cf6f4964c1ce3cd4c2d2b80ed8275300cc by Jonas Jenwald <jonas.jenwald@gmail.com>
https://github.com/mozilla/pdf.js/commit/dff205cf6f4964c1ce3cd4c2d2b80ed8275300cc
Authored: 2026-11-14 15:47:07 +0100
Committed: 2026-11-14 20:05:18 +0100
[api-major] Compress the no-Wasm fallback JavaScript files with Brotli
This extends PR 22499 to apply to all PDF.js builds, and will help reduce the size of e.g. the pdfjs-dist package.
Unfortunately we cannot just re-use the MOZCENTRAL approach here, given that native Brotli support isn't generally available, and we'll instead fetch the no-Wasm JS files manually and decompress them on load in the worker-thread.
In e.g. Firefox (which supports native decompression) the files are decompressed in 1-2 milliseconds, which seems fast enough to not be an issue. Especially considering that they are first of all not loaded by default, and secondly only when Wasm is disabled.
Note: This reduces the size of the gulp generic bundle by 510669 bytes, i.e. over 498 kilo-bytes.
Files Modified:
- gulpfile.mjs
- src/core/evaluator.js
- src/core/wasm_loader.js
- test/unit/test_utils.js
- test/unit/wasm_loader_spec.js
effe259abcc9905e8b3803d167799e452a816f79 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/effe259abcc9905e8b3803d167799e452a816f79
Authored: 2026-11-13 22:27:27 +0100
Committed: 2026-11-14 17:10:10 +0100
Fix the text content of mirrored text (e.g. RTL text from Tesseract)
Tesseract draws the RTL words with a mirrored text matrix, hence the glyphs
are in logical order and drawn from right to left. So reverse them in order to
have them in visual order before running bidi(), and give the item a transform
starting at its left end to avoid having the span rotated in the text layer.
Some invisible format marks (e.g. LRM) can have a width, which mustn't be
ignored when computing the item position and width.
It fixes #16754 and #6509.
Files Added:
- test/pdfs/issue16754.pdf
Files Modified:
- src/core/evaluator.js
- test/pdfs/.gitignore
- test/unit/api_spec.js
571843eed82e67da0b91e8b909084ee742d87f1f by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/571843eed82e67da0b91e8b909084ee742d87f1f
Authored: 2026-11-13 22:19:30 +0100
Committed: 2026-11-14 16:51:52 +0100
Type the non-spacing marks outside of the Hebrew/Arabic blocks as NSM in bidi()
Such marks (e.g. U+034F or U+0300-U+036F) were typed as L, hence they were
creating their own LTR run in RTL text and the following marks were reordered.
It fixes #22433.
Files Modified:
- src/core/bidi.js
- test/unit/bidi_spec.js
7a99223b1e2947f8c261028986edcdc37399412c by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/7a99223b1e2947f8c261028986edcdc37399412c
Authored: 2026-11-14 15:04:44 +0100
Committed: 2026-11-14 15:06:38 +0100
Don't add link attributes to an XFA rich text link with an invalid URL
An invalid URL (e.g. javascript:) is replaced by an empty string in the worker,
and passing it to addLinkAttributes threw.
Files Modified:
- src/display/xfa_layer.js
- test/unit/xfa_tohtml_spec.js
4dfe24fc43232a9b808d301f60764688c5631eeb by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/4dfe24fc43232a9b808d301f60764688c5631eeb
Authored: 2026-11-13 16:35:46 +0100
Committed: 2026-11-13 19:57:07 +0100
Keep together the chars of a glyph when reordering the text content
When a glyph maps to several chars (e.g. a lam-alef ligature), they're in
logical order but bidi() was reversing them with the rest of the RTL run.
So now bidi() gets the glyphs and reorders them as a whole when all their
chars have the same level. The normalization is done per glyph in order to
handle the presentation forms expanded into several chars.
It fixes #16880.
Files Added:
- test/pdfs/issue16880.pdf
Files Modified:
- src/core/bidi.js
- src/core/evaluator.js
- src/core/fonts.js
- test/pdfs/.gitignore
- test/unit/api_spec.js
- test/unit/bidi_spec.js
41d6710e5468a1028ec718ff80fcd05c63dd5ab4 by Calixte Denizet <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/41d6710e5468a1028ec718ff80fcd05c63dd5ab4
Authored: 2026-11-13 16:15:03 +0100
Committed: 2026-11-13 16:19:25 +0100
Enable the enableAndroidEditing option in the GeckoView integration tests
Since #22515, the annotation editor is disabled in GeckoView unless the enableAndroidEditing preference is set.
Files Modified:
- test/integration/geckoview_spec.mjs
235187ee21ce85d6ea98a116b98da3873389697d by calixteman <calixte.denizet@gmail.com>
https://github.com/mozilla/pdf.js/commit/235187ee21ce85d6ea98a116b98da3873389697d
Authored: 2026-11-12 22:44:25 +0100
Committed: 2026-11-13 09:37:48 +0100
Preserve stamp orientation and size when editing saved annotations
Use the annotation rotation when extracting its bitmap, and keep the
rotation-aware dimensions from AnnotationEditor.deserialize.
Files Modified:
- src/display/editor/stamp.js
- src/display/editor/tools.js
- test/integration/stamp_editor_spec.mjs
| Reporter | ||
Comment 2•12 days ago
|
||
| O1WtmpAISLKqjfyRPHCr2g | ||
I've submitted a try run for this commit: https://treeherder.mozilla.org/jobs?repo=try&revision=8200929a14febfb5b01c004bf3b64f78ba6f4a2f
| Reporter | ||
Comment 3•12 days ago
|
||
| Reporter | ||
Comment 4•12 days ago
|
||
| Lg5exbznS7aHd927QBoGow | ||
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 6•11 days ago
|
||
| bugherder | ||
Updated•1 day ago
|
Description
•