Closed Bug 1848259 Opened 7 months ago Closed 7 months ago

Update PDF.js to new version 1d523d3ec1457206a11b425a062cd108d59e798a from 2023-08-10 16:37:59


(Firefox :: PDF Viewer, enhancement)




118 Branch
Tracking Status
firefox118 --- fixed


(Reporter: update-bot, Assigned: calixte)


(Blocks 1 open bug)


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


(1 file)

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

toolkit/components/pdfjs/content/build/pdf.js | 705 ++++++++-----
toolkit/components/pdfjs/content/build/pdf.scripting.js | 12 +-
toolkit/components/pdfjs/content/build/pdf.worker.js | 66 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.css | 196 ++-
toolkit/components/pdfjs/content/web/viewer-geckoview.js | 6 +-
toolkit/components/pdfjs/content/web/viewer.css | 200 ++-
toolkit/components/pdfjs/content/web/viewer.html | 10 +-
toolkit/components/pdfjs/content/web/viewer.js | 6 +-
toolkit/components/pdfjs/moz.yaml | 4 +-
9 files changed, 721 insertions(+), 484 deletions(-)

96a1f323c4048d06e9c76bbbeb77d52a753638af by Calixte Denizet
Authored: 2023-08-10 18:24:54 +0200
Committed: 2023-08-10 18:24:57 +0200

[Editor] Avoid showing the context menu or resizing when a resizer is right clicked

Files Modified:

  • src/display/editor/editor.js

71f5050ed299b56613f75b76c477198261375990 by Calixte Denizet
Authored: 2023-08-10 18:02:27 +0200
Committed: 2023-08-10 18:02:27 +0200

[Editor] Avoid to unselect when a new page is rendered

Files Modified:

  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/tools.js
  • test/integration/freetext_editor_spec.js

389a26c115de8e6de8df800ddaddaac9d59e3355 by Jonas Jenwald
Authored: 2023-08-10 11:59:40 +0200
Committed: 2023-08-10 17:10:04 +0200

Fallback to check all pages when getting the pageIndex of FieldObjects

Given that the FieldObjects are parsed in parallel, in combination with the existing caching in the getPage-method and annotations-getter, adding additional caches for this fallback code-path doesn't seem entirely necessary.

Files Modified:

  • src/core/annotation.js
  • test/unit/api_spec.js

7a5b3423d63d5106aa7fc3602d5cf189ddf69eec by Calixte Denizet
Authored: 2023-08-10 15:19:41 +0200
Committed: 2023-08-10 15:19:45 +0200

[Editor] Don't forget to encrypt image streams (see issue #16821)

and encrypt a compressed stream after having been compressed.

Files Added:

  • test/pdfs/empty_protected.pdf

Files Modified:

  • src/core/annotation.js
  • src/core/writer.js
  • test/pdfs/.gitignore
  • test/test_manifest.json

402e3fed95888c1e1c5ec6cb6bf879421642a5fe by Calixte Denizet
Authored: 2023-08-09 11:23:26 +0200
Committed: 2023-08-10 14:45:36 +0200

[Editor] Add the possibility to move all the selected editors with the mouse (bug 1847894)

Files Modified:

  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/editor.js
  • src/display/editor/freetext.js
  • src/display/editor/ink.js
  • src/display/editor/stamp.js
  • src/display/editor/tools.js
  • test/integration/freetext_editor_spec.js
  • test/integration/test_utils.js
  • web/annotation_editor_layer_builder.css

b6b51f57ed7f9f9aad23003e3c36583c325a5cf9 by Calixte Denizet
Authored: 2023-08-10 13:18:02 +0200
Committed: 2023-08-10 14:11:42 +0200

[Editor] Avoid to have slightly truncated images because of non-integer canvas dimensions

Files Modified:

  • src/display/editor/stamp.js

b6432ef9defaa816bf51c7e9f184f7ae6b6b6033 by Calixte Denizet
Authored: 2023-08-10 12:17:27 +0200
Committed: 2023-08-10 12:18:15 +0200

[Editor] Avoid to add a cancelled added image in the undo/redo stack

We're adding the action in the undo/redo stack whatever the status of the
operation was. This patch aims to add the action only when the image has been
successfully added.

Files Modified:

  • src/display/editor/stamp.js

ec7746350d4bea66c342df2af41a213e4bd0287c by Jonas Jenwald
Authored: 2023-08-09 17:03:25 +0200
Committed: 2023-08-09 17:04:54 +0200

Introduce even more optional chaining in the code-base

This replaces a few more small/simple if-statements with optional chaining.

Files Modified:

  • src/core/chunked_stream.js
  • src/display/api.js
  • src/display/editor/tools.js

149f18b76657aebbc9560a644983421aa4ba86cc by Calixte Denizet
Authored: 2023-08-09 13:35:45 +0200
Committed: 2023-08-09 13:35:45 +0200

[Editor] Move the parameter elements for FreeText and Ink annotations at the right place (follow-up of #16802)

Files Modified:

  • web/viewer.css

9ae7ad0fa6ffa44c9652297525ace053bb87f870 by Calixte Denizet
Authored: 2023-08-09 12:09:11 +0200
Committed: 2023-08-09 12:09:15 +0200

[Editor] Avoid to unselect some editors when the main window is focused

When several editors are selected and the window loses and then gets back its focus,
the previously focused editor is triggering its focus callback making it the only
selected one.
This patch aims to avoid triggering the focus callback called when the main window
gets its focus back.

Files Modified:

  • src/display/editor/tools.js

7d8b53bf7a456bed9a041bc10794a6383edc96c6 by Calixte Denizet
Authored: 2023-08-08 19:47:24 +0200
Committed: 2023-08-08 21:02:05 +0200

[Editor] Move an the editor div in the DOM once a translation with the keyboard is done

When moving an element in the DOM, the focus is potentially lost, so we need to make sure
that the focused element before the translation will get back its focus after it.
But we must take care to not execute any focus/blur callbacks because the user didn't
do anything which should trigger such events: it's a detail of implementation. For example,
when several editors are selected and moved, then at the end the same must be selected, so
no element receive a focus event which will set it as selected.

Files Modified:

  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/editor.js
  • src/display/editor/freetext.js
  • src/display/editor/ink.js
  • test/integration/freetext_editor_spec.js
  • test/integration/ink_editor_spec.js

8f6635bacfa792a2bc3701bcfb44159f5e571b60 by Calixte Denizet
Authored: 2023-08-08 18:24:03 +0200
Committed: 2023-08-08 18:24:48 +0200

[Editor] Avoid to add a new line when hitting enter with a selected freetext editor

Files Modified:

  • src/display/editor/freetext.js
  • test/integration/freetext_editor_spec.js

e2819d0c676753397ea930c287081961499c84b8 by Jonas Jenwald
Authored: 2023-08-08 11:16:50 +0200
Committed: 2023-08-08 15:53:48 +0200

Take fill-alpha into account with default icons for FileAttachment annotations (issue 16800)

Files Added:

  • test/pdfs/

Files Modified:

  • src/core/annotation.js
  • src/display/annotation_layer.js
  • test/annotation_layer_builder_overrides.css
  • test/test_manifest.json

e2f20a1afe3b58ad3b42aa3a2020da6a30aca51a by Calixte Denizet
Authored: 2023-08-08 15:05:27 +0200
Committed: 2023-08-08 15:05:27 +0200

[Annotation] Strip out the array index in the path only when the path is from a terminal node (bug 1847733)

Files Added:

Files Modified:

  • src/core/annotation.js
  • src/core/document.js
  • test/integration/annotation_spec.js
  • test/test_manifest.json

aa71619c2d733bbbd119400814db0bde4d347b1e by Calixte Denizet
Authored: 2023-08-04 18:21:27 +0200
Committed: 2023-08-08 12:54:12 +0200

[Editor] Fix the resizing of an editor when it's rotated (bug 1847268)

There are 2 rotation we've to deal with: the viewer one and the editor one.
The previous implementation was a bit complex and having to deal with these
rotation would have potentially increase it.
So this patch aims to simplify the implementation and deal with all the possible
The main idea is to transform the mouse deltas according to the rotations and then
apply the resizing in the page coordinates system.

Files Modified:

  • gulpfile.mjs
  • package-lock.json
  • package.json
  • src/display/editor/editor.js
  • src/display/editor/tools.js
  • test/integration/stamp_editor_spec.js
  • test/integration/test_utils.js
  • web/annotation_editor_layer_builder.css

35d1f5485e3cb444c7b25a7f59e12ea68ed2892a by Calixte Denizet
Authored: 2023-08-08 11:35:51 +0200
Committed: 2023-08-08 11:35:51 +0200

[Editor] Move the stamp button on the right of the pen one (bug 1847707)

Files Modified:

  • web/viewer.html

400699687e15f1c8ed118fbc0fd76c3b044bc30e by Calixte Denizet
Authored: 2023-08-06 21:05:49 +0200
Committed: 2023-08-08 11:19:04 +0200

[Editor] Fix the dimensions of the annotation editor layer (follow-up of #16794)

Files Modified:

  • src/display/display_utils.js
  • src/display/editor/editor.js
  • src/shared/util.js

8bd45cb260a05a5a5be14f8973527bb9276e31c7 by Jonas Jenwald
Authored: 2023-08-06 19:14:06 +0200
Committed: 2023-08-06 22:09:15 +0200

[Editor] Change the resize cursors to bidirectional variants

When resizing an editor we're currently using unidirectional cursors, please refer to
Given that editors can (generally) be resized to become either smaller or larger, it seems overall more appropriate to use bidirectional cursors to make this clearer to the user.

Note that as mentioned in the MDN article some environments, which seems to apply to e.g. Windows 11, doesn't differentiate between the two cursor formats and simply use bidirectional ones unconditionally.

One additional benefit of these changes is that the relevant CSS rules become slightly more compact.

Files Modified:

  • web/annotation_editor_layer_builder.css

1182f4965d672a2c2ac1165943036a58d29ecc33 by Jonas Jenwald
Authored: 2023-08-06 09:25:38 +0200
Committed: 2023-08-06 09:25:38 +0200

Update l10n files

Files Modified:

  • l10n/ach/
  • l10n/be/
  • l10n/cs/
  • l10n/cy/
  • l10n/de/
  • l10n/dsb/
  • l10n/el/
  • l10n/en-GB/
  • l10n/eo/
  • l10n/es-AR/
  • l10n/es-CL/
  • l10n/es-ES/
  • l10n/eu/
  • l10n/fi/
  • l10n/fr/
  • l10n/fur/
  • l10n/gn/
  • l10n/he/
  • l10n/hi-IN/
  • l10n/hsb/
  • l10n/hu/
  • l10n/ia/
  • l10n/is/
  • l10n/it/
  • l10n/ja/
  • l10n/kk/
  • l10n/ko/
  • l10n/mk/
  • l10n/nn-NO/
  • l10n/oc/
  • l10n/pl/
  • l10n/pt-BR/
  • l10n/pt-PT/
  • l10n/rm/
  • l10n/ru/
  • l10n/sat/
  • l10n/si/
  • l10n/sk/
  • l10n/skr/
  • l10n/sl/
  • l10n/sv-SE/
  • l10n/tg/
  • l10n/th/
  • l10n/tr/
  • l10n/uk/
  • l10n/vi/
  • l10n/zh-CN/
  • l10n/zh-TW/

d50237da3cadce8d4d431987147839e5b7ec2eca by Jonas Jenwald
Authored: 2023-08-06 09:22:20 +0200
Committed: 2023-08-06 09:25:30 +0200

Update npm packages

Files Modified:

  • gulpfile.mjs
  • package-lock.json
  • package.json

e414dfcff7a6555246399339a122cf42c2916289 by Jonas Jenwald
Authored: 2023-08-04 14:33:06 +0200
Committed: 2023-08-04 14:33:06 +0200

Use the round CSS function in the setLayerDimensions helper function

This has now been enabled unconditionally in Firefox, see

For the page-containers in the viewer, this patch should restore the behaviour prior to PR 15770; see e.g.
Note that these changes this will lead to a tiny bit of movement in some text and annotations reference tests.

Please find additional information at

Files Modified:

  • src/display/display_utils.js
  • test/test.mjs

42e6243ebf8717beb2a186bb040463ceb78bc17a by Jonas Jenwald
Authored: 2023-08-03 12:43:49 +0200
Committed: 2023-08-03 12:53:27 +0200

Attempt to expose e.g. pdfjsLib globally regardless of how the library is imported (issue 16778)

We obviously don't want to re-introduce any require usage in e.g. the viewer, since we should strive to only use native import statements wherever possible.[1]
Hopefully exposing e.g. the library globally in more cases won't break anything, however it's somewhat difficult for me to imagine all the ways in which third-party users may be accessing the PDF.js library. (Given the lack of a runnable test-case in the issue, I also cannot guarantee that this is enough to fully address the problem.)

[1] Ideally we should probably not rely on e.g. pdfjsLib being globally available in the built viewer, and rather always import the library instead.
Unfortunately this would require larger (possibly breaking) changes in the builds that we provide, however note that Firefox only recently got support for import in workers and that Webpack still only have experimental support for outputting "proper" modules.

Files Modified:

  • gulpfile.mjs

Assignee: nobody → update-bot

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.

Assignee: update-bot → cdenizet
Pushed by
Update PDF.js to 1d523d3ec1457206a11b425a062cd108d59e798a r=pdfjs-reviewers,calixte
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch
You need to log in before you can comment on or make changes to this bug.