Closed Bug 2056114 Opened 5 days ago Closed 4 days ago

Update PDF.js to new version 547236bcd517f4afa46b5c6db8483992c5ea90e6 from 2026-07-19 21:19:55

Categories

(Firefox :: PDF Viewer, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 2056233
Tracking Status
firefox154 --- affected

People

(Reporter: update-bot, Assigned: calixte)

References

(Blocks 1 open bug)

Details

(Whiteboard: [3pl-filed][task_id: d8fYQgS6T1Ok8w5WetdL9g])

Attachments

(1 obsolete file)

This update covers 14 commits. Here are the overall diff statistics, and then the commit information.


toolkit/components/pdfjs/content/build/pdf.mjs | 30 +-
toolkit/components/pdfjs/content/build/pdf.scripting.mjs | 4 +-
toolkit/components/pdfjs/content/build/pdf.worker.mjs | 726 +++++++------
toolkit/components/pdfjs/content/web/viewer-geckoview.mjs | 29 +-
toolkit/components/pdfjs/content/web/viewer.mjs | 29 +-
toolkit/components/pdfjs/moz.yaml | 4 +-
6 files changed, 401 insertions(+), 421 deletions(-)


850020a84ef1f17d65a66d07c3c7981688c12226 by calixteman <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/850020a84ef1f17d65a66d07c3c7981688c12226
Authored: 2026-07-19 21:54:45 +0200
Committed: 2026-07-19 21:54:45 +0200

Address follow-up review comments in coverage_search.mjs

Use a Headers object for the request and log informational progress
messages via console.log instead of console.error.

Files Modified:

  • external/ccov/coverage_search.mjs

02027ba38127e4dfb7c205bb40237a7216f6b48d by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/02027ba38127e4dfb7c205bb40237a7216f6b48d
Authored: 2026-07-19 16:48:07 +0200
Committed: 2026-07-19 16:48:07 +0200

Combine the getPathJs and hasBuiltPath methods in the CompiledFont class

This avoids duplicating the charCode/glyphId lookup, and (slightly) shortens the code. In particular:

  • Given that the path-data is returned as a TypedArray, it's easy enough to instead return null to indicate that the glyph was previously compiled.

  • The charCode-cache can be changed into a Set, since we only need to track the "seen" charCodes and not their relation to the glyphIds.

  • The compileFontPathInfo call is moved into CompiledFont class, since that simplifies the src/core/evaluator.js code a tiny bit.

Files Modified:

  • src/core/evaluator.js
  • src/core/font_renderer.js

e6c7ab5425c6836250d478f77b12b9ae1403b245 by calixteman <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/e6c7ab5425c6836250d478f77b12b9ae1403b245
Authored: 2026-07-19 16:42:05 +0200
Committed: 2026-07-19 16:42:05 +0200

Skip the cache existence check when --no-download is set

Move the fs.existsSync(indexPath) check below the --no-download
early return: in that mode the check is unused (the read after
refreshIndex already validates existence), so it's wasted disk I/O.

Files Modified:

  • external/ccov/coverage_search.mjs

c7dc7d7dd02dfa7413a53d6abb38e58477375ed6 by calixteman <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/c7dc7d7dd02dfa7413a53d6abb38e58477375ed6
Authored: 2026-07-19 16:13:20 +0200
Committed: 2026-07-19 16:13:20 +0200

Sanitize the cached ETag and index to satisfy CodeQL

Address two CodeQL findings on the per-test index downloader:

  • "File data in outbound network request": validate the cached ETag
    against the RFC 7232 grammar before sending it as If-None-Match, so
    the cache file's contents can't be injected into the request header.
  • "Network data written to file": cache the re-serialized JSON
    (JSON.stringify(JSON.parse(...))) instead of the raw response body,
    so only well-formed JSON produced by our own serializer is written.

Files Modified:

  • external/ccov/coverage_search.mjs

d50400001242450f9496ed64bd5e903117f5d213 by calixteman <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/d50400001242450f9496ed64bd5e903117f5d213
Authored: 2026-07-19 15:34:18 +0200
Committed: 2026-07-19 15:37:05 +0200

Download the per-test coverage index

coverage_search now fetches per-test-index.json from the pdf.js.refs
gh-pages branch, caches it locally, and only re-downloads it (via ETag)
when it changed, so querying which ref tests cover a line/function no
longer needs a local --coverage-per-test build. --no-download reuses
the cached index offline and --index points at a local one.

browsertest and makeref accept the same --code filter to run (or
regenerate refs for) only the covering tests, dropping any covered IDs
that aren't in this branch's manifest so the run isn't rejected.

Files Modified:

  • README.md
  • external/ccov/coverage_search.mjs
  • gulpfile.mjs

6fbd2227db9ad34ed22fcd2a34f158ffedad8360 by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/6fbd2227db9ad34ed22fcd2a34f158ffedad8360
Authored: 2026-07-19 12:07:08 +0200
Committed: 2026-07-19 12:07:08 +0200

[api-minor] Convert getDestinations 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.

Files Modified:

  • src/core/catalog.js
  • src/core/editor/pdf_editor.js
  • src/display/api.js
  • test/unit/api_spec.js

344736bcad2993886cac31ad1ed0872a900b981a by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/344736bcad2993886cac31ad1ed0872a900b981a
Authored: 2026-07-18 14:03:46 +0200
Committed: 2026-07-18 14:15:24 +0200

Re-factor the bCache, used with /Mesh Shadings

  • Initialize the bCache lazily, since many/most PDF documents don't need it.
  • Change the bCache to a Map, rather than an Object, which thanks to getOrInsertComputed allows the buildB function to be inlined.

Also, while unrelated here, move the this.matrix = null; definition to the BaseShadingPattern class to reduce (a tiny bit of) unnecessary duplication.

Files Modified:

  • src/core/pattern.js
  • src/display/pattern_helper.js

b2cf8527c6cf53051aed1da8a5f46aeed45692e2 by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/b2cf8527c6cf53051aed1da8a5f46aeed45692e2
Authored: 2026-07-18 11:44:27 +0200
Committed: 2026-07-18 11:44:27 +0200

Change the CompiledFont glyph/charCode caches to use Maps

This code is old enough that it predates the general availability of Map, and these changes allow us to shorten the code a tiny bit.

Files Modified:

  • src/core/font_renderer.js

47f2b2284253e20307ba062fa253b35bb28da5ed by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/47f2b2284253e20307ba062fa253b35bb28da5ed
Authored: 2026-07-17 20:55:58 +0200
Committed: 2026-07-17 21:23:08 +0200

Use Iterator methods to avoid some unnecessary Array creation

Currently there are some spots in the code-base where intermediate Arrays are unnecessarily created from Iterators, before filter and map is used to create a final Array.
Thanks to newer Iterators methods, see e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/filter, that can be now be avoided.

Files Modified:

  • src/core/xfa/xfa_object.js
  • src/display/draw_layer.js
  • web/struct_tree_layer_builder.js

922d57631bbaabfed767ba64fb63ebb89d9811ea by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/922d57631bbaabfed767ba64fb63ebb89d9811ea
Authored: 2026-07-13 11:20:15 +0200
Committed: 2026-07-17 13:51:08 +0200

Rebuild missing AcroForm fields

Files Modified:

  • src/core/editor/pdf_editor.js
  • test/unit/api_spec.js

0f060e1e64a8eb745f32ce1f67203ccac07545ad by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/0f060e1e64a8eb745f32ce1f67203ccac07545ad
Authored: 2026-07-17 12:49:29 +0200
Committed: 2026-07-17 12:49:29 +0200

Use getOrInsertComputed in the CanvasGraphics.prototype._getPattern method

Files Modified:

  • src/display/canvas.js

eb58ccc1000669ba1b994ac0906938b38eb968c9 by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/eb58ccc1000669ba1b994ac0906938b38eb968c9
Authored: 2026-07-13 11:08:15 +0200
Committed: 2026-07-16 22:18:26 +0200

Handle revisioned structure attributes

Files Modified:

  • src/core/editor/pdf_editor.js
  • test/unit/api_spec.js

f554d0c9c89b8e4bb837f2193c767f63ea8869a0 by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/f554d0c9c89b8e4bb837f2193c767f63ea8869a0
Authored: 2026-07-16 21:04:45 +0200
Committed: 2026-07-16 21:04:45 +0200

Implement SmaskInData == 2 for JPX images

Files Added:

  • test/pdfs/jpx_smaskindata.pdf

Files Modified:

  • src/core/image.js
  • test/pdfs/.gitignore
  • test/test_manifest.json

9a7335d26bded3e11be4eb7ba98d8eb6b1b2e7dc by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/9a7335d26bded3e11be4eb7ba98d8eb6b1b2e7dc
Authored: 2026-07-16 19:00:34 +0200
Committed: 2026-07-16 20:45:01 +0200

Start using Iterator.prototype.join in the code-base

This is an upcoming JavaScript feature, which helps avoid creating intermediate Arrays in some cases; see https://github.com/tc39/proposal-iterator-join

Firefox implemented this in bug 2004803, and it was enabled by default in bug 2047995.

This patch changes two Objects to Maps, in the XFA-parsing respectively the find-implementation, to make use of the new feature.

Files Modified:

  • src/core/document.js
  • src/core/xfa/factory.js
  • src/shared/util.js
  • test/unit/xfa_tohtml_spec.js
  • web/pdf_find_controller.js

Duplicate of this bug: 2056099
No longer blocks: 2004803, 2047995

All jobs completed, we found the following issues.

Known Issues:

  • test-windows10-64-2009-qr/debug-xpcshell-1 - 1 of 4 failed on the same (retriggered) task (failed: JSDltNZ0QEiSrWWW4CHYxw)

These failures may mean that the library update succeeded; you'll need to review
them yourself and decide. If there are lint failures, you will need to fix them in
a follow-up patch. (Or ignore the patch I made, and recreate it yourself with
./mach vendor toolkit/components/pdfjs/moz.yaml.)

In either event, I have done all I can, so you will need to take it from here.
When reviewing, please note that this is external code, which needs a full and
careful inspection - not a rubberstamp.

Assignee: nobody → cdenizet

This bug is being closed because a newer revision of the library is available.
This bug will be marked as a duplicate of it (because although this bug is older, it is superseded by the newer one).

Status: NEW → RESOLVED
Closed: 4 days ago
Duplicate of bug: 2056233
Resolution: --- → DUPLICATE
Attachment #9610482 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: