Closed Bug 1905456 Opened 10 days ago Closed 9 days ago

Update PDF.js to new version fb3a4e4f5cf547da05ad6c81e9e2a1de5d212612 from 2024-06-28 20:43:23

Categories

(Firefox :: PDF Viewer, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1904779
Tracking Status
firefox129 --- affected

People

(Reporter: update-bot, Unassigned)

References

(Blocks 1 open bug)

Details

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

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


taskcluster/kinds/fetch/toolchains.yml | 2 +-
toolkit/components/pdfjs/content/build/pdf.mjs | 42 +++++-
toolkit/components/pdfjs/content/build/pdf.scripting.mjs | 44 +++++-
toolkit/components/pdfjs/content/build/pdf.worker.mjs | 10 +-
toolkit/components/pdfjs/content/web/viewer-geckoview.mjs | 92 ++++++++++---
toolkit/components/pdfjs/content/web/viewer.mjs | 94 ++++++++++----
toolkit/components/pdfjs/moz.yaml | 4 +-
7 files changed, 213 insertions(+), 75 deletions(-)


dacf8bb0d1af9ace9d309ec132cae1147ede481f by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/dacf8bb0d1af9ace9d309ec132cae1147ede481f
Authored: 2024-06-28 21:31:12 +0200
Committed: 2024-06-28 22:21:03 +0200

Take into account PageOpen and PageClose actions which are present in some fields

Files Added:

  • test/pdfs/issue18305.pdf

Files Modified:

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

4d91ae3cde4e7c0fccfaab3163ba5f54eb22b644 by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/4d91ae3cde4e7c0fccfaab3163ba5f54eb22b644
Authored: 2024-06-28 17:38:58 +0200
Committed: 2024-06-28 17:38:58 +0200

Ignore test issue17779.pdf in talos because it times out

Files Modified:

  • test/test_manifest.json

f006aa36d176d3f3a2cf21bf9e89c52bdd578e0e by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/f006aa36d176d3f3a2cf21bf9e89c52bdd578e0e
Authored: 2024-06-27 18:57:00 +0200
Committed: 2024-06-27 18:57:00 +0200

Add a port option to gulp server

Files Modified:

  • gulpfile.mjs

0e94f2bd00752321f22a02d66fb3307499cb1415 by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/0e94f2bd00752321f22a02d66fb3307499cb1415
Authored: 2024-06-27 18:15:45 +0200
Committed: 2024-06-27 18:23:41 +0200

Fix intermittent failures with freetext and stamp tests

They're potentially due to some concurrent access to the system clipboard.
So this patch makes them sequential.

Files Modified:

  • test/integration/freetext_editor_spec.mjs
  • test/integration/stamp_editor_spec.mjs

a4f1a9a41b9fe5ff6713024dcf6513ff52a91dc3 by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/a4f1a9a41b9fe5ff6713024dcf6513ff52a91dc3
Authored: 2024-06-26 17:17:02 +0200
Committed: 2024-06-26 17:26:02 +0200

Cancel the requestAnimationFrame in the API when cancelling rendering

Errors related to this requestAnimationFrame show up intermittently when running the integration-tests on the bots, however I've been unable to reproduce it locally.
Hence I cannot guarantee that it's enough to fix the timing issues, however this should be generally safe since the requestAnimationFrame invokes the _next-method and the first thing that one does is check that rendering hasn't been cancelled.

Files Modified:

  • src/display/api.js

4dad1e34b99affdcdfcab480c48dec794b0a79c7 by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/4dad1e34b99affdcdfcab480c48dec794b0a79c7
Authored: 2024-06-26 16:31:07 +0200
Committed: 2024-06-26 16:31:07 +0200

Cancel the requestAnimationFrame in the watchScroll helper (PR 18193 follow-up)

While the event listener is removed during testing, the requestAnimationFrame isn't cancelled and that occasionally shows up when the integration-tests are run on the bots.

Files Modified:

  • web/ui_utils.js

7128b95d29a9b802746b61ee9ecd7ef868b2141e by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/7128b95d29a9b802746b61ee9ecd7ef868b2141e
Authored: 2024-06-23 16:10:27 +0200
Committed: 2024-06-26 15:25:33 +0200

Fix a race condition involving the waitForEvent integration test helper function

Debugging #17931 uncovered a race condition in the way we use the
waitForEvent function. Currently the following happens:

  1. We call waitForEvent, which starts execution of the function body
    and immediately returns a promise.
  2. We do the action that triggers the event.
  3. We await the promise, which resolves if the event is triggered or
    the timeout is reached.

The problem is in step 1: function body execution has started, but not
necessarily completed. Given that we don't await the promise, we
immediately trigger step 2 and it's not unlikely that the event we
trigger arrives before the event listener is actually registered in the
function body of waitForEvent (which is slower because it needs to be
evaluated in the page context and there is some other logic before the
actual addEventListener call).

This commit fixes the issue by passing the action to waitForEvent as
a callback so waitForEvent itself can call it once it's safe to do so.
This should make sure that we always register the event listener before
triggering the event, and because we shouldn't miss events anymore we
can also remove the retry logic for pasting.

Files Modified:

  • test/integration/copy_paste_spec.mjs
  • test/integration/test_utils.mjs

55ba4aa66aa6c1da1f1bdb0f9c9a5654a2c78c74 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/55ba4aa66aa6c1da1f1bdb0f9c9a5654a2c78c74
Authored: 2024-06-21 20:37:01 +0200
Committed: 2024-06-26 14:48:42 +0200

Refactor the copy/paste logic in the integration tests

The integration tests are currently not consistent in how they do
copy/pasting: some tests use the kbCopy/kbPaste functions with
waiting for the event inline, some have their own helper function to
combine those actions and some even call kbCopy/kbPaste without
waiting for the event at all (which can cause intermittent failures).

This commit fixes the issues by providing a set of four helper functions
that all tests use and that abstract e.g. waiting for the event away
from the caller. This makes the invididual tests simpler and consistent,
reduces code duplication and fixes possible intermittent failures
due to not waiting for events to trigger.

Files Modified:

  • test/integration/copy_paste_spec.mjs
  • test/integration/freetext_editor_spec.mjs
  • test/integration/stamp_editor_spec.mjs
  • test/integration/test_utils.mjs

35474f8ef4bee5a21dcdde62df6ac7789269e6f7 by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/35474f8ef4bee5a21dcdde62df6ac7789269e6f7
Authored: 2024-06-25 16:52:47 +0200
Committed: 2024-06-25 21:03:34 +0200

Add the possibility to dispatch some pdf.js events at the chrome level (bug 1904585)

Files Modified:

  • web/app.js
  • web/event_utils.js
  • web/external_services.js
  • web/firefoxcom.js

f676ce5760f68341bfe7239d320de6d19f95ee14 by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/f676ce5760f68341bfe7239d320de6d19f95ee14
Authored: 2024-06-25 17:23:19 +0200
Committed: 2024-06-25 17:23:57 +0200

Remove the requestAnimationFrame work-around in L10n.prototype.destroy (PR 18313 follow-up)

With @fluent/dom 0.10.0 just published this work-around is no longer necessary.

Files Modified:

  • package-lock.json
  • package.json
  • test/integration/stamp_editor_spec.mjs
  • web/l10n.js

5b29e935e1499f882862a852191e3b78a8fd324c by Nicolò Ribaudo <nribaudo@igalia.com>

https://github.com/mozilla/pdf.js/commit/5b29e935e1499f882862a852191e3b78a8fd324c
Authored: 2024-06-18 20:02:36 +0200
Committed: 2024-06-25 14:58:08 +0200

Overrride the minimum font size when rendering the text layer

Browsers have an accessibility option that allows user to enforce
a minimum font size for all text rendered in the page, regardless
of what the font-size CSS property says. For example, it can be
found in Firefox under font.minimum-size.x-western.

When rendering the <span>s in the text layer, this causes the
text layer to not be aligned anymore with the underlying canvas.
While normally accessibility features should not be worked around,
in this case it is not improving accessibility:

  • the text is transparent, so making it bigger doesn't make it more
    readable
  • the selection UX for users with that accessibility option enabled
    is worse than for other users (it's basically unusable).

While there is tecnically no way to ignore that minimum font size,
this commit does it by multiplying all the font-sizes in the text
layer by minFontSize, and then scaling all the <span>s down by
1/minFontSize.

Files Modified:

  • src/display/text_layer.js
  • test/integration/text_layer_spec.mjs

f974b75d691f23dfc8dbc7fdcc011178c6368e79 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/f974b75d691f23dfc8dbc7fdcc011178c6368e79
Authored: 2024-06-23 14:29:33 +0200
Committed: 2024-06-25 13:46:08 +0200

Use waitForEvent in the pasteFromClipboard integration test helper function

This code contains the same bug that the previous commit fixed in
waitForEvent, namely that we don't clear the timeout if the event
is triggered. By using the now fixed waitForEvent function we not
only deduplicate this code but we also fix this issue so that no
incorrect timeout logs show up anymore.

Files Modified:

  • test/integration/test_utils.mjs

51dcd6a1baad3c5c83b624dd3a7886b49832c6fc by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/51dcd6a1baad3c5c83b624dd3a7886b49832c6fc
Authored: 2024-06-23 14:25:52 +0200
Committed: 2024-06-24 18:22:24 +0200

Fix the timeout logic in the waitForEvent integration test helper function

Debugging #17931, by printing all parts of the event lifecycle including
timestamps, uncovered that some events for which a timeout was logged
actually did get triggered correctly in the browser. Going over the code
and discovering https://stackoverflow.com/questions/47107465/puppeteer-how-to-listen-to-object-events#comment117661238_65534026
showed what went wrong: if the event we wait for is triggered then
Promise.race resolves, but that doesn't automatically cancel the
timeout. The tests didn't fail on this because Promise.race resolved
correctly, but slightly later once the timeout was reached we would see
spurious log lines about timeouts for the already-triggered events.

This commit fixes the issue by canceling the timeout if the event we're
waiting for has triggered.

Files Modified:

  • test/integration/test_utils.mjs

42bb2b0737a3d8f78a39576516cb601b613566ce by Calixte Denizet <calixte.denizet@gmail.com>

https://github.com/mozilla/pdf.js/commit/42bb2b0737a3d8f78a39576516cb601b613566ce
Authored: 2024-06-24 16:38:17 +0200
Committed: 2024-06-24 16:40:07 +0200

Fix the computation of unitsPerEm when the fontMatrix has some negative coefficients

It's a follow-up of #18253.

Files Added:

Files Modified:

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

4033913accf5a1158da345e7fa523e473d6a6ea0 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/4033913accf5a1158da345e7fa523e473d6a6ea0
Authored: 2024-06-24 15:53:31 +0200
Committed: 2024-06-24 15:54:06 +0200

Improve the security policy

This commit fixes two issues that have been found after commit 2beae7a
landed, namely:

Files Modified:

  • .github/ISSUE_TEMPLATE/config.yml
  • .github/SECURITY.md

2beae7aad6e9c89a794d3c87be21fcd5fe64e842 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/2beae7aad6e9c89a794d3c87be21fcd5fe64e842
Authored: 2024-06-21 16:43:52 +0200
Committed: 2024-06-23 21:35:33 +0200

Include a security policy for PDF.js

This makes sure that security researchers can find the required
information for reporting security vulnerabilities in a standardized
manner across GitHub repositories. Please refer to
https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository
for more information.

Files Added:

  • .github/SECURITY.md
  • .github/security.png

2f3bf6f07e77438f96168efbaad381c958b107fe by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/2f3bf6f07e77438f96168efbaad381c958b107fe
Authored: 2024-06-23 19:56:37 +0200
Committed: 2024-06-23 20:59:48 +0200

Don't ignore errors in the Jasmine suite start/end stages

Currently errors in afterAll are logged, but don't fail the tests.
This could cause new errors during test teardown to go by unnoticed.

Moreover, the integration test use a different reporting mechanism which
also handled errors differently (this is extra reason to do #12730).

This patch fixes the issues by consistently handling errors in
suiteStarted and suiteDone in both reporting mechanisms.

Fixes #18319.

Files Modified:

  • test/integration-boot.mjs
  • test/unit/testreporter.js

287fd6afd4c7a5205181b98d3d247daccc254b27 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/287fd6afd4c7a5205181b98d3d247daccc254b27
Authored: 2024-06-23 18:26:23 +0200
Committed: 2024-06-23 19:08:58 +0200

Fix the "copy/paste from a tab to an other" stamp editor integration test

This integration test contains three issues:

Fixes #18318.

Files Modified:

  • test/integration/stamp_editor_spec.mjs

f4053c2b3e84fce7090451042193bdc01a18da87 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/f4053c2b3e84fce7090451042193bdc01a18da87
Authored: 2024-06-23 12:37:43 +0200
Committed: 2024-06-23 12:46:18 +0200

Close the page in the text layer caret selection integration test

This integration test is currently the only one that spawns a separate
browser instance. However, while it closes the browser once it's done,
it doesn't close the page (and therefore doesn't call the testingClose
method) like the other integration tests do.

This commit fixes this difference by closing the page before closing the
browser, thereby ensuring all regular cleanup logic gets called and we
avoid (intermittent) shutdown tracebacks in the logs. This allows
upcoming integration tests that spawn a separate browser instance to
reuse this pattern to cleanly end the test.

Given that we integrate the closeSinglePage code from #17962 for this
patch, @calixteman is credited as the co-author.

Co-authored-by: Calixte Denizet <calixte.denizet@gmail.com>

Files Modified:

  • test/integration/test_utils.mjs
  • test/integration/text_layer_spec.mjs

327738d02a3a84f8b94a8c001201a1f5a8e85a06 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/327738d02a3a84f8b94a8c001201a1f5a8e85a06
Authored: 2024-06-21 21:44:21 +0200
Committed: 2024-06-23 11:58:55 +0200

Disable system addon updates for Firefox in testing mode

This commit fixes the following log line that currently shows up for
every type of tests that involve a browser:

System addon update list error SyntaxError: XMLHttpRequest.open: 'http://%(server)s/dummy-system-addons.xml' is not a valid URL.

If Firefox is in testing mode, the system addons update URL is
configured to a dummy URL so that it can't actually update (see for
example the same value in Marionette at
https://searchfox.org/mozilla-central/source/testing/marionette/client/marionette_driver/geckoinstance.py#109),
but this doesn't stop Firefox from trying to update, and when it does
it logs this line because the URL is obviously invalid.

Hence this patch which disables system addon updates altogether so
Firefox doesn't attempt to use the dummy URL anymore. The browser
updates are all managed by Puppeteer, and regular updates have already
been disabled too (see
https://github.com/puppeteer/puppeteer/blob/6937a76f0a442eca0c6381587b47298793798913/packages/browsers/src/browser-data/firefox.ts#L302-L303).

Files Modified:

  • test/test.mjs

649258706633281603bc442f3b2b4dba2fd3e165 by Jonas Jenwald <jonas.jenwald@gmail.com>

https://github.com/mozilla/pdf.js/commit/649258706633281603bc442f3b2b4dba2fd3e165
Authored: 2024-06-22 14:21:51 +0200
Committed: 2024-06-22 16:40:12 +0200

Try to shutdown Fluent "more" when closing the viewer during testing

Even with PR 18280 fixed, we still occasionally see l10n-related errors when closing the integration-tests on the bots.

Files Modified:

  • web/app.js
  • web/l10n.js

a89c7006072e3ef9f9fcf622661e4d4b86ab6f72 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/a89c7006072e3ef9f9fcf622661e4d4b86ab6f72
Authored: 2024-06-21 17:11:30 +0200
Committed: 2024-06-21 17:11:30 +0200

Update translations to the most recent versions

Files Modified:

  • l10n/is/viewer.ftl
  • l10n/ja/viewer.ftl

3b9208b8b6727ab2bb43210d241b7baa31478905 by Tim van der Meij <timvandermeij@gmail.com>

https://github.com/mozilla/pdf.js/commit/3b9208b8b6727ab2bb43210d241b7baa31478905
Authored: 2024-06-21 17:09:21 +0200
Committed: 2024-06-21 17:09:21 +0200

Update dependencies to the most recent versions

Files Modified:

  • package-lock.json
  • package.json

Updatebot encountered an error while trying to submit to phabricator.
Updatebot will be unable to do anything more for this library version.

Flags: needinfo?(cdenizet)

Most of the update has been done in bug 1904779.

Status: NEW → RESOLVED
Closed: 9 days ago
Duplicate of bug: 1904779
Flags: needinfo?(cdenizet)
Resolution: --- → DUPLICATE
No longer blocks: 1539074
No longer blocks: 1904585
You need to log in before you can comment on or make changes to this bug.