4889 Commits

Author SHA1 Message Date
Jonas Jenwald
06e7f308fd Replace the getStatIndex helper, in web/debugger.mjs, with native functionality
This code is old enough that it predates the existence of `Array.prototype.findIndex()`, hence why a helper function was originally needed.
2026-02-20 14:09:20 +01:00
Calixte Denizet
0149527a4b
Add the possibility to navigate with the keyboard to go from a checkbox to an other in the thumbnail view (bug 2016007) 2026-02-18 18:35:54 +01:00
Calixte Denizet
d755fba96a
Add support for deleting, cutting, copying and pasting pages (bug 2010830, 2010831) 2026-02-18 16:43:00 +01:00
calixteman
e331d458cb
Merge pull request #20679 from calixteman/bug2016142
Add an aria-label to the sidebar resizer (bug 2016142)
2026-02-18 16:33:53 +01:00
Calixte Denizet
5290534c53
Correctly handle tab/page down when on a menu (bug 2016212) 2026-02-18 10:17:39 +01:00
Calixte Denizet
65f1b9b95b
Add an aria-label to the checkboxes in the thumbnails view (bug 2016136) 2026-02-17 20:58:10 +01:00
Tim van der Meij
178261a813
Merge pull request #20463 from matt-atticus/fix-text-selection-under-search-highlight
fix: support text selection under search highlights
2026-02-17 20:03:42 +01:00
Tim van der Meij
5084e3d0ec
Merge pull request #20675 from calixteman/bug2015916
Fix the keyboard accessibility of the manage button in the thumbnails view (bug 2015916)
2026-02-17 20:03:19 +01:00
Calixte Denizet
f4a2fd60db
Fix the keyboard accessibility of the manage button in the thumbnails view (bug 2015916) 2026-02-17 19:00:20 +01:00
Calixte Denizet
167dc5a415
Add an aria-label to the sidebar resizer (bug 2016142) 2026-02-17 13:38:56 +01:00
Jonas Jenwald
6323afab46 Convert the PDFObjects class to use a Map internally
This patch also adds unconditional `Map.prototype.getOrInsertComputed()` usage, which should be fine since it's [supported in the latest browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/getOrInsertComputed#browser_compatibility) and it'll be polyfilled (via core-js) in the `legacy` builds.
2026-02-17 09:42:27 +01:00
Matthew Lawrence
f01e4d477e fix: prevent search highlights from interfering with drag-selection 2026-02-17 13:46:02 +11:00
Jonas Jenwald
170599f1e7 Enable the unicorn/prefer-class-fields ESLint plugin rule
This leads to slightly shorter code[1] when initializing classes, and in some cases we can even remove the constructors, which shouldn't hurt; see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md

It's probably possible to also change a lot of these class fields to private ones[2], however it's often difficult to tell at a glance if that's safe hence this patch only does this for the `PDFRenderingQueue`.

---

[1] This reduces the size of the `gulp mozcentral` output by 999 bytes, for a mostly mechanical code change.

[2] That sort of re-factoring should generally be done separately, on a class-by-class basis, to reduce the risk of regressions.
2026-02-14 12:33:34 +01:00
calixteman
45c7805daf
Fix types to make "gulp typestest" succeeding 2026-02-13 22:34:04 +01:00
Jonas Jenwald
d595b09d01 Enable a couple of additional eslint-plugin-unicorn rules
- `no-useless-collection-argument` which required no code changes, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md
 - `prefer-classlist-toggle` which required one change (done automatically with `gulp lint --fix`), see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-classlist-toggle.md
2026-02-13 11:25:58 +01:00
Jonas Jenwald
385c936318 [api-minor] Update the minimum supported Google Chrome version to 118
This patch updates the minimum supported browsers as follows:
 - Google Chrome 118, which was released on 2023-10-10; see https://chromereleases.googleblog.com/2023/10/stable-channel-update-for-desktop_10.html

We haven't made any changes to the supported Google Chrome version for a year, and this change allows us to remove "hacks" needed to support `float: inline-start/inline-end` in old browsers; see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/float#browser_compatibility.

Note that nowadays we usually try, where feasible and possible, to support browsers that are about two years old. By limiting support to only "recent" browsers we reduce the risk of holding back improvements of the *built-in* Firefox PDF Viewer, and also (significantly) reduce the maintenance/support burden for the PDF.js contributors.

*Please note:* As always, the minimum supported browser version assumes that a `legacy`-build of the PDF.js library is being used; see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
2026-02-09 12:16:46 +01:00
calixteman
4b4ab10c54
Set a pages mapper per loaded document
It fixes #20629.
2026-02-08 21:09:27 +01:00
Calixte Denizet
280a02150e
In tagged pdfs, TH can be either a column header or a row header (bug 2014080) 2026-02-06 10:04:13 +01:00
calixteman
222a24c623
Merge pull request #20622 from calixteman/bug2014167
Let the toggle button in the alt-text dialog downloading (resp. delete) the model and enabling (resp. disabling) alt-text guessing (bug 2014167)
2026-02-04 14:13:05 +01:00
Calixte Denizet
ea993bfc1b
Let the toggle button in the alt-text dialog downloading (resp. delete) the model and enabling (resp. disabling) alt-text guessing (bug 2014167) 2026-02-03 20:27:06 +01:00
Calixte Denizet
c7bea3b342
Avoid to have to download the model when toggling the button in the alt-text image settings dialog (bug 2013899) 2026-02-03 19:26:33 +01:00
Jonas Jenwald
bfd17b2586
Merge pull request #20615 from Snuffleupagus/transport-onProgress
Report loading progress "automatically" when using the `PDFDataTransportStream` class, and remove the `PDFDataRangeTransport.prototype.onDataProgress` method
2026-02-01 22:36:43 +01:00
Tim van der Meij
3f21efc942
Merge pull request #20607 from Snuffleupagus/rm-web-interfaces
Replace the various interfaces in `web/interfaces.js` with proper classes
2026-02-01 20:31:13 +01:00
Jonas Jenwald
d25f13d1fd Report loading progress "automatically" when using the PDFDataTransportStream class, and remove the PDFDataRangeTransport.prototype.onDataProgress method
This is consistent with the other `BasePDFStream` implementations, and simplifies the API surface of the `PDFDataRangeTransport` class (note the changes in the viewer).
Given that the `onDataProgress` method was changed to a no-op this won't affect third-party users, assuming there even are any since this code was written specifically for the Firefox PDF Viewer.
2026-02-01 18:20:19 +01:00
Jonas Jenwald
023af46186 Replace the IRenderableView interface with an abstract RenderableView class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different page/thumbnail classes.
2026-02-01 17:56:06 +01:00
Jonas Jenwald
839c257f87 Replace the IDownloadManager interface with an abstract BaseDownloadManager class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different `DownloadManager` classes.
2026-02-01 17:56:03 +01:00
Jonas Jenwald
ff7f87fc21 Replace the IPDFPrintServiceFactory interface with an abstract BasePrintServiceFactory class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different `PDFPrintServiceFactory` classes.
2026-02-01 17:53:45 +01:00
Jonas Jenwald
50a12e3e67 Remove the IL10n interface
Given that we either use the `L10n` class directly or extend it via `GenericL10n`, it should no longer be necessary to keep the interface-definition.
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the `L10n` class.
2026-02-01 17:53:45 +01:00
Jonas Jenwald
b517b5c597 Remove the IPDFLinkService interface
Given that `SimpleLinkService` now extends the regular `PDFLinkService` class, see PR 18013, it should no longer be necessary to keep the interface-definition.
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the `PDFLinkService` class.
2026-02-01 17:53:45 +01:00
Tim van der Meij
384c6208b2
Merge pull request #20565 from kairosci/fix-bug-20557
fix: Fix mailto links truncated at dash
2026-02-01 17:34:34 +01:00
Jonas Jenwald
ecb09d62fc Add the current loading percentage to the onPassword callback
The percentage calculation is currently "spread out" across various viewer functionality, which we can avoid by having the API handle that instead.

Also, remove the `this.#lastProgress` special-case[1] and just register a "normal" `fullReader.onProgress` callback unconditionally. Once `headersReady` is resolved the callback can simply be removed when not needed, since the "worst" thing that could theoretically happen is that the loadingBar (in the viewer) updates sooner this way. In practice though, since `fullReader.read` cannot return data until `headersReady` is resolved, this change is not actually observable in the API.

---

[1] This was added in PR 8617, close to a decade ago, but it's not obvious to me that it was ever necessary to implement it that way.
2026-01-31 16:33:58 +01:00
Jonas Jenwald
1370950843 Remove unnecessary IIFEs when setting the compatParams
This really isn't necessary, and it's just a left-over from before the code was moved into the current file.

Also, spotted during rebasing, use the existing "locale" hash-parameter in integration-tests rather than adding a duplicate one for testing.
2026-01-30 13:31:16 +01:00
Jonas Jenwald
5d02076313 Add tests (and CI) to ensure that preference generation works correctly for all relevant build-targets
Given that previous patches reduced that number of build-targets running this code, ensure that it's still tested sufficiently.
2026-01-30 13:31:13 +01:00
Jonas Jenwald
06cf7dd7b0 Stop pre-building the preference defaults, to simplify the build scripts
This is a left-over from before the introduction of `AppOptions`, but is no longer necessary now.
2026-01-30 13:26:19 +01:00
Calixte Denizet
956c2a051a
Fix the sidebar resizer accessibility
It's width was a bit wrong because of its box-sizing property and it was causing some issues when resizing it with the keyboard.
And for the thumbnails sidebar, the tabindex was missing and some aria properties too.
2026-01-27 21:41:11 +01:00
Calixte Denizet
dd6a0c6cf4
Add a manage button in the thumbnail view in order to save an edited pdf (bug 2010830) 2026-01-26 18:09:07 +01:00
Calixte Denizet
806133379e
Refactor a bit page mapping stuff in order to be able to support delete/copy pages 2026-01-26 16:53:52 +01:00
calixteman
48df8a5ea2
Merge pull request #20586 from marco-c/commentundo
Bug 1999154 - Add the ability to undo comment deletion
2026-01-26 15:52:15 +01:00
Calixte Denizet
f2ac669ee4
Fix the drag marker dimensions in the thumbnails view
STR:
 - open outline view;
 - switch to thumbnails one;
 - start to drag a thumbnail.
2026-01-25 21:49:17 +01:00
Alessio Attilio
50f2d4db65 fix: allow hyphens in mailto link auto-detection (bug 20557)
Modified the regex in web/autolinker.js to explicitly allow hyphens (-) in
the domain part of email addresses, while maintaining the exclusion of
other punctuation. This fixes mailto links like user@uni-city.tld being
truncated at the hyphen.

Fixes #20557
2026-01-25 17:20:14 +01:00
Tim van der Meij
95f62f3b33
Merge pull request #20580 from calixteman/reorg_link_outline
Fix links and outline after reorganizing a pdf
2026-01-23 20:49:20 +01:00
Marco Castelluccio
84d15dc453
Restore date too 2026-01-21 17:06:13 +01:00
Marco Castelluccio
d9f67bd8ee
Bug 1999154 - Add the ability to undo comment deletion 2026-01-21 15:15:40 +01:00
Calixte Denizet
a4f4d460ca
Hide the menu container in changing it's visibility
This way, the dimensions of the menu container don't depend on its visibility.
This patch fixes few keyboard issues I noticed when reading:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menu_role#keyboard_interactions
2026-01-20 14:42:57 +01:00
Calixte Denizet
43bd7fa738
Fix links and outline after reorganizing a pdf 2026-01-19 17:38:17 +01:00
Calixte Denizet
3a20ea75b9
The 'find in page' feature must correctly work after the pages have been reorganized (bug 2010814) 2026-01-18 20:54:15 +01:00
Calixte Denizet
eb014a36cc
Select the dropped thumbnail (bug 2010820) 2026-01-16 19:54:14 +01:00
calixteman
67673ea274
Merge pull request #20559 from calixteman/new_sidebar2
Add the possibility to drag & drop some thumbnails in the pages view (bug 2009573)
2026-01-14 22:13:52 +01:00
Calixte Denizet
5e89981282
Add the possibility to drag & drop some thumbnails in the pages view
The goal is to be able to reorganize the pages in a pdf.
2026-01-14 21:04:38 +01:00
calixteman
cbcb6279ad
Merge pull request #20569 from calixteman/fix_caret_dark_mode
Make sure the caret is black in dark mode when in caret browsing mode
2026-01-14 16:57:05 +01:00