Closed Bug 1839774 Opened 8 months ago Closed 8 months ago

Update PDF.js to new version 03059e1f866e4c0b587607f879dc1a26f8b26820 from 2023-06-21 20:18:26


(Firefox :: PDF Viewer, enhancement)




116 Branch
Tracking Status
firefox116 --- fixed


(Reporter: update-bot, Assigned: calixte)


(Blocks 2 open bugs)


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


(1 file)

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

toolkit/components/pdfjs/content/build/pdf.js | 574 +++++++++----
toolkit/components/pdfjs/content/build/pdf.scripting.js | 4 +-
toolkit/components/pdfjs/content/build/pdf.worker.js | 45 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.css | 37 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.js | 89 +-
toolkit/components/pdfjs/content/web/viewer.css | 37 +-
toolkit/components/pdfjs/content/web/viewer.js | 89 +-
toolkit/components/pdfjs/moz.yaml | 4 +-
8 files changed, 476 insertions(+), 403 deletions(-)

fe1c36a0ed1a745283b3a5e065193e2e2f75aa21 by Jonas Jenwald
Authored: 2023-06-20 21:26:59 +0200
Committed: 2023-06-21 21:42:53 +0200

Move the fixupLangCode helper function into the web/genericl10n.js file

This helper function was added almost two years ago, in PR 13696, and it still has only a single call-site. Furthermore, with the changes made in PR 16572 it also cannot hurt to reduce the size of the web/l10n_utils.js file slightly.

Files Modified:

  • web/genericl10n.js
  • web/l10n_utils.js

5c0872d1b09440f729168503b799cddcc3befc49 by Jonas Jenwald
Authored: 2023-06-21 19:53:30 +0200
Committed: 2023-06-21 20:14:46 +0200

[Firefox] Avoid unnecessary string-parsing when reading preferences

Note how the ChromeActions.getPreferences method returns the preferences as a string, which we then have to convert back into an Object in the viewer.
Back when that code was originally written it wasn't possible to send Objects from the platform-code, however that's no longer the case and we should be able to (eventually) remove this unnecessary string-parsing now.

Please note that in order to prevent breakage we'll need to land these changes in stages:

  • Land this patch in mozilla-central, as part of regular the PDF.js updates.
  • Change the return type in the ChromeActions.getPreferences method, in a mozilla-central patch.
  • Remove the string-handling from the FirefoxPreferences._readFromStorage method.

Files Modified:

  • web/firefoxcom.js

1f9d1f369609fac818ddadb5c51ed94ea7e46f6a by Jonas Jenwald
Authored: 2023-06-21 18:28:35 +0200
Committed: 2023-06-21 20:14:16 +0200

[Firefox] Disable the ability to change preferences directly from the viewer

Please note that we've never had any functionality in the viewer itself that set preferences, and we've thus only ever read them.
For the GENERIC viewer it obviously makes sense for the user to be able to modify preferences, e.g. via the console, but that doesn't really apply to the built-in Firefox PDF Viewer since preferences are already accessible via about:config there. Hence it does seems somewhat strange to expose, a limited part of, the Firefox preference system in this way when we're not even using it.

Note that the unused preference setting-code also include a fair amount of additional validation on the platform-side, such as limiting any possible preference changes to the pdfjs.-branch and also an explicit white-list of preference names[1], to make sure that this is safe; please see:

Assuming that this patch lands, I'll follow-up with a mozilla-central patch to remove the code mentioned above.

[1] This hard-coded list contains preferences that no longer exist, and also at least one (fairly obvious) typo.

Files Modified:

  • web/firefoxcom.js
  • web/preferences.js

fe869aca3823f2b5e0ff8b69b2ab07857cb02a11 by Jonas Jenwald
Authored: 2023-06-21 14:47:29 +0200
Committed: 2023-06-21 14:47:29 +0200

Simplify the sign handling in the Lexer.getNumber method

After the changes in PR 15606, we can (slightly) simplify the sign handling.

Files Modified:

  • src/core/parser.js

7f53fb82a5a85a49bd57a37fcfd3dceca6150976 by Jonas Jenwald
Authored: 2023-06-21 13:13:53 +0200
Committed: 2023-06-21 13:13:53 +0200

Remove the OverlayManager.unregister method since it's completely unused

This method was added only for consistency with the register-method, however it's never actually been used. To avoid including dead code in the builds, let's just remove the unregister-method for now.

Please note: If this method ever becomes useful, it'll be trivial to revert this commit.

Files Modified:

  • web/overlay_manager.js

8ae1c8dd813f1466f475b9a388105e803c2d55ad by Calixte Denizet
Authored: 2023-06-21 10:41:19 +0200
Committed: 2023-06-21 12:30:05 +0200

[Editor] Hide visible popups when editing

Files Modified:

  • src/display/annotation_layer.js
  • test/integration/freetext_editor_spec.js

19f7a8b89919e09a3a463c2c78e099c82d5c84ea by Calixte Denizet
Authored: 2023-06-21 11:07:14 +0200
Committed: 2023-06-21 11:48:20 +0200

[Editor] Don't make editable an empty freetext annotation

Files Modified:

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

19880fcf9ac8cbbafee3aab2993aca2338f3b370 by Jonas Jenwald
Authored: 2023-06-20 16:46:51 +0200
Committed: 2023-06-20 20:28:35 +0200

[api-minor] Move the l10n-translation into the AnnotationLayer

With the changes in PR 16552 we can now move general translation into the AnnotationLayer itself, which should improve things ever so slightly in third-party implementations where the default viewer isn't used.

Files Modified:

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

197e806c8605bf5f8e5c451cf4297e79054e20b6 by Jonas Jenwald
Authored: 2023-06-20 16:44:09 +0200
Committed: 2023-06-20 20:28:29 +0200

[api-minor] Ensure that the AnnotationLayer gets a default l10n-instance in GENERIC builds (PR 16552 follow-up)

This is something that I completely overlooked during review of PR 16552, despite leaving a l10n-related comment.

The new l10n-handling of PopupAnnotations assume that the AnnotationLayer is always initialized with a l10n-instance, which might not actually be the case in third-party implementations where the default viewer isn't used.
To work-around that we'll now bundle, and fallback on, the existing NullL10n-implementation in GENERIC builds of the PDF.js library. This will only result in a slight file-size increase for the built pdf.js file, again limited to GENERIC builds, since the web/l10n_utils.js file has no dependencies.

Also, tweaks a couple of TESTING pre-processor checks to only include that code when running the reference tests.

Files Modified:

  • src/display/annotation_layer.js
  • web/l10n_utils.js

5ffaa6416791089b5ffcd18ac433e9aca2bb95f0 by Calixte Denizet
Authored: 2023-06-20 17:36:31 +0200
Committed: 2023-06-20 17:52:20 +0200

Fix integration tests

Files Modified:

  • test/integration/annotation_spec.js

d1e172458fea9f94d044620bd7fd6ab70ba03d5b by Calixte Denizet
Authored: 2023-06-15 11:59:59 +0200
Committed: 2023-06-20 15:30:39 +0200

[api-minor] Make the popup independent of their associated annotations

  • it'll help to be able to move popups on screen to let the user read the text
  • popups won't inherit some properties from their parent:
    • the popup can be misrendered if for example the parent has a clip-path property.
  • add an outline to the popup when the parent is focused.
  • hide a popup when it's clicked.

Files Modified:

  • src/core/annotation.js
  • src/display/annotation_layer.js
  • src/display/editor/freetext.js
  • test/annotation_layer_builder_overrides.css
  • test/driver.js
  • test/integration/annotation_spec.js
  • test/unit/annotation_spec.js
  • web/annotation_layer_builder.css
  • web/annotation_layer_builder.js

ae3cee95a6df3b561875bc65f6e0b5578d6faf3e by Calixte Denizet
Authored: 2023-06-19 21:31:26 +0200
Committed: 2023-06-19 23:03:45 +0200

[Editor] Show hidden annotations once editing is finished

Files Modified:

  • src/display/editor/annotation_editor_layer.js
  • test/integration/annotation_spec.js

5c0054d58dc0ea3b8869a7c62311fe19a7a18656 by Calixte Denizet
Authored: 2023-06-16 18:45:09 +0200
Committed: 2023-06-16 18:45:09 +0200

Guess that a checkbox belongs to a group in using its T value (bug 1838855)

Files Modified:

  • src/core/annotation.js
  • src/core/document.js
  • src/display/annotation_layer.js
  • test/integration/annotation_spec.js
  • test/unit/api_spec.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 03059e1f866e4c0b587607f879dc1a26f8b26820 r=pdfjs-reviewers,calixte
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
Regressions: 1847733
Regressions: 1849876
See Also: → 1852779
You need to log in before you can comment on or make changes to this bug.