Closed Bug 1844647 Opened 11 months ago Closed 11 months ago

Update PDF.js to new version 2a508b95e185d190ce1e65e8e364997a279ae46f from 2023-07-20 17:42:38


(Firefox :: PDF Viewer, enhancement)




117 Branch
Tracking Status
firefox117 --- fixed


(Reporter: update-bot, Assigned: calixte)


(Blocks 1 open bug)


(Whiteboard: [3pl-filed][task_id: C23TX-rfScuUDgX_L-xs_g])


(1 file)

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

toolkit/components/pdfjs/content/build/pdf.js | 291 ++++++++----
toolkit/components/pdfjs/content/build/pdf.scripting.js | 4 +-
toolkit/components/pdfjs/content/build/pdf.worker.js | 66 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.css | 24 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.html | 4 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.js | 14 +-
toolkit/components/pdfjs/content/web/viewer.css | 27 +-
toolkit/components/pdfjs/content/web/viewer.js | 14 +-
toolkit/components/pdfjs/moz.yaml | 4 +-
9 files changed, 279 insertions(+), 169 deletions(-)

cd97fcb4143e441f494184bd77523f7497f253e0 by Calixte Denizet
Authored: 2023-07-20 19:08:54 +0200
Committed: 2023-07-20 19:08:54 +0200

[Editor] Allow to delete an editor in using the Delete key (aka fn+backspace) (bug 1844625)

Files Modified:

  • src/display/editor/tools.js

88524bf9aee39b18801f7ce4bc73ee9f74790517 by Jonas Jenwald
Authored: 2023-07-20 15:36:08 +0200
Committed: 2023-07-20 15:49:59 +0200

Don't reset temporary XRef-entries during saving (PR 16392 follow-up)

Please note: I'm not aware of any bugs caused by this, however that might be more luck than anything else.

In PR 16392 the incrementalUpdate function, and all of its various helpers, were made asynchronous. However the call-site in src/core/worker.js wasn't updated, which means that we currently reset temporary XRef-entries while saving is ongoing.

Files Modified:

  • src/core/worker.js

8daf2f1eb1ded5a91294ada50357a4e7e9a5f01f by Calixte Denizet
Authored: 2023-05-30 12:36:35 +0200
Committed: 2023-07-20 10:53:23 +0200

[Annotation] Use the clip-path property when an annotation has some quad points

This way it'll avoid to split a div in multiple divs having the same id (which
is supposed to be unique).

Files Modified:

  • src/display/annotation_layer.js
  • test/annotation_layer_builder_overrides.css
  • test/driver.js
  • web/annotation_layer_builder.css

7cd062ec684981f381e8266b61f7788edee75a27 by Calixte Denizet
Authored: 2023-07-19 20:14:18 +0200
Committed: 2023-07-19 20:29:54 +0200

Draw correctly background images in ref tests

It's a workaround for bug
It should be reverted (in order to avoid a perf penalty) once the bug is fixed
in Firefox.

Files Modified:

  • test/driver.js

295eb13a44fa2a2d1c66cf92ddfc6c5a290c1f5a by Calixte Denizet
Authored: 2023-07-19 11:17:50 +0200
Committed: 2023-07-19 11:17:50 +0200

[Editor] Bind redo action on meta+shift+z on mac (bug 1844293)

Files Modified:

  • src/display/editor/tools.js

186a6fd0cbda998520b6f59ea34f0ceb3b8c63c7 by dependabot[bot]
Authored: 2023-07-18 20:14:51 +0000
Committed: 2023-07-18 20:14:51 +0000

Bump word-wrap from 1.2.3 to 1.2.4

Bumps word-wrap from 1.2.3 to 1.2.4.


  • dependency-name: word-wrap
    dependency-type: indirect

Signed-off-by: dependabot[bot] <>

Files Modified:

  • package-lock.json

7ac3bf6f1727d8e51916718a8b4bb7df8ea9c5e5 by Calixte Denizet
Authored: 2023-07-18 15:39:18 +0200
Committed: 2023-07-18 15:39:18 +0200

[Editor] Don't forget to generate non-missing images when printing (bug 1844036)

Files Modified:

  • src/core/document.js
  • test/driver.js
  • test/test_manifest.json

d9350c38997b31ee9f0058f438b332997eb53e07 by Jonas Jenwald
Authored: 2023-07-18 09:07:32 +0200
Committed: 2023-07-18 09:07:32 +0200

Temporarily stop running gulp typestest in GitHub Actions

This is necessary to unblock the previous patch, which removes more build-time require-calls from the src/display/ folder.

Files Modified:

  • gulpfile.mjs

d02291271924ea5afe2ee4fbb400a5ae4f3157ef by Jonas Jenwald
Authored: 2023-07-13 11:58:16 +0200
Committed: 2023-07-17 19:47:13 +0200

Remove most build-time require-calls from the src/display/-folder

By leveraging import maps we can get rid of most of the remaining require-calls in the src/display/-folder, since we should strive to use modern import-statements wherever possible.
The only remaining cases are Node.js-specific dependencies, since those seem very difficult to convert unless we start producing a bundle specifically for Node.js environments.

Files Added:

  • src/display/stubs.js

Files Modified:

  • .eslintrc
  • gulpfile.mjs
  • src/display/annotation_layer.js
  • src/display/api.js
  • src/display/node_stream.js
  • src/pdf.js
  • test/unit/pdf_spec.js
  • test/unit/unit_test.html
  • web/viewer-geckoview.html
  • web/viewer.html

3a886e7264f15289e5cb391f3287c17fea5b3bb9 by Jonas Jenwald
Authored: 2023-07-17 16:33:06 +0200
Committed: 2023-07-17 16:42:25 +0200

Move the isNodeJS-helper into the src/shared/util.js file

With the changes in the previous patch the isNodeJS-helper no longer needs to live in its own file, which helps get rid of a closure in the built files.

Files Deleted:

  • src/shared/is_node.js

Files Modified:

  • src/core/worker.js
  • src/display/api.js
  • src/display/canvas.js
  • src/display/font_loader.js
  • src/display/node_utils.js
  • src/display/svg.js
  • src/shared/util.js
  • test/unit/api_spec.js
  • test/unit/clitests_helper.js
  • test/unit/display_svg_spec.js
  • test/unit/display_utils_spec.js
  • test/unit/event_utils_spec.js
  • test/unit/jasmine-boot.js
  • test/unit/node_stream_spec.js
  • test/unit/pdf_find_controller_spec.js
  • test/unit/test_utils.js
  • test/unit/text_layer_spec.js
  • test/unit/xfa_tohtml_spec.js

67303b16f1f708fd1c430eccd11719f4e4e8d65b by Jonas Jenwald
Authored: 2023-07-17 15:44:30 +0200
Committed: 2023-07-17 16:42:08 +0200

[api-minor] Let Babel handle the necessary core-js polyfills automatically

In the last couple of years we've been quicker to remove support for older browsers/environments, which means that at this point in time we don't bundle that many polyfills. (The polyfills are also generally simpler nowadays, ever since we removed support for e.g. Internet Explorer.)
Rather than having to manually handle the polyfills, we can actually let Babel take care of bundling the necessary polyfills for us; please refer to

The only exception here is the Node.js-specific compatibility-code, which is moved into the src/display/node_utils.js file. This ought to be fine since workers are not available/used in Node.js-environments.

Please note: For the legacy-builds this will increase the size of the built files, however that seems like a very small price to pay in order to simplify maintenance of the general PDF.js library.

Files Deleted:

  • src/shared/compatibility.js

Files Modified:

  • gulpfile.mjs
  • src/display/node_utils.js
  • src/shared/util.js

983b269e267737c98042b51da9f95d01f7ffcaa2 by Calixte Denizet
Authored: 2023-07-17 15:03:27 +0200
Committed: 2023-07-17 15:08:09 +0200

[Editor] Use 2 decimals for editor positions and dimensions

I noticed that after adding an image in issue16278.pdf, the image was constantly
resizing itself.
It appears that it's because of rounding errors.

Files Modified:

  • src/display/editor/editor.js

a8867cf68ae6b30fea59086df6c930a21bf4b3ae by Calixte Denizet
Authored: 2023-07-13 18:31:08 +0200
Committed: 2023-07-17 14:27:15 +0200

[Editor] Avoid to have some part of an editor outside its page (bug 1843303)

Files Modified:

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

8614621d8d90bee6504e37635eb954caf267e07e by Jonas Jenwald
Authored: 2023-07-17 11:40:49 +0200
Committed: 2023-07-17 11:47:11 +0200

[GeckoView] Fix l10n of the download toolbar-button (PR 16340 follow-up)

Localization of this button broke in PR 16340, which I assume was completely accidental, since the download-button now tries to access a l10n-id that was removed some time ago (see PR 15617).
Note how loading even the development viewer, i.e. http://localhost:8888/web/viewer-geckoview.html#locale=en-US, currently logs l10n-warnings on the master branch.

Files Modified:

  • web/viewer-geckoview.html

9660ca53afc488f90db8b1f26e0e4b5fa2da3373 by Jonas Jenwald
Authored: 2023-07-16 09:24:14 +0200
Committed: 2023-07-16 09:24:14 +0200

Enable more ESLint unicorn plugin rules

Files Modified:

  • .eslintrc
  • package-lock.json
  • package.json
  • src/core/function.js

bad4bfffdf4bfc15c66039eb1b8731d86f154dfa by Jonas Jenwald
Authored: 2023-07-15 10:17:26 +0200
Committed: 2023-07-16 08:51:46 +0200

Remove the require from the web/pdfjs.js

Having a require in this file has never made sense in e.g. the Firefox PDF Viewer and shouldn't really be necessary.
Possibly the idea was to facilitate some kind of third-party bundling, however the built pdf.js file has always exposed the API-contents globally.

Files Modified:

  • web/pdfjs.js

86a868189c58c2028482ef0cc8da7c40b34f8414 by Jonas Jenwald
Authored: 2023-07-13 13:10:06 +0200
Committed: 2023-07-16 08:51:46 +0200

Re-factor the PDFScriptingManager-class for the viewer-components

Currently this class contains a few "special" code-paths for the COMPONENTS build-target, which normally wouldn't be a problem. However, in this particular case that means accessing code that we don't want to include unconditionally in all builds.
This is currently implemented using build-time require-calls which we nowadays want to avoid, and we should strive to remove all such cases from the code-base. (Generally speaking import is the future, and build-tools may not always play well with a mix of both formats.)

We can easily improve things here by using sub-classing for the COMPONENTS build-target, and then use the ability to re-name when exporting (to avoid breaking existing code).

Files Added:

  • web/pdf_scripting_manager.component.js

Files Modified:

  • test/unit/pdf_viewer.component_spec.js
  • web/pdf_scripting_manager.js
  • web/pdf_viewer.component.js

337cba736e4a0c6ac14f6a2d494941abd3f2eae6 by Jonas Jenwald
Authored: 2023-07-13 12:20:58 +0200
Committed: 2023-07-16 08:51:46 +0200

[ESM] Remove the remaining require from the gulpfile

Files Modified:

  • gulpfile.mjs

b019c13b3372e4bdbd7b4b5f1b4a243a7274b031 by Jonas Jenwald
Authored: 2023-07-15 12:03:35 +0200
Committed: 2023-07-15 12:03:47 +0200

Ensure that a test-suite that runs no tests is treated as a failure

Occasionally some test-suites may fail to start on the bots, however that's not correctly reflected in the botio-output posted to GitHub which makes it easy to accidentally overlook this situation.
Looking at the raw logs when that happens they always seem to contain a line such as Run NaN tests which means that we should be able to easily make this situation a failure as intended.

Files Modified:

  • test/test.mjs

b05c2e034316260b225969743973791c9b2382c9 by Jonas Jenwald
Authored: 2023-07-15 09:13:54 +0200
Committed: 2023-07-15 10:44:39 +0200

Update l10n files

Files Modified:

  • l10n/it/

f84657d837b3ca93db385dc7c88d30a5215e3cac by Jonas Jenwald
Authored: 2023-07-15 09:09:20 +0200
Committed: 2023-07-15 10:44:39 +0200

Address formatting changes from Prettier version 3

Files Modified:

  • src/core/standard_fonts.js
  • test/integration/freetext_editor_spec.js
  • test/unit/api_spec.js
  • web/viewer.css

1a4bfd2fc3822f364b70213038a49f8500b82c4d by Jonas Jenwald
Authored: 2023-07-15 09:08:32 +0200
Committed: 2023-07-15 10:44:30 +0200

Update npm packages

Note that while some packages increased the major version, it doesn't appear to cause any breakage as far as I can tell.

Files Modified:

  • package-lock.json
  • package.json

5a692b2c33f07151228f3744dc98bcfcff266a63 by Calixte Denizet
Authored: 2023-07-13 20:36:16 +0200
Committed: 2023-07-13 20:36:23 +0200

[Editor] Resize the image when the page is zoomed

In order to reproduce the issue:

  • scale down the image
  • zoom the page and the image is pixellated
    So this patch allow to redraw the image when zooming.

Files Modified:

  • src/display/editor/stamp.js

ed42577d9ccd8bdfb8e66ef1a8a104b65cb35cdb by Calixte Denizet
Authored: 2023-07-13 13:03:42 +0200
Committed: 2023-07-13 14:10:28 +0200

[Editor] Always use the data url when loading a SVG in order to avoid CSP issue (bug 1843255)

Files Modified:

  • src/display/editor/tools.js

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 2a508b95e185d190ce1e65e8e364997a279ae46f r=pdfjs-reviewers,robwu
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Regressions: 1844928
You need to log in before you can comment on or make changes to this bug.