Closed Bug 1816303 Opened 1 year ago Closed 1 year ago

Update PDF.js to new version 22618213c7f69060d5e7c4823f3f9863588236df from 2023-02-12 10:47:57


(Firefox :: PDF Viewer, enhancement)




112 Branch
Tracking Status
firefox111 --- wontfix
firefox112 --- fixed


(Reporter: update-bot, Assigned: calixte)


(Blocks 1 open bug)


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


(1 file)

This update covers 20 commits:

6d4d402a78510dddd59fe8360eeed30f0ca93ea8 by Jonas Jenwald
Authored: 2023-02-09 22:01:30 +0100
Committed: 2023-02-11 21:34:37 +0100

Move the arrayBuffersToBytes helper function into the worker-thread

Given that this helper function is only used on the worker-thread, there's no reason to duplicate it in both of the built pdf.js and pdf.worker.js files.

Files Modified:

  • src/core/chunked_stream.js
  • src/core/core_utils.js
  • src/core/worker.js
  • src/shared/util.js
  • test/unit/core_utils_spec.js

5023a41fb7532267379d03cf531d06a7e3eaa2fb by Jonas Jenwald
Authored: 2023-02-11 14:41:32 +0100
Committed: 2023-02-11 14:41:32 +0100

Update Stylelint to version 15

Notably this obsoletes the stylelint-config-prettier package; please see for additional details.

Files Modified:

  • .stylelintrc
  • package-lock.json
  • package.json

18042163cee98c09a4df94d9bd40a6c67f5a563c by Jonas Jenwald
Authored: 2023-02-11 12:34:20 +0100
Committed: 2023-02-11 13:39:52 +0100

Improve the consistency between the LocalPdfManager/NetworkPdfManager constructor

Currently these classes take a bunch of parameters (somewhat randomly ordered), probably because this is very old code that's been extended over the years.
Hence this patch changes the constructors to use parameter-objects instead, which improves consistency and (slightly) reduces the amount of code as well.

Please note: Also removes the msgHandler-property on these classes, since I cannot find a single call-site that accesses it.

Files Modified:

  • src/core/pdf_manager.js
  • src/core/worker.js

34ec3caaa79edceb06f9710ffa5233a52fa90cfb by Jonas Jenwald
Authored: 2023-02-11 10:35:21 +0100
Committed: 2023-02-11 10:35:21 +0100

Update l10n files

Files Modified:

  • l10n/cs/
  • l10n/da/
  • l10n/de/
  • l10n/el/
  • l10n/es-CL/
  • l10n/es-ES/
  • l10n/eu/
  • l10n/fr/
  • l10n/fur/
  • l10n/gn/
  • l10n/hsb/
  • l10n/id/
  • l10n/is/
  • l10n/ja/
  • l10n/ka/
  • l10n/nb-NO/
  • l10n/nn-NO/
  • l10n/oc/
  • l10n/pl/
  • l10n/pt-PT/
  • l10n/rm/
  • l10n/ru/
  • l10n/sk/
  • l10n/sl/
  • l10n/th/
  • l10n/tr/
  • l10n/zh-CN/
  • l10n/zh-TW/

650fd79f9269da448ef34dc04c81c02455c5a061 by Jonas Jenwald
Authored: 2023-02-11 10:24:22 +0100
Committed: 2023-02-11 10:30:43 +0100

Update npm packages

Files Modified:

  • package-lock.json
  • package.json

0e070c805ec30ab6e2b6d5781ea4a543eaa91e59 by Jonas Jenwald
Authored: 2023-02-10 15:45:39 +0100
Committed: 2023-02-10 15:45:39 +0100

Slightly re-factor preferences/options initialization in the viewer

Given that the debugging hash-parameters will only be used when the pdfBugEnabled option is manually set[1], we can skip a tiny bit of asynchronicity for "regular" users.

[1] Note that it's enabled by default in the development viewer, i.e. in gulp server mode.

Files Modified:

  • web/app.js

6c158da5a84e5dc8553f90d95b396235edb7aa1d by Jonas Jenwald
Authored: 2023-02-10 15:37:51 +0100
Committed: 2023-02-10 15:37:51 +0100

Limit AppOptions._hasUserOptions to only GENERIC builds

It's completely unused elsewhere, e.g. in the Firefox PDF Viewer.

Files Modified:

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

14b0e8c0b633ca07bf66e942d81cc41905cc3055 by Jonas Jenwald
Authored: 2023-02-10 12:08:46 +0100
Committed: 2023-02-10 12:18:35 +0100

Ensure that "GetAnnotations" errors are propagated to the main-thread (PR 15267 follow-up)

With the changes in PR 15267 we're now accidentally swallowing "GetAnnotations" errors, rather than propagating them to the main-thread as intended.

Files Modified:

  • src/core/worker.js

c56f25409d8e74b14371730083a470955cc72bcd by Jonas Jenwald
Authored: 2023-02-09 22:01:23 +0100
Committed: 2023-02-10 10:26:35 +0100

Re-factor the arraysToBytes helper function (PR 16032 follow-up)

Currently this helper function only has two call-sites, and both of them only pass in ArrayBuffer data. Given how it's implemented there's a couple of code-paths that are completely unused (e.g. the "string" one), and in particular the intended fast-paths don't actually work.
This patch re-factors and simplifies the helper function, and it'll no longer accept anything except ArrayBuffer data (hence why it's also re-named).

Note that at the time when arraysToBytes was added we still supported browsers without TypedArray functionality, and we'd then simulate them using regular Arrays.

Files Modified:

  • src/core/chunked_stream.js
  • src/core/worker.js
  • src/shared/util.js

5ba596786ccd898ff3c70b9b738678d3fefc59c6 by Jonas Jenwald
Authored: 2023-02-09 22:01:16 +0100
Committed: 2023-02-09 22:01:16 +0100

Change WorkerTasks, in WorkerMessageHandler.createDocumentHandler, to a use a Set

This is a tiny bit more compact, thanks to the Set.prototype.delete method.

Files Modified:

  • src/core/worker.js

cb1638530d83707bb772cdc15d80517a7cdfff0f by Calixte Denizet
Authored: 2023-02-09 18:30:31 +0100
Committed: 2023-02-09 18:50:57 +0100

[Annotation] A combo can have a value other than one in the options

When printing the pdf in #12233 in Acrobat, we can see that the combo for country
is empty: it's because the V entry doesn't have to be one of the options.

Files Modified:

  • src/core/annotation.js

58e4d92884a118937abb1569c16b501cbba42b68 by Calixte Denizet
Authored: 2023-02-09 14:58:41 +0100
Committed: 2023-02-09 17:26:13 +0100

[Annotation] For choice widget, use the I entry instead of the V one (bug 1770750)

It isn't really conform to the specifications but Acrobat is working like that...

Files Added:

Files Modified:

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

4e9f26afa3d6f70f97569d7c9e7e97b4e74252a2 by Calixte Denizet
Authored: 2023-02-09 17:05:22 +0100
Committed: 2023-02-09 17:13:57 +0100

Ignore position of combining diacritics when getting text (bug 1640217)

Files Modified:

  • src/core/evaluator.js
  • test/unit/pdf_find_controller_spec.js

96d338e437b98c765b8f753fe5ff823063147e58 by Jonas Jenwald
Authored: 2023-02-09 15:49:13 +0100
Committed: 2023-02-09 15:50:38 +0100

Reduce usage of the arrayByteLength helper function

We're using this helper function when reading data from the and methods, and as can be seen they always return ArrayBuffer data. Hence we can simply get the byteLength directly, and don't need to use the helper function.

Note that at the time when arrayByteLength was added we still supported browsers without TypedArray functionality, and we'd then simulate them using regular Arrays.

Files Modified:

  • src/core/chunked_stream.js
  • src/core/worker.js
  • src/shared/util.js

323d3d246a58911775fe078949c1ed5fd310b0e4 by Jonas Jenwald
Authored: 2023-02-09 15:33:06 +0100
Committed: 2023-02-09 15:33:06 +0100

Re-factor the readChunk function in ChunkedStreamManager.sendRequest

Move the done branch to the top of the function, similar to how we usually format things when ReadableStreams are used.

Files Modified:

  • src/core/chunked_stream.js

9d29abdfa04241ec206d86e072818138f0846153 by Jonas Jenwald
Authored: 2023-02-09 12:34:41 +0100
Committed: 2023-02-09 12:34:41 +0100

Change the LoopbackPort class to use a Set internally

This is a tiny bit more compact, thanks to the Set.prototype.delete method.

Files Modified:

  • src/display/api.js

40a3de8c37f6a08f773b747aef990cbd13cad249 by Jonas Jenwald
Authored: 2023-02-09 11:12:20 +0100
Committed: 2023-02-09 11:18:08 +0100

Move rewriteUrlClosure into the web/chromecom.js file

Given that this is only used for the Chrome-addon, we can move this code into the relevant file instead.

Files Modified:

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

bb89daa2a8f09095c4965199bc72ea0547ab9f0b by Calixte Denizet
Authored: 2023-02-08 11:48:48 +0100
Committed: 2023-02-08 11:57:53 +0100

Avoid a useless animation when the spinner is invisible

In looking at a profile, I noticed in Marker chart that there's an animation
for loading-icon.gif even if this icon isn't visible.
This patch doesn't completely remove it but just slightly postpones it.

Files Modified:

  • web/pdf_viewer.css

5bd352f69bc242c7e36842be9b3005fd4f54a92f by Calixte Denizet
Authored: 2023-02-07 14:38:32 +0100
Committed: 2023-02-07 15:33:01 +0100

Hide the struct tree layer during zooming

Files Modified:

  • web/pdf_page_view.js
  • web/pdf_viewer.css
  • web/struct_tree_layer_builder.js

c00e237421f7e77a7e4841edd92c0c8a942c5c11 by Jonas Jenwald
Authored: 2023-02-06 11:56:15 +0100
Committed: 2023-02-06 12:02:22 +0100

Remove inline opening of PDF attachments in the COMPONENTS build

The DownloadManager.openOrDownloadData method is written for the default-viewer specifically, assuming a viewer able to handle e.g. URL search/hash parameters. In the viewer components there's obviously no such functionality, and we should thus trigger downloading of PDF attachments directly instead.

Files Modified:

  • web/download_manager.js

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-linux1804-64-qr/opt-mochitest-plain-condprof-1 (MRQXHR1URrGk76oOKw0LKQ)
      - test-windows10-64-2004-qr/opt-mochitest-plain-condprof-1 (dMXOqY6uRLW19EBwFYv5sg)

Needs Investigation (Other Failed Jobs):

  • test-linux1804-64-qr/debug-mochitest-devtools-chrome-spi-nw-1
    • 4 of 4 failed on the same (retriggered) task (Ji1rl5EGQUugrkVQOESlbA, Pc4HvrsBQv-tjFkXCvOTJw, VgHuEdVjQwW7W3--uC5p4w, ahpGp76hSrme6Oex79BqwQ)
  • test-macosx1015-64-qr/debug-mochitest-devtools-chrome-spi-nw-1
    • 4 of 4 failed on the same (retriggered) task (AI5EQXp0RlmALbKK_OruyQ, HWIOIYhoRNmATet2HoRnmg, axwRObhuSWCJVk7HW9SUrQ, Fv4E9KNgRJaPFNc7AOU4eQ)
  • test-linux1804-64-qr/debug-mochitest-devtools-chrome-1
    • 4 of 4 failed on the same (retriggered) task (REnBT8imQD2cqOtyFaRHRw, bJ7mttZcR2O-X89gBnxXbw, CIAVkoe6SSGNMMEJGFAyLw, GGn8iS3bSlC3J4ef6pArlw)
  • test-windows10-64-2004-qr/debug-mochitest-devtools-chrome-1
    • 4 of 4 failed on the same (retriggered) task (P9dwZfarS6mcb3arNXGiYA, Fkz4ppgrQraWdI-ooBlLxg, cgWDn7B_ShKU3u9ynjb8wg, MexGw_50Rcm2GiBgcEzlrQ)
  • test-windows10-64-2004-qr/debug-mochitest-devtools-chrome-spi-nw-1
    • 4 of 4 failed on the same (retriggered) task (OYBd4vnVR66bLws5Qwhs7w, PZGx-Nh2S0mujKHWYWOeVA, YaobhNGsTHOEzMSxFO8Jjg, IXSE99AnQbajglqSTpe6NA)
  • test-macosx1015-64-qr/debug-mochitest-devtools-chrome-1
    • 4 of 4 failed on the same (retriggered) task (VYcwHNzhSaCmpxsV92kckA, MaR1lXZBR0uFbp9cEEDAuw, Dv8ZehA6ScaY0qeIB6Koug, LnRX_tgSSN2ev7SykjEOQQ)
  • test-linux1804-64-qr/debug-mochitest-devtools-chrome-swr-1
    • 4 of 4 failed on the same (retriggered) task (Dyxfh3egTWeDbfh0yCIvkQ, YjNjgGh5RCCCMJxS5uqoEg, UQgEFL5CSZyCFBlpJN13yA, Dcb_ahptQ-iYN2Yv4Wkjhg)

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)
Pushed by
Update PDF.js to 22618213c7f69060d5e7c4823f3f9863588236df r=calixte
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
Flags: needinfo?(cdenizet)
You need to log in before you can comment on or make changes to this bug.