Closed Bug 1824983 Opened 2 years ago Closed 2 years ago

Update PDF.js to new version d584513cb29816016cc62afbdf8ed417b402aa25 from 2023-03-28 10:40:23

Categories

(Firefox :: PDF Viewer, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1826399
Tracking Status
firefox113 --- affected

People

(Reporter: update-bot, Assigned: calixte)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 obsolete file)

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


toolkit/components/pdfjs/content/build/pdf.js | 29 +-
toolkit/components/pdfjs/content/build/pdf.sandbox.external.js | 144 ----------
toolkit/components/pdfjs/content/build/pdf.sandbox.external.sys.mjs | 141 +++++++++
toolkit/components/pdfjs/content/build/pdf.scripting.js | 14 +-
toolkit/components/pdfjs/content/build/pdf.worker.js | 120 ++++---
toolkit/components/pdfjs/content/web/debugger.css | 5 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.css | 28 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.js | 61 ++--
toolkit/components/pdfjs/content/web/viewer.css | 44 +--
toolkit/components/pdfjs/content/web/viewer.js | 61 ++--
toolkit/components/pdfjs/moz.yaml | 4 +-
11 files changed, 307 insertions(+), 344 deletions(-)


5f5256b4c4613357034b5e1d4b93bbf48ad23492 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/5f5256b4c4613357034b5e1d4b93bbf48ad23492
Authored: 2023-03-27 11:40:58 +0200
Committed: 2023-03-27 12:01:31 +0200

ESMify some modules for m-c (bug 1824610)

Files Modified:

  • gulpfile.js
  • src/pdf.sandbox.external.js

Files Changed:

  • R085 extensions/firefox/content/PdfJsDefaultPreferences.jsm

20cbb894125c5e58e0481dbdc0b1fe2e761a2cbe by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/20cbb894125c5e58e0481dbdc0b1fe2e761a2cbe
Authored: 2023-03-27 11:34:20 +0200
Committed: 2023-03-27 11:34:20 +0200

Simplify the isPDFFunction helper function

Originally we used helper functions for checking if something was a Dictionary or Stream, and then having an initial typeof check probably made sense.
However, given that we're using instanceof nowadays the additional check longer seems necessary.

Files Modified:

  • src/core/function.js

ef70988027598d591481c533100cd9613ea642af by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/ef70988027598d591481c533100cd9613ea642af
Authored: 2023-03-25 13:25:44 +0100
Committed: 2023-03-26 12:12:49 +0200

Reduce duplication in the validateCSSFont helper function

Currently we're virtually duplicating the same code, for validating quotation marks, twice in this helper function.

The size decrease is quite small (107 bytes) and this makes the code slightly harder to reader, hence I completely understand if this patch is rejected.

Files Modified:

  • src/core/core_utils.js

71fdf804de226cafb1d4b7ae7d2ecc3c02d9fe03 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/71fdf804de226cafb1d4b7ae7d2ecc3c02d9fe03
Authored: 2023-03-26 10:35:19 +0200
Committed: 2023-03-26 10:35:19 +0200

[GeckoView] Remove unused transition CSS-rules

Given that the GeckoView-viewer doesn't have a sidebar, there's no reason to have CSS-rules for it (and the variables are also undefined).

Files Modified:

  • web/viewer-geckoview.css

007c367018fe9df26b6e5c61d9c057fb1d8597f1 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/007c367018fe9df26b6e5c61d9c057fb1d8597f1
Authored: 2023-03-25 20:46:02 +0100
Committed: 2023-03-25 20:46:02 +0100

Fix spelling of occurred in a couple of comments

Files Modified:

  • src/display/editor/annotation_editor_layer.js
  • web/pdf_viewer.js

035a273d3008ee234a8e5913bf38744c13bb53c3 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/035a273d3008ee234a8e5913bf38744c13bb53c3
Authored: 2023-03-25 12:31:39 +0100
Committed: 2023-03-25 12:31:39 +0100

Use replaceAll in the recoverJsURL helper function

We can just do direct replacement when building the regular expression, rather than splitting the string into an Array and then re-joining it.

Files Modified:

  • src/core/core_utils.js

a4dfa04a0b91595fb3a1c1e68b81f15122a2f451 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/a4dfa04a0b91595fb3a1c1e68b81f15122a2f451
Authored: 2023-03-25 10:04:29 +0100
Committed: 2023-03-25 10:08:27 +0100

Enable the declaration-block-no-redundant-longhand-properties Stylelint rule

Note that these changes were done automatically, using gulp lint --fix.
This rule will help avoid unnecessary repetition in the CSS; please see https://stylelint.io/user-guide/rules/declaration-block-no-redundant-longhand-properties/

Files Modified:

  • .stylelintrc
  • examples/mobile-viewer/viewer.css
  • test/resources/reftest-analyzer.css
  • web/debugger.css

a8af946bdc5e70f193be2116d921c6f17d9bb1af by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/a8af946bdc5e70f193be2116d921c6f17d9bb1af
Authored: 2023-03-25 09:46:07 +0100
Committed: 2023-03-25 09:46:07 +0100

Update l10n files

Files Modified:

  • l10n/sc/viewer.properties

ee15ec91449c758049b3ce8fd535784bffd8f26c by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/ee15ec91449c758049b3ce8fd535784bffd8f26c
Authored: 2023-03-25 09:41:15 +0100
Committed: 2023-03-25 09:41:15 +0100

Update npm packages

Files Modified:

  • package-lock.json
  • package.json

96e34fbb7d7bb556392646a7a6720182953ac275 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/96e34fbb7d7bb556392646a7a6720182953ac275
Authored: 2023-03-21 11:37:46 +0100
Committed: 2023-03-24 10:18:32 +0100

Enable the unicorn/prefer-negative-index ESLint plugin rule

Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md

Files Modified:

  • .eslintrc
  • src/core/core_utils.js
  • src/core/type1_parser.js
  • src/core/xfa/utils.js
  • src/core/xfa/xfa_object.js

378caa72039667566cef5a0b7863c7dbfb882489 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/378caa72039667566cef5a0b7863c7dbfb882489
Authored: 2023-03-23 14:02:02 +0100
Committed: 2023-03-23 14:07:10 +0100

Slightly reduce the size of the FontInspector-integration in the API

Given that this functionality only applies in the viewer, when PDFBug is being enabled and used, it can't hurt to slightly reduce the size of this code.

Files Modified:

  • src/display/api.js
  • src/display/font_loader.js

1fc09f02355df3c9303bf9720116562b9be86063 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/1fc09f02355df3c9303bf9720116562b9be86063
Authored: 2023-03-23 12:34:08 +0100
Committed: 2023-03-23 12:57:10 +0100

Enable the unicorn/prefer-string-replace-all ESLint plugin rule

Note that the replaceAll method still requires that a global regular expression is used, however by using this method it's immediately obvious when looking at the code that all occurrences will be replaced; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#parameters

Please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md

Files Modified:

  • .eslintrc
  • extensions/firefox/tools/l10n.js
  • external/builder/builder.js
  • external/builder/test-fixtures.js
  • external/builder/test-fixtures_esprima.js
  • external/cmapscompress/parse.js
  • external/importL10n/locales.js
  • gulpfile.js
  • src/core/core_utils.js
  • src/core/document.js
  • src/core/evaluator.js
  • src/core/fonts.js
  • src/core/fonts_utils.js
  • src/core/metadata_parser.js
  • src/core/xfa/fonts.js
  • src/core/xfa/template.js
  • src/core/xfa/xhtml.js
  • src/core/xml_parser.js
  • src/display/content_disposition.js
  • src/scripting_api/aform.js
  • src/scripting_api/util.js
  • test/unit/xml_spec.js
  • test/webserver.js
  • web/l10n_utils.js
  • web/pdf_find_controller.js
  • web/ui_utils.js

56b46996508cbfb7e3aa5cf690b809322f5b52f1 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/56b46996508cbfb7e3aa5cf690b809322f5b52f1
Authored: 2023-03-23 09:00:54 +0100
Committed: 2023-03-23 09:25:23 +0100

Reduce some duplication in the PDFViewer.{increaseScale, decreaseScale} methods

  • Reduce a little bit of duplication by enforcing the max/min scale-values once, at the end, in the increaseScale/decreaseScale methods.
  • Convert the "private" PDFViewer scale-related methods into actually private ones, now that JavaScript supports that.

Files Modified:

  • web/pdf_viewer.js

5f64621d46339b2548e10d387eeddfa3e261d064 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/5f64621d46339b2548e10d387eeddfa3e261d064
Authored: 2023-03-22 15:31:10 +0100
Committed: 2023-03-22 15:31:10 +0100

Use String.prototype.replaceAll() where appropriate

This fairly new method allows replacing multiple occurrences within a string without having to use regular expressions.

Please refer to:

Files Modified:

  • external/builder/test-fixtures.js
  • external/builder/test-fixtures_esprima.js
  • external/importL10n/locales.js
  • src/core/catalog.js
  • src/core/core_utils.js
  • src/core/file_spec.js
  • src/display/content_disposition.js
  • test/unit/ui_utils_spec.js
  • web/pdf_link_service.js
  • web/ui_utils.js

137a2d6e30f9473ca45ae4be5088fd875316ab57 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/137a2d6e30f9473ca45ae4be5088fd875316ab57
Authored: 2023-03-22 10:40:12 +0100
Committed: 2023-03-22 10:42:52 +0100

Add even more non-standard ligatures (PR 15517 follow-up)

Given that we already create multi-byte ToUnicode entries in other cases, see e.g. the getNormalizedUnicodes table, this is hopefully fine.

Files Modified:

  • src/core/evaluator.js
  • test/test_manifest.json
  • test/unit/api_spec.js

7f80052fdfa78cc65341228ccd67786fe17c5793 by Nicolas Chevobbe

https://github.com/mozilla/pdf.js/commit/7f80052fdfa78cc65341228ccd67786fe17c5793
Authored: 2023-03-22 09:49:24 +0100
Committed: 2023-03-22 09:49:43 +0100

Use cursor:move for draggable texts and drawings (Bug 1804252)

Files Modified:

  • web/annotation_editor_layer_builder.css

122d5e549a28d6b4909ca51525fc02c8260f376c by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/122d5e549a28d6b4909ca51525fc02c8260f376c
Authored: 2023-03-22 09:38:00 +0100
Committed: 2023-03-22 09:41:19 +0100

Track previous "XRefStm"s in a Set, rather than an Object

Having just reviewed a patch touching this code, I couldn't help noticing that an Object isn't really the optimal data-structure for this and nowadays we can do better by using a Set instead.

Files Modified:

  • src/core/xref.js

d4bcfe8c16aec6c9c944437e9ae91a2a2a7e7981 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/d4bcfe8c16aec6c9c944437e9ae91a2a2a7e7981
Authored: 2023-03-21 12:24:21 +0100
Committed: 2023-03-21 21:35:57 +0100

Support multi-byte ToUnicode entries, when using predefined CMaps (issue 16176)

Hopefully this makes sense, since we already "create" multi-byte ToUnicode entries in other cases (see e.g. the getNormalizedUnicodes table).

Files Added:

  • test/pdfs/issue16176.pdf

Files Modified:

  • src/core/evaluator.js
  • test/pdfs/.gitignore
  • test/unit/api_spec.js

2d0f30a67c97657194a6e9d77cb6eafbf9172183 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/2d0f30a67c97657194a6e9d77cb6eafbf9172183
Authored: 2023-03-21 18:14:43 +0100
Committed: 2023-03-21 19:27:24 +0100

Use the position of the previous xref stream if any when saving a pdf (bug 1823296)

Files Added:

Files Modified:

  • src/core/worker.js
  • src/core/xref.js
  • src/display/api.js
  • test/test_manifest.json
  • test/unit/api_spec.js

a3ab2f679077ea5a3058934c8ee5de70f1c2c685 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/a3ab2f679077ea5a3058934c8ee5de70f1c2c685
Authored: 2023-03-20 16:34:29 +0100
Committed: 2023-03-20 16:42:39 +0100

Introduce inset-block usage in the viewer CSS

Given that the viewer always set the dir-attribute, to either LTR or RTL, we should be able to use this logical CSS property to (very slightly) reduce the size of the CSS; please see https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block

Files Modified:

  • web/viewer.css

553c2e05cdb039d00413e888512b1b7967e3edd4 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/553c2e05cdb039d00413e888512b1b7967e3edd4
Authored: 2023-03-19 14:30:42 +0100
Committed: 2023-03-19 14:32:37 +0100

Introduce inset usage in the CSS files

The inset property is a nice shorthand that can be used to avoid having to specify the positions individually; please see

Files Modified:

  • test/text_layer_test.css
  • web/text_layer_builder.css
  • web/viewer-geckoview.css
  • web/viewer.css

The try push is done, we found jobs with unclassified failures.

Needs Investigation (From Push Health):

  • No tests were found for flavor 'plain' and the following manifest filters:
    skip_if, run_if, fail_if, subsuite(name=None), tags(['condprof']), pathprefix(['toolkit/components/pdfjs/test'])

    Make sure the test paths (if any) are spelt correctly and the corresponding
    --flavor and --subsuite are being used. See mach mochitest --help for a
    list of valid flavors.

    • 2 of 2 failed on different tasks
      - test-windows11-64-2009-qr/opt-mochitest-plain-condprof-1 (dJuSYiLmRa64-YjQcORVUA)
      - test-linux1804-64-qr/opt-mochitest-plain-condprof-1 (azwnCjo4SfCaEgLxuyM_Sw)
  • browser/base/content/test/static/browser_all_files_referenced.js

    • 9 of 9 failed on different tasks
      - test-macosx1015-64-qr/opt-mochitest-browser-chrome-1 (DkTr84aLTiuli3LYVwJqew)
      - test-macosx1015-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (ShWGHVUnQMaTWUowF2Uh3Q)
      - test-windows7-32-qr/opt-mochitest-browser-chrome-1 (BFWwAqA1TgGmBcFfRfFdFA)
      - test-windows11-64-2009-qr/opt-mochitest-browser-chrome-spi-nw-1 (bis5gcpyStCYh_ph2gyOBA)
      - test-windows11-64-2009-qr/opt-mochitest-browser-chrome-1 (Xihq107NSK2k9CjyIEY3WA)
      - test-windows11-64-2009-qr/opt-mochitest-browser-chrome-msix-1 (AyRDHsgWRJ-fY10b3yqdlQ)
      - test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-1 (bvdOpbYvTaKa8RjOSy0JyA)
      - test-linux1804-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (IPp4jwnuSs2w5iTtTeNRVw)
      - test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-a11y-checks-1 (NJDF7XcxQ7yD9OxlzmkGog)

Needs Investigation (Other Failed Jobs):

  • test-macosx1015-64-qr/debug-mochitest-devtools-chrome-1
    • 4 of 4 failed on the same (retriggered) task (PCFNa130QNafuculVC76Og, VKW8WpmiRLyw0nKbmUIdsw, DlQS8t7iSb61i-c1z4iPaQ, I6qvP8cQQ3Skzld4oxC30w)
  • test-linux1804-64-qr/debug-mochitest-devtools-chrome-1
    • 4 of 4 failed on the same (retriggered) task (P-_JnLUmQ1ycstwA3eMMhg, SUYmMxslQnqBMqX_qNA8nw, V_GGlcUzSbufrr-Ymit3-g, CNGzsrrPTTC4krx-g8av2A)
  • test-linux1804-64-qr/debug-mochitest-devtools-chrome-swr-1
    • 4 of 4 failed on the same (retriggered) task (RS0EUq2WRtyyEM7yb0cTYA, Ki7xlVD1SESEGa46G4U2EA, KMIUIZoPS8yoXillPG-mfw, dUclvXgQTPWZPkF7Cd08-w)
  • test-macosx1015-64-qr/debug-mochitest-devtools-chrome-spi-nw-1
    • 4 of 4 failed on the same (retriggered) task (UmfYu2LJQEyi5-UMHTxtQA, KIUzshSVRamgmvcK1Vkzrw, eBHgNQtPTPK34ysSqdmhoA, KASXFVGJQwiJQ7a5dUD0yQ)
  • test-windows11-64-2009-qr/debug-mochitest-devtools-chrome-spi-nw-1
    • 4 of 4 failed on the same (retriggered) task (FR9fI_FTRqe42zh-qHBtxQ, DuaqY-rfQk--rs39rmgI9g, feOOBptKRDiWDlngREKizQ, Fygp-ZEvSrWOGfSsjYgaSg)
  • test-linux1804-64-qr/debug-mochitest-plain-headless-spi-nw-1
    • 1 of 1 failed on the same (retriggered) task (LKnxlDykQLm2SegQLK0Q4w)
  • test-linux1804-64-qr/debug-mochitest-devtools-chrome-spi-nw-1
    • 4 of 4 failed on the same (retriggered) task (VDvORX98TGWHX2ILe25p7A, bqJNvYwAQ_GNztnt8t8fYQ, dzrcpoFOR-qYBVahOKtu8g, KAArsebuSdOPe3sIL7LQUQ)
  • test-windows11-64-2009-qr/debug-mochitest-devtools-chrome-1
    • 4 of 4 failed on the same (retriggered) task (TIfDbKOHS92zIEovnTc9OA, IKG57U_3Qqu2OgjpAGXhCA, IxaNhJxtTVi3g9yJ_oDTaw, KFCdXh1GQ_epFo5HEQsO0w)

These failures could mean that the library update changed something and caused
tests to fail. You'll need to review them yourself and decide where to go from here.

In either event, I have done all I can and you will need to take it from here. If you
don't want to land my patch, you can replicate it locally for editing with
./mach vendor toolkit/components/pdfjs/moz.yaml

When reviewing, please note that this is external code, which needs a full and
careful inspection - not a rubberstamp.

Assignee: nobody → cdenizet
Flags: needinfo?(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: 2 years ago
Duplicate of bug: 1826399
Resolution: --- → DUPLICATE
Attachment #9325444 - Attachment is obsolete: true
No longer blocks: 1804252, 1823296, 1824610
Flags: needinfo?(cdenizet)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: