Closed Bug 1776538 Opened 3 years ago Closed 3 years ago

Update PDF.js to new version cd35b9bfac85c00238cf0fa0f657a780f2a5ead6 from 2022-06-24 17:10:11

Categories

(Firefox :: PDF Viewer, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox103 --- wontfix
firefox104 --- fixed

People

(Reporter: update-bot, Assigned: update-bot)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 file)

This update covers 25 commits:


6e46226cd72aa92a42f26154d44aa6c56de55db4 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/6e46226cd72aa92a42f26154d44aa6c56de55db4
Authored: 2022-06-24 18:55:35 +0200
Committed: 2022-06-24 18:55:35 +0200

Fix unit test (#15093 follow-up)

Files Added:

  • test/unit/scripting_spec.js
  • test/unit/scripting_spec.js

c48dc251e07482973ab14036d971cb00a241571a by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/c48dc251e07482973ab14036d971cb00a241571a
Authored: 2022-06-24 14:39:08 +0200
Committed: 2022-06-24 15:19:56 +0200

Add (basic) support for Optional Content in Annotations

Given that Annotations can also have an OC-entry, we need to take that into account when generating their operatorLists.

Note that in order to simplify the patch the getOperatorList-methods, for the Annotation-classes, were converted to be async.

Files Added:

  • src/core/annotation.js
  • test/test_manifest.json
  • src/core/annotation.js
  • test/test_manifest.json

a334a21a1d6324637f4df37a29dfd087fd4559b3 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/a334a21a1d6324637f4df37a29dfd087fd4559b3
Authored: 2022-06-24 14:23:06 +0200
Committed: 2022-06-24 14:23:06 +0200

[JS] Update siblings when a field is updated after a calculation (#15092)

Files Added:

  • test/pdfs/issue15092.pdf
  • test/pdfs/issue15092.pdf

Files Added:

  • src/scripting_api/doc.js
  • src/scripting_api/event.js
  • test/integration/scripting_spec.js
  • test/pdfs/.gitignore
  • src/scripting_api/doc.js
  • src/scripting_api/event.js
  • test/integration/scripting_spec.js
  • test/pdfs/.gitignore

e49d03985347f9e116eec882d9fc0eab5fa4aca6 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/e49d03985347f9e116eec882d9fc0eab5fa4aca6
Authored: 2022-06-23 16:27:03 +0200
Committed: 2022-06-23 17:39:12 +0200

Correctly order added annotations when saving or printing

  • the annotations must be rendered in the same order as the chronological one.
  • fix a bug in document.js which avoids to read a saved pdf correctly in Acrobat:
    there is no need to reset the xref state: it's done in worker.js once everything
    has been saved.

Files Added:

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

1cc7cecc7b933cf3fdb2ca6e4bcb55f831ed7410 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/1cc7cecc7b933cf3fdb2ca6e4bcb55f831ed7410
Authored: 2022-06-13 13:35:58 +0200
Committed: 2022-06-23 17:06:46 +0200

[api-minor] Introduce a PrintAnnotationStorage with frozen serializable data

Given that printing is triggered synchronously in browsers, it's thus possible for scripting (in PDF documents) to modify the Annotation-data while printing is currently ongoing.
To work-around that we add a new printing-specific AnnotationStorage, where the serializable data is frozen upon initialization, which the viewer can thus create/utilize during printing.

Files Added:

  • src/display/annotation_storage.js
  • src/display/api.js
  • test/unit/api_spec.js
  • web/app.js
  • web/firefox_print_service.js
  • web/pdf_print_service.js
  • src/display/annotation_storage.js
  • src/display/api.js
  • test/unit/api_spec.js
  • web/app.js
  • web/firefox_print_service.js
  • web/pdf_print_service.js

30c63eb0ec5e99547c3f452590c28e02367b580c by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/30c63eb0ec5e99547c3f452590c28e02367b580c
Authored: 2022-06-22 11:46:02 +0200
Committed: 2022-06-22 13:26:09 +0200

[Editor] Add support for printing newly added FreeText annotations

Files Added:

  • src/core/annotation.js
  • test/unit/annotation_spec.js
  • test/unit/test_utils.js
  • src/core/annotation.js
  • test/unit/annotation_spec.js
  • test/unit/test_utils.js

d7c9a0a79389a12aa36d308205b93c354d2b4ce6 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/d7c9a0a79389a12aa36d308205b93c354d2b4ce6
Authored: 2022-06-22 11:06:11 +0200
Committed: 2022-06-22 11:06:11 +0200

Fix (obvious) typo in typedef-import of IPDFXfaLayerFactory (PR 14373 follow-up)

This only affects the viewer-components TypeScript definitions, and not any actual code.

Files Added:

  • web/pdf_page_view.js
  • web/pdf_page_view.js

f27c8c4471eb1a9f0cace160d2f1ce49d6455488 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/f27c8c4471eb1a9f0cace160d2f1ce49d6455488
Authored: 2022-06-15 16:57:33 +0200
Committed: 2022-06-21 18:21:49 +0200

[Editor] Add support for printing newly added Ink annotations

Files Added:

  • src/core/annotation.js
  • src/core/core_utils.js
  • src/core/document.js
  • src/core/worker.js
  • test/test_manifest.json
  • test/unit/annotation_spec.js
  • src/core/annotation.js
  • src/core/core_utils.js
  • src/core/document.js
  • src/core/worker.js
  • test/test_manifest.json
  • test/unit/annotation_spec.js

cdc58b7a527d8ab6b2b68186e519ad700389def3 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/cdc58b7a527d8ab6b2b68186e519ad700389def3
Authored: 2022-06-19 16:39:54 +0200
Committed: 2022-06-21 17:57:26 +0200

Rotate annotations based on the MK::R value (bug 1675139)

Files Added:

Files Added:

  • src/core/annotation.js
  • src/display/annotation_layer.js
  • src/scripting_api/field.js
  • test/integration/scripting_spec.js
  • test/pdfs/.gitignore
  • test/test_manifest.json
  • test/unit/annotation_spec.js
  • test/unit/api_spec.js
  • web/annotation_layer_builder.css
  • src/core/annotation.js
  • src/display/annotation_layer.js
  • src/scripting_api/field.js
  • test/integration/scripting_spec.js
  • test/pdfs/.gitignore
  • test/test_manifest.json
  • test/unit/annotation_spec.js
  • test/unit/api_spec.js
  • web/annotation_layer_builder.css

1c9a702f73c481e4a44722479f0b76009b0acbcf by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/1c9a702f73c481e4a44722479f0b76009b0acbcf
Authored: 2022-06-21 16:54:32 +0200
Committed: 2022-06-21 16:54:32 +0200

Enable the prefer-array-index-of ESLint plugin rule

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md

Files Added:

  • .eslintrc
  • src/core/xfa/template.js
  • .eslintrc
  • src/core/xfa/template.js

35a6a508ee5bbfd1779f55494314d7cbd1cfed9a by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/35a6a508ee5bbfd1779f55494314d7cbd1cfed9a
Authored: 2022-06-20 18:08:41 +0200
Committed: 2022-06-21 11:54:09 +0200

[editor] Support disabling of editing when pdfjs.enablePermissions is set (issue 15049)

For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the pdfjs.enablePermissions preference is set to true (since PDF document permissions could be seen as user hostile).[1]

As I started looking at the issue, it soon became clear that only trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!

  • Use a new AnnotationEditorUIManager-instance for each PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.

  • Re-factor the BaseViewer.#initializePermissions-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).

  • When editing is enabled, let the Editor-buttons be disabled until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.

  • Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.

  • Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)

  • Enable editing by default in the development viewer, i.e. gulp server, since having to (repeatedly) do that manually becomes annoying after a while.

  • Finally, support disabling of editing when pdfjs.enablePermissions is set; fixes issue 15049.


[1] Either manually with about:config, or using e.g. a Group Policy.

Files Added:

  • web/app.js
  • web/app_options.js
  • web/base_viewer.js
  • web/toolbar.js
  • web/viewer.html
  • web/viewer.js
  • web/app.js
  • web/app_options.js
  • web/base_viewer.js
  • web/toolbar.js
  • web/viewer.html
  • web/viewer.js

c44ab94d2887c7c06c8ff83bb20fa0832021f2de by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/c44ab94d2887c7c06c8ff83bb20fa0832021f2de
Authored: 2022-06-20 22:24:04 +0200
Committed: 2022-06-20 22:24:04 +0200

Only activate ink editor if none is selected

Files Added:

  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/tools.js
  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/tools.js

fd209d9685188171e73f656821731242c3347eb5 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/fd209d9685188171e73f656821731242c3347eb5
Authored: 2022-06-20 10:20:49 +0200
Committed: 2022-06-20 21:23:30 +0200

Add an outline around popup trigger areas in ref-tests

  • The goal is to avoid any future regressions.

Files Added:

  • test/annotation_layer_builder_overrides.css
  • test/annotation_layer_builder_overrides.css

7cce3fb6ff1f86ab75a74fc8f0fd93997af461f4 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/7cce3fb6ff1f86ab75a74fc8f0fd93997af461f4
Authored: 2022-06-19 17:19:35 +0200
Committed: 2022-06-20 09:38:46 +0200

Ensure that the annotationLayer has the correct dimensions (PR 15036 follow-up)

Note how the "page"-div, "canvasWrapper"-div, and textLayer-div all have integer dimensions (rounded down) rather than using the "raw" viewport-dimensions.
Hence it seems reasonable that the same should apply to the "annotationLayer"-div, now that it's explicit dimensions set.

Files Added:

  • src/display/annotation_layer.js
  • src/display/annotation_layer.js

2ff65dd514c75ec5d39493d8b4cd22bf19801687 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/2ff65dd514c75ec5d39493d8b4cd22bf19801687
Authored: 2022-06-19 22:44:58 +0200
Committed: 2022-06-19 22:44:58 +0200

Popup trigger area must filled its parent (fix #15063)

Files Added:

  • src/display/annotation_layer.js
  • web/annotation_layer_builder.css
  • src/display/annotation_layer.js
  • web/annotation_layer_builder.css

af47a0b7e033a2e2437f4f0677a8bdd1bb882290 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/af47a0b7e033a2e2437f4f0677a8bdd1bb882290
Authored: 2022-06-19 20:09:24 +0200
Committed: 2022-06-19 22:09:02 +0200

Avoid having overflowing sections (#15036 follow-up)

Files Added:

  • src/display/annotation_layer.js
  • web/annotation_layer_builder.css
  • src/display/annotation_layer.js
  • web/annotation_layer_builder.css

57c10ac21397d58c0d702187d04b3bc1a9944722 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/57c10ac21397d58c0d702187d04b3bc1a9944722
Authored: 2022-06-19 17:46:59 +0200
Committed: 2022-06-19 18:21:51 +0200

Simplify the newRefs computation in the "SaveDocument"-handler in the worker-thread

  • Let the Page.save-method filter out "empty" entries, similar to the Page._parsedAnnotations-getter, since that on its own already simplifies the "SaveDocument"-handler a tiny bit.

  • The existing reduce and concat construction isn't exactly a wonder of readability :-)
    Thanks to modern JavaScript features it should be possible to replace all of this with Array.prototype.flat() instead, which at least to me feels a lot easier to understand.

Files Added:

  • src/core/document.js
  • src/core/worker.js
  • src/core/document.js
  • src/core/worker.js

c21f4faaf80f6ba3411cb07969322ec61988f987 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/c21f4faaf80f6ba3411cb07969322ec61988f987
Authored: 2022-06-19 12:26:48 +0200
Committed: 2022-06-19 13:40:52 +0200

Reduce unnecessary usage of Array.prototype.concat()

There are obviously cases where using concat makes perfect sense, since that method doesn't change any of the existing Arrays; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

However, in a few cases throughout the code-base that's not an issue and using concat only leads to unnecessary intermediate allocations. With modern JavaScript we can thus replace those with a combination of push and spread-syntax, which wasn't originally possible when the code was written.

Files Added:

  • external/builder/preprocessor2.js
  • src/core/cff_parser.js
  • src/core/jbig2.js
  • src/display/text_layer.js
  • external/builder/preprocessor2.js
  • src/core/cff_parser.js
  • src/core/jbig2.js
  • src/display/text_layer.js

caaa78f7daa1f20fd3d681902de1b20a0cb1408e by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/caaa78f7daa1f20fd3d681902de1b20a0cb1408e
Authored: 2022-06-19 09:57:05 +0200
Committed: 2022-06-19 09:57:05 +0200

[api-minor] Remove the "baseviewerinit" event since it's unused (PR 14324 follow-up)

Given that neither the viewer or the examples listen for this event, it seems unnecessary to keep dispatching it.

Files Added:

  • web/base_viewer.js
  • web/base_viewer.js

e2db9bacefd45d1eb20258980e36d163ce261177 by Calixte Denizet

https://github.com/mozilla/pdf.js-/commit/e2db9bacefd45d1eb20258980e36d163ce261177
Authored: 2022-06-13 11:01:55 +0200
Committed: 2022-06-18 17:54:59 +0200

Get rid of CSS transform on each annotation in the annotation layer

  • each annotation has its coordinates/dimensions expressed in percentage,
    hence it's correctly positioned whatever the scale factor is;
  • the font sizes are expressed in percentage too and the main font size
    is scaled thanks a css var (--scale-factor);
  • the rotation is now applied on the div annotationLayer;
  • this patch improve the rendering of some strings where the glyph spacing
    was not correct (it's a Firefox bug);
  • it helps to simplify the code and it should slightly improve the update of
    page (on zoom or rotation).

Files Added:

  • src/core/annotation.js
  • src/core/xfa/template.js
  • src/core/xfa/xhtml.js
  • src/display/annotation_layer.js
  • src/display/base_factory.js
  • src/display/canvas.js
  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/freetext.js
  • test/annotation_layer_builder_overrides.css
  • test/driver.js
  • test/integration/freetext_editor_spec.js
  • web/annotation_editor_layer_builder.css
  • web/annotation_layer_builder.css
  • web/annotation_layer_builder.js
  • web/base_viewer.js
  • web/pdf_page_view.js
  • web/pdf_viewer.css
  • src/core/annotation.js
  • src/core/xfa/template.js
  • src/core/xfa/xhtml.js
  • src/display/annotation_layer.js
  • src/display/base_factory.js
  • src/display/canvas.js
  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/freetext.js
  • test/annotation_layer_builder_overrides.css
  • test/driver.js
  • test/integration/freetext_editor_spec.js
  • web/annotation_editor_layer_builder.css
  • web/annotation_layer_builder.css
  • web/annotation_layer_builder.js
  • web/base_viewer.js
  • web/pdf_page_view.js
  • web/pdf_viewer.css

03757d82b70dc60a261d44eb726654adfeacabad by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/03757d82b70dc60a261d44eb726654adfeacabad
Authored: 2022-06-17 22:01:20 +0200
Committed: 2022-06-18 16:43:05 +0200

Replace element ids with custom attributes for Widget-annotations (issue 15056)

We want to avoid adding regular ids to Annotation-elements, since that means that they become "linkable" through the URL hash in a way that's not supported/intended. This could end up clashing with "named destinations", and that could easily lead to bugs; see issue 11499 and PR 11503 for some context.

Rather than using ids, we'll instead use a custom data-element-id attribute such that it's still possible to access the Annotation-elements directly.
Unfortunately these changes required updating most of the integration-tests, and to reduce the amount of repeated code a couple of helper functions were added.

Files Added:

  • src/display/annotation_layer.js
  • test/integration/annotation_spec.js
  • test/integration/scripting_spec.js
  • test/integration/test_utils.js
  • web/pdf_scripting_manager.js
  • src/display/annotation_layer.js
  • test/integration/annotation_spec.js
  • test/integration/scripting_spec.js
  • test/integration/test_utils.js
  • web/pdf_scripting_manager.js

77aa86e275897be4cfa816be1a68ef663a93e311 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/77aa86e275897be4cfa816be1a68ef663a93e311
Authored: 2022-06-17 11:25:55 +0200
Committed: 2022-06-18 09:43:35 +0200

Stop defining the defaultUrl-option in the MOZCENTRAL viewer

This option is not used, nor has it ever been used, in the built-in Firefox PDF Viewer. Hence we can define it only for the environments where it makes sense instead.

Files Added:

  • web/app_options.js
  • web/app_options.js

abcc32ade08e2d0a1de70874038ad0db988f5c7e by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/abcc32ade08e2d0a1de70874038ad0db988f5c7e
Authored: 2022-06-17 11:18:26 +0200
Committed: 2022-06-18 09:43:23 +0200

Simplify setting the defaultUrl-option in the CHROME viewer (PR 12470 follow-up)

This should really have been done as part of PR 12470, since it's now possible to directly set the defaultUrl-option without having to fallback to var-usage.

Files Added:

  • web/viewer.js
  • web/viewer.js

a19feac21752100c81fca1d5ab81a9c140322243 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/a19feac21752100c81fca1d5ab81a9c140322243
Authored: 2022-06-16 16:51:33 +0200
Committed: 2022-06-16 16:51:33 +0200

Reduce some duplication for AppOptions that use compatibilityParams

We can check for a relevant compatibilityParams-entry directly in AppOptions.{get, getAll} instead, which removes some unnecessary duplication.

Files Added:

  • web/app_options.js
  • web/app_options.js

df79b18a31e7937c94bae7d88c088c300561c975 by Jonas Jenwald

https://github.com/mozilla/pdf.js-/commit/df79b18a31e7937c94bae7d88c088c300561c975
Authored: 2022-06-16 16:11:47 +0200
Committed: 2022-06-16 16:11:47 +0200

Only define the renderer-option in the GENERIC viewer

Given that the SVG back-end is not defined anywhere except in GENERIC builds, we can remove a little bit of unnecessary code in e.g. the Firefox PDF Viewer.

Files Added:

  • web/app.js
  • web/app_options.js
  • web/pdf_page_view.js
  • web/app.js
  • web/app_options.js
  • web/pdf_page_view.js

Assignee: nobody → update-bot
Status: NEW → ASSIGNED
Pushed by cdenizet@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3c7ce7dadf3a Update PDF.js to cd35b9bfac85c00238cf0fa0f657a780f2a5ead6 r=pdfjs-reviewers,marco
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch

We should consider this for ESR uplift given that it fixed bug 1675139 which was affecting PDFs from Deutsche Post.

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).

Resolution: FIXED → DUPLICATE
Resolution: DUPLICATE → FIXED
Regressions: 1777693
Regressions: 1796544
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: