23303 Commits

Author SHA1 Message Date
Tim van der Meij
2475c4ec91
Merge pull request #21678 from Snuffleupagus/ViewHistory-findIndex
Shorten the `ViewHistory` class a little bit
2026-08-02 12:10:21 +02:00
Jonas Jenwald
664526ee65 Shorten the ViewHistory class a little bit
- Replace the manual loop, used to find an existing entry, with the native [`findIndex` method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).

 - Remove the `fingerprint`/`cacheSize` class fields, since they are completely unused.
2026-08-01 12:19:20 +02:00
Tim van der Meij
7fc7072f9c
Merge pull request #21674 from calixteman/touch/fix-swallowed-pointerup
Let pointerup/cancel propagate in TouchManager
2026-07-31 20:16:07 +02:00
Tim van der Meij
bb1a948397
Merge pull request #21672 from Snuffleupagus/more-ternary
Replace simple return `if` statements with ternary operators
2026-07-31 19:59:46 +02:00
Tim van der Meij
4b4c784a85
Merge pull request #21673 from Snuffleupagus/EventBus-Map-Set
Re-factor the `EventBus` to use Map/Set internally
2026-07-31 19:50:16 +02:00
calixteman
0f999e27b5 Let pointerup/cancel propagate in TouchManager
During two-finger gestures, keep preventing the default action on pointerup/pointercancel, but don't stop propagation. Resize/drag sessions need those bubble events to clean up.
2026-07-31 19:26:53 +02:00
calixteman
af38789499
Merge pull request #21659 from calixteman/fix/pinch-zoom-origin
Use the client coordinates for the pinch-zoom origin
2026-07-31 18:00:52 +02:00
Jonas Jenwald
0d5df9d96e Re-factor the EventBus to use Map/Set internally
Especially the Array to Set conversion should be helpful, since adding/removing elements from a Set is more efficient.
2026-07-31 17:37:05 +02:00
Calixte Denizet
8960eddfc1 Use the client coordinates for the pinch-zoom origin
`TouchManager` computes the pinch distances with the screen coordinates, but it
was passing the pinch center in that space too, while the viewer expects a
client coordinate, like the origin coming from a wheel event.

Since a two-finger gesture can be synthesized with WebDriver BiDi, the
pinch-zoom test doesn't have to rely on CDP anymore and can run in Chrome, where
it fails without the above fix.
2026-07-31 16:44:28 +02:00
Jonas Jenwald
ee59db5018 Replace simple return if statements with ternary operators
In a couple of cases, where a boolean is returned, it's also possible to use an OR operator rather a ternary.

*Note:* This patch reduces the size of the `gulp mozcentral` bundle by `960` bytes.
2026-07-31 12:24:08 +02:00
Jonas Jenwald
ce4ff55faa
Merge pull request #21664 from Snuffleupagus/getJSActions-api
[api-minor] Convert `getJSActions` to return data in a Map
2026-07-31 11:29:21 +02:00
calixteman
40f6492997
Merge pull request #21665 from calixteman/sync_firefox_css
Sync the viewer chrome with the Firefox design system
2026-07-31 09:48:01 +02:00
calixteman
613e004b2e
Merge pull request #21669 from mozilla/update-locales
l10n: Update locale files
2026-07-31 09:19:53 +02:00
github-actions[bot]
734b21e61e l10n: Update locale files 2026-07-31 00:39:04 +00:00
Calixte Denizet
b4d028132b Sync the viewer chrome with the Firefox design system
The chrome is now authored against Firefox design-token names with the shipped
value as a fallback `var(--fx-token, <literal>)` so colors, borders and radii
follow Firefox instead of having to be re-synced by hand.

In MOZCENTRAL viewer.css imports chrome://global/skin/design-system/tokens-brand.css,
gated on the new pdfjs.enableNova pref (default false, read straight from CSS via -moz-pref()).
With the pref off the sheet isn't applied, every fallback resolves, and the
viewer renders as before, as it also does in the GENERIC and components builds,
which never see the chrome sheet.

Consuming a token means never declaring its name in an unlayered rule, which
would shadow Firefox's for the whole subtree; --focus-outline, --border-color and
--text-color/--button-border-color are therefore renamed to
--editor-selection-outline, --signature-border-color and --views-*. In forced
colors each state reads a matching background/foreground/border triple so it
can't collapse to a single system color.

The dialog button styling also moves out of `.dialog .mainContainer button` into
a shared .primaryButton/.secondaryButton primitive (buttons.css, imported from
pdf_viewer.css so the components build gets it too). The password,
document-properties, print and undo-bar buttons use it in place of .dialogButton,
and the custom radio appearance gives way to native controls tinted with
accent-color.
2026-07-30 23:13:43 +02:00
Tim van der Meij
a80897dc9a
Merge pull request #21666 from calixteman/bug2054348
Fix the selection rendering when a page has been destroyed and rendered again (bug 2054348)
2026-07-30 21:12:47 +02:00
Tim van der Meij
0163438e1a
Merge pull request #21660 from calixteman/fix/pdf-editor-preserve-widget-parent
Avoid mutating source widget parents
2026-07-30 21:02:29 +02:00
Tim van der Meij
f70f55d743
Merge pull request #21658 from calixteman/fix/pdf-editor-clone-reference-race
Avoid duplicate shared object clones
2026-07-30 20:52:35 +02:00
Calixte Denizet
9e02ceed09 Fix the selection rendering when a page has been destroyed and rendered again (bug 2054348)
The draw layer keeps a reference on the text layer div in order to render the
selection, but it was destroyed only along with the annotation editor layer.
Hence, when the editor is disabled, like in Firefox for Android, scrolling far
enough to destroy a page view left the draw layer with a reference on a removed
text layer: the new one was never registered, consequently no selection was
rendered anymore on that page.
2026-07-30 18:37:03 +02:00
Jonas Jenwald
803c9d7d21 [api-minor] Convert getJSActions to return data in a Map
Compared to regular Objects there's a number of advantages to using Maps:
 - They support proper iteration.
 - They have a simple way to check for the existence of data.
 - They have a simple/efficient way to check the number of elements.

If this functionality was added today, I cannot imagine that we'd choose an Object for this data.

Note also how in the scripting-implementation the `actions` were already converted into a Map, via the `createActionsMap` helper.
In the Firefox PDF Viewer sending `Map`s to the scripting-implementation should be fine, since it uses the browser `Cu.cloneInto` functionality; see https://searchfox.org/firefox-main/source/toolkit/components/pdfjs/content/PdfSandbox.sys.mjs
However with QuickJS, used by the GENERIC viewer, all data needs to be stringified and unfortunately `JSON.stringify()` doesn't support Maps. Hence we convert Maps to Objects, via a [`replacer` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#replacer), since the existing `createActionsMap` usage will convert the actions-Objects back to Maps.
2026-07-30 16:04:58 +02:00
Jonas Jenwald
73707b62e9
Merge pull request #21661 from Snuffleupagus/more-optional-chaining-6
Use more more optional chaining in the `src/` folder
2026-07-30 10:35:17 +02:00
Jonas Jenwald
1813ab0774 Use more more optional chaining in the src/ folder 2026-07-29 18:28:41 +02:00
Calixte Denizet
aa812b531a Avoid mutating source widget parents 2026-07-29 16:03:15 +02:00
calixteman
61acf93172
Merge pull request #21644 from calixteman/editor/pinch-lost-after-undo
[Editor] Restore pinch-to-resize on an editor which came back from an undo
2026-07-29 15:27:54 +02:00
calixteman
822d3ea809 [Editor] Restore pinch-to-resize on an editor which came back from an undo
`AnnotationEditor.remove()` destroys the editor's `TouchManager`, but `remove()`
is also the undo half of an edit: deleting a drawing and undoing it, or undoing
the drawing itself and redoing it, brings the very same editor back.
2026-07-29 14:45:02 +02:00
Calixte Denizet
3a19a20d50 Avoid duplicate shared object clones 2026-07-28 22:39:35 +02:00
Tim van der Meij
4d9007e6f9
Merge pull request #21655 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-07-28 21:59:15 +02:00
Tim van der Meij
7f5fd4eba4
Bump the stable version in pdfjs.config 2026-07-28 21:53:58 +02:00
Tim van der Meij
0365cbde02
Merge pull request #21654 from calixteman/fix/cycles
Avoid cycles when walking some trees
v6.2.108
2026-07-28 21:34:49 +02:00
Tim van der Meij
f704f2ef02
Merge pull request #21652 from Snuffleupagus/signatures-async-helpers
Update the signatures-helpers to actually handle `MissingDataException`s
2026-07-28 21:34:14 +02:00
Tim van der Meij
01ba4c476d
Merge pull request #21646 from calixteman/update/pdf.js.qcms
Update qcms wrapper
2026-07-28 20:25:15 +02:00
Tim van der Meij
0299cdcab9
Merge pull request #21653 from Snuffleupagus/jsActions-_getElementsByName-shorten
Shorten `Catalog.prototype.jsActions getter` and `AnnotationElement.prototype._getElementsByName` a tiny bit
2026-07-28 20:23:07 +02:00
Tim van der Meij
8c3e1014f4
Merge pull request #21650 from mozilla/dependabot/github_actions/github/codeql-action/autobuild-4.37.2
Bump github/codeql-action/autobuild from 4.37.0 to 4.37.2
2026-07-28 20:20:18 +02:00
Tim van der Meij
14afb8669f
Merge pull request #21649 from mozilla/dependabot/github_actions/github/codeql-action/analyze-4.37.2
Bump github/codeql-action/analyze from 4.37.0 to 4.37.2
2026-07-28 20:20:08 +02:00
Tim van der Meij
14fc73bf05
Merge pull request #21648 from mozilla/dependabot/github_actions/github/codeql-action/init-4.37.2
Bump github/codeql-action/init from 4.37.0 to 4.37.2
2026-07-28 20:19:56 +02:00
Tim van der Meij
257f4c2a5e
Merge pull request #21647 from mozilla/dependabot/github_actions/actions/setup-python-7.0.0
Bump actions/setup-python from 6.3.0 to 7.0.0
2026-07-28 20:18:56 +02:00
Tim van der Meij
93958e4ff6
Merge pull request #21640 from Snuffleupagus/defaultOptions-Map
Change `defaultOptions`, in the `web/app_options.js` file, to a Map
2026-07-28 20:18:03 +02:00
Tim van der Meij
bc6b5b0f44
Merge pull request #21651 from mozilla/dependabot/github_actions/actions/checkout-7.0.1
Bump actions/checkout from 7.0.0 to 7.0.1
2026-07-28 20:15:10 +02:00
Calixte Denizet
ac51b29777 Avoid cycles when walking some trees 2026-07-28 19:51:34 +02:00
Jonas Jenwald
3736000aee Shorten the AnnotationElement.prototype._getElementsByName method a tiny bit 2026-07-28 19:07:31 +02:00
Jonas Jenwald
8d1afad39b Shorten the Catalog.prototype.jsActions getter, and related code, a tiny bit
This is possible thanks to modern language features.
2026-07-28 19:01:47 +02:00
Jonas Jenwald
c9eaf13ae4 Lookup more data in parallel in the PDFDocument.prototype.#parseSignatureDict method 2026-07-28 16:18:01 +02:00
Jonas Jenwald
1ce8e8a320 Move the ByteRange validation earlier when parsing signatures
Given that these checks are synchronous, we can avoid a little bit of unnecessary data-fetching if the `ByteRange` is invalid.
2026-07-28 16:18:01 +02:00
Jonas Jenwald
f38e8b659e Update the signatures-helpers to actually handle MissingDataExceptions
The `PDFDocument.prototype.signatures` getter returns a (shadowed) Promise, however the way that it invokes various helper-methods can lead to *intermittent* failures to parse the signature data.
These helper-methods will lookup a fair amount of Dictionary data, however any one of those cases could throw `MissingDataException` during document loading.

To avoid having to re-factor those methods a lot, and adding a bunch more `pdfManager.ensureDoc()` calls, they are instead made asynchronous and the Dictionary lookups changed to use `Dict.prototype.getAsync` (similar to the existing `fieldObjects` handling).
Technically this additional asynchronicity may be ever so slightly slower, however I don't think it matters in practice since: most PDFs don't have any signatures, the signature-UI is initialized lazily in the viewer, and finally fetching/parsing of signatures do not block rendering.
Also, note how multiple values are being fetched in parallel in order to attempt to reduce overall asynchronicity.

*Note:* The unit-test changes are essentially fixing pre-existing bugs, that this patch exposed, since the test-only `Dict` instances weren't able to fetch indirect objects.
2026-07-28 16:17:52 +02:00
dependabot[bot]
4b924df453
Bump actions/checkout from 7.0.0 to 7.0.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9c091bb21b...3d3c42e5aa)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 12:16:57 +00:00
dependabot[bot]
2f873ef13a
Bump github/codeql-action/autobuild from 4.37.0 to 4.37.2
Bumps [github/codeql-action/autobuild](https://github.com/github/codeql-action) from 4.37.0 to 4.37.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](99df26d4f1...e0647621c2)

---
updated-dependencies:
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 12:16:45 +00:00
dependabot[bot]
4a11934d1e
Bump github/codeql-action/analyze from 4.37.0 to 4.37.2
Bumps [github/codeql-action/analyze](https://github.com/github/codeql-action) from 4.37.0 to 4.37.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](99df26d4f1...e0647621c2)

---
updated-dependencies:
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 12:15:26 +00:00
dependabot[bot]
31d49e18de
Bump github/codeql-action/init from 4.37.0 to 4.37.2
Bumps [github/codeql-action/init](https://github.com/github/codeql-action) from 4.37.0 to 4.37.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](99df26d4f1...e0647621c2)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 12:14:05 +00:00
dependabot[bot]
5d93c1bdff
Bump actions/setup-python from 6.3.0 to 7.0.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6.3.0 to 7.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](ece7cb06ca...5fda3b95a4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 12:12:46 +00:00
calixteman
e7acffcef3
Update qcms wrapper
Few performance improvements have been made in the qcms wrapper, see:
2ae4ee7233
2026-07-27 20:33:49 +02:00