21712 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
Jonas Jenwald
74ab1a98a6
Merge pull request #20685 from Snuffleupagus/Annotation-set-annotationType
Set the `annotationType` automatically in the `Annotation` constructor
2026-02-19 00:03:37 +01:00
calixteman
30ed527a80
Merge pull request #20677 from calixteman/bug2016007
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 19:56:09 +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
calixteman
f609ee8a0c
Merge pull request #20670 from calixteman/reorg_delete
Add support for deleting, cutting, copying and pasting pages (bug 2010830, 2010831)
2026-02-18 17:52:35 +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
calixteman
6b1b94e7d4
Merge pull request #20681 from calixteman/bug2016212
Correctly handle tab/page down when on a menu (bug 2016212)
2026-02-18 15:39:53 +01:00
Jonas Jenwald
e1cc24c595 Set the annotationType automatically in the Annotation constructor
Rather than assigning it manually in every extending class, we can utilize the fact that the `AnnotationType`-entries are simply the upper-case version of the `/Subtype` (when it exists) in the Annotation dictionary.
2026-02-18 14:47:42 +01:00
Calixte Denizet
5290534c53
Correctly handle tab/page down when on a menu (bug 2016212) 2026-02-18 10:17:39 +01:00
calixteman
61de56440a
Merge pull request #20678 from calixteman/bug2016136
Add an aria-label to the checkboxes in the thumbnails view (bug 2016136)
2026-02-18 10:14:36 +01:00
Jonas Jenwald
3a32ca7e69
Merge pull request #20682 from Snuffleupagus/CanvasGraphics-rm-unused-props
Remove unused `CanvasGraphics` properties (PR 700 follow-up)
2026-02-17 22:38:33 +01:00
Jonas Jenwald
336cda0c64 Remove unused CanvasGraphics properties (PR 700 follow-up)
These are probably a copy-and-paste mistake, since they appear to have been unused already in PR 700 all the way back in 2011.
2026-02-17 21:36:08 +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
cfc93e2606
Merge pull request #20665 from calixteman/fix_coverage
Fix code coverage line mapping
2026-02-17 20:16:41 +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
Jonas Jenwald
fe44bac6ef
Merge pull request #20673 from Snuffleupagus/PDFObjects-Map
Convert the `PDFObjects` class to use a `Map` internally
2026-02-17 13:54:48 +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
62ac1b844a
Merge pull request #20669 from Snuffleupagus/decode-truncate
Truncate too long /Decode map entries (issue 20668)
2026-02-16 20:39:12 +01:00
Jonas Jenwald
8319fff9b6
Merge pull request #20663 from Snuffleupagus/xref-rm-Object-hasOwn
Remove `Object.hasOwn` usage from the `src/core/xref.js` file
2026-02-16 20:38:18 +01:00
Jonas Jenwald
31b4612ac0 Truncate too long /Decode map entries (issue 20668) 2026-02-16 16:22:00 +01:00
calixteman
2b57ef4b56
Fix code coverage line mapping
When checking the code coverage report, it was noticed that the line numbers were off.
It was due to the fact that the files used for coverage were the transpiled ones,
when the ones used by Codecov were the original ones.
So this patches adds the source maps to the transpiled files, and also updates
the license header in the original files in using a babel plugin in order
to make sure the line numbers are correct.
As a side effect of this work, it's now possible to have the correct line
numbers in the stack traces when running tests with the transpiled files.
2026-02-15 23:03:07 +01:00
Jonas Jenwald
0a9176422e Remove Object.hasOwn usage from the src/core/xref.js file
This should not be necessary, given the following checks done early during the worker initialization: c5746949ac/src/core/worker.js (L124-L141)
2026-02-15 16:39:39 +01:00
Tim van der Meij
c5746949ac
Merge pull request #20659 from calixteman/codecov_badge
Add a Codecov badge
2026-02-14 19:35:28 +01:00
calixteman
f975a95cc4
Add a Codecov badge 2026-02-14 15:48:16 +01:00
Tim van der Meij
b6d028419b
Merge pull request #20658 from calixteman/node_coverage
Add code coverage for unit tests running in node
2026-02-14 15:41:17 +01:00
Tim van der Meij
1d6307f5d4
Merge pull request #20657 from Snuffleupagus/unicorn-prefer-class-fields
Enable the `unicorn/prefer-class-fields` ESLint plugin rule
2026-02-14 15:26:28 +01:00
calixteman
07dbda2d80
Add code coverage for unit tests running in node
It's a first step to add code coverage.
In order to get the code coverage report locally, you can run the following command:
```bash
npx gulp unittestcli --coverage
```
The code coverage report will be generated in the `./build/coverage` directory.
And the report can be consulted by opening:
  http://localhost:8888/build/coverage/index.html

A GitHub workflow has also been added to run the unit tests with code coverage
on each push and pull request. The report will be uploaded to Codecov.
2026-02-14 15:22:35 +01:00
Tim van der Meij
f22fb6bbfb
Merge pull request #20652 from Snuffleupagus/ChunkedStream-sendRequest-skip-empty
Avoid parsing skipped range requests in `ChunkedStreamManager` (PR 10694 follow-up)
2026-02-14 13:55:31 +01: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
fa908e452c
Merge pull request #20641 from calixteman/fix_ts
Fix types to make "gulp typestest" succeeding
2026-02-13 22:37:16 +01:00
calixteman
45c7805daf
Fix types to make "gulp typestest" succeeding 2026-02-13 22:34:04 +01:00
Tim van der Meij
63110e34a7
Merge pull request #20654 from Snuffleupagus/eslint-unicorn-rules
Enable a couple of additional `eslint-plugin-unicorn` rules
2026-02-13 19:51:42 +01:00
Tim van der Meij
b8a091107d
Merge pull request #20655 from calixteman/pdfium_update
Update jbig2 decoder (pdfium@0455e822ded1a5537d826703988e986a33d2d4a1)
2026-02-13 19:50:35 +01:00
Tim van der Meij
3302b3d5b6
Merge pull request #20656 from Snuffleupagus/mv-stripPath
Move and re-use the `stripPath` helper function more
2026-02-13 19:49:57 +01:00
Jonas Jenwald
520928719c Move and re-use the stripPath helper function more
There's a couple of spots that essentially re-implement that function.
2026-02-13 17:38:21 +01:00
Calixte Denizet
5a146a8d2f
Update jbig2 decoder (pdfium@0455e822ded1a5537d826703988e986a33d2d4a1) 2026-02-13 14:40:32 +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
calixteman
fa28ca1468
Merge pull request #20651 from Snuffleupagus/Response-bytes
Start using `Response.prototype.bytes()` in the code-base
2026-02-13 10:31:54 +01:00
calixteman
ae9fc13d8f
Merge pull request #20649 from calixteman/bug2015385
Ends the current drawing session when closing the tab (bug 2015385)
2026-02-13 08:27:16 +01:00
calixteman
1b20ba5c3f
Ends the current drawing session when closing the tab (bug 2015385) 2026-02-12 22:21:55 +01:00
Jonas Jenwald
b3c07f4b3d Avoid parsing skipped range requests in ChunkedStreamManager (PR 10694 follow-up)
While we don't dispatch the actual range request after PR 10694 we still parse the returned data, which ends up being an *empty* `ArrayBuffer` and thus cannot affect the `ChunkedStream.prototype._loadedChunks` property.
Given that no actual data arrived, it's thus pointless[1] to invoke the `ChunkedStreamManager.prototype.onReceiveData` method in this case (and it also avoids sending effectively duplicate "DocProgress" messages).

---
[1] With the *possible* exception of `disableAutoFetch === false` being set, see f24768d7b4/src/core/chunked_stream.js (L499-L517) however that never happens when streaming is being used; note f24768d7b4/src/core/worker.js (L237-L238)
2026-02-12 18:01:54 +01:00
calixteman
f24768d7b4
Merge pull request #20648 from Snuffleupagus/api-async-getTextContent
Convert `PDFPageProxy.prototype.getTextContent` to an asynchronous method
2026-02-12 13:47:04 +01:00
Jonas Jenwald
722f1ffbc6 Remove type === "arraybuffer" support from the fetchData helper function
After the previous patch there's no longer any call-site using that type.
2026-02-12 11:23:28 +01:00
Jonas Jenwald
8ba83e73fa Start using Response.prototype.bytes() in the code-base
In all cases where we currently use `Response.prototype.arrayBuffer()` the result is immediately wrapped in a `Uint8Array`, which can be avoided by instead using the newer `Response.prototype.bytes()` method; see https://developer.mozilla.org/en-US/docs/Web/API/Response/bytes
2026-02-12 11:20:05 +01:00
Jonas Jenwald
c1b824f2e5 Convert PDFPageProxy.prototype.getTextContent to an asynchronous method
This is a tiny bit shorter, which cannot hurt.
2026-02-11 19:14:10 +01:00