5065 Commits

Author SHA1 Message Date
calixteman
7ebf3a4d7c
Merge pull request #21196 from calixteman/bug2035530
Fix free highlight on pages without images (bug 2035530)
2026-04-30 19:34:02 +02:00
Jonas Jenwald
aa08b02a5b Avoid setting page-content for a previous document in the PDFFindController.prototype.#extractText method
Given that all of the relevant API methods are asynchronous it's possible, although quite unlikely, that the existing "is the document active" check won't catch all situations where the document was closed in the middle of searching.
2026-04-29 22:39:53 +02:00
Jonas Jenwald
a6e2a42df1 Improve error handling in the PDFFindController.prototype.#extractText method
This handles *all* errors correctly, if e.g. the document is closed in the middle of searching.
Also, replacing the "promise chains" with more `await` helps simplify the code a little bit.
2026-04-29 22:39:51 +02:00
Calixte Denizet
e7ec356be0
Fix free highlight on pages without images (bug 2035530) 2026-04-29 19:24:35 +02:00
Calixte Denizet
ecd154160d
Fix HCM colors for the views-manager massive unselect button (bug 2035551) 2026-04-28 19:52:53 +02:00
Jonas Jenwald
fae980a72d A couple of internal-viewer fixes
- Bundle the `web/text_layer_builder.css` file correctly, to ensure that textLayer debugging works when the code is *built*.
   Note how loading https://mozilla.github.io/pdf.js/internal-viewer/web/debugger.html currently logs the following error: `GET https://mozilla.github.io/pdf.js/internal-viewer/text_layer_builder.css [HTTP/2 404  7ms]`.

 - Import the `MathClamp` helper function from the *built* library, rather than "manually", since that's more correct.
2026-04-26 19:10:05 +02:00
Jonas Jenwald
9b238b9719 Move the hexNumbers Array into Util, to enable using it in the viewer
This reduces some code duplication, and the new `Util.hexNums` property is now computed lazily.
2026-04-26 12:05:12 +02:00
Jonas Jenwald
1591ddfa8d
Merge pull request #21157 from Snuffleupagus/eslint-radix
Enable the `radix` ESLint rule
2026-04-25 22:27:21 +02:00
Jonas Jenwald
e6dba6ee34 Enable the radix ESLint rule
Many `parseInt` call-sites already provide the `radix` argument, and this rule helps improve consistency in the code-base; see https://eslint.org/docs/latest/rules/radix

*Please note:* The rule is disabled in `src/scripting_api/util.js` for now, since it's not obvious at a glance (at least to me) what the correct `radix` argument should be there.
2026-04-25 12:13:12 +02:00
calixteman
30d060c77a
Merge pull request #21151 from calixteman/bug2034568
Fix clicking on a thumbnail image not navigating to the correct page when using a screen reader (bug 2034568)
2026-04-25 08:20:25 +02:00
Tim van der Meij
7dc4812643
Merge pull request #21138 from calixteman/bug2034111
Fix status label mismatch after merging with a pre-existing selection (bug 2034111)
2026-04-24 20:07:50 +02:00
calixteman
2d896faa1e
Merge pull request #21142 from calixteman/input_color_alpha
[Ink] Replace the opacity slider with an alpha-enabled color input
2026-04-24 15:46:46 +02:00
Calixte Denizet
39eb691252
Fix status label mismatch after merging with a pre-existing selection (bug 2034111) 2026-04-24 14:13:53 +02:00
calixteman
a6382ac97d
Merge pull request #21145 from calixteman/bug2034461
Prompt the user for saving a merged pdf (bug 2034461)
2026-04-24 14:11:36 +02:00
Calixte Denizet
b669fdfc70
Fix clicking on a thumbnail image not navigating to the correct page when using a screen reader (bug 2034568)
Screen readers like NVDA fire synthetic click events on the <img> child of the button rather than on the
thumbnailImageContainer element itself, so the strict classList.contains check silently failed.
2026-04-24 10:10:59 +02:00
Calixte Denizet
987edbb646
Switch to a wasm file for the quickjs sandbox 2026-04-23 22:34:48 +02:00
Calixte Denizet
f266c4d8b8
[Ink] Replace the opacity slider with an alpha-enabled color input
The alpha feature is available in Firefox nightly (with the pref `dom.forms.html_color_picker.enabled` set to `true`).
It's available in Safari but not in Chrome.
2026-04-23 21:37:37 +02:00
Calixte Denizet
302bc5f4d9
Prompt the user for saving a merged pdf (bug 2034461) 2026-04-23 18:37:56 +02:00
Calixte Denizet
9bfad05173 [HCM] Set the correct color for the icon in the merge button when focused with the keyboard (bug 2033603) 2026-04-21 19:24:21 +02:00
Calixte Denizet
8ddbeda4a0
Remove user and password from URLs (bug 2025109) 2026-04-20 20:53:24 +02:00
Calixte Denizet
8c9b819b4e
Add the UI for merging PDFs (bug 2028071) 2026-04-13 19:38:56 +02:00
Tim van der Meij
583c9d6b98
Update dependencies to the most recent versions
Note that the `globals` update rendered two ESLint ignore lines obsolete
because the `Sanitizer` global is now registered [1].

[1] 5d84602967
2026-04-12 16:16:21 +02:00
Calixte Denizet
ea15ac31ef Dont revoke blob URLs while printing but do it after
It fixes #19988.

In Firefox, when printing, the document is cloned and use an image cache
which isn't available when there's a service worker.
2026-04-08 14:04:09 +02:00
calixteman
d6afffe8f6
Merge pull request #21059 from calixteman/bug2028193
Make sure the thumbnails positions are recomputed after a structural change but after a reflow has been done (bug 2028193)
2026-04-07 17:02:07 +02:00
Calixte Denizet
1b2e98f3ce
Make sure the thumbnails positions are recomputed after a structural change but after a reflow has been done (bug 2028193) 2026-04-07 15:48:23 +02:00
Jonas Jenwald
8656b4acb3 Fix the l10n-id for the sidebar toggleButton, in the ViewsManager class
Steps to reproduce:
 1. Open http://localhost:8888/web/viewer.html
 2. Open the console, and run: `PDFViewerApplication.close();`
 3. Note the warning: `[fluent] Missing translations in en-us: pdfjs-toggle-views-manager-button`
2026-04-07 11:13:35 +02:00
Jonas Jenwald
5aaf30a071
Merge pull request #21018 from Snuffleupagus/Node-22
[api-minor] Update the minimum supported Node.js version to 22
2026-04-05 12:39:36 +02:00
Jonas Jenwald
f6bac014ea [api-minor] Remove PostScriptCompiler and PostScriptEvaluator, since it's now dead code (PR 21023 follow-up)
These classes, and various related code, became unused after PR 21023 with only unit-tests actually running that code now.

Also removes the `isEvalSupported` API option, since the `PostScriptCompiler` was the only remaining code where `eval` was used.
2026-04-03 22:14:14 +02:00
Calixte Denizet
1e3d688a32
Add an eslint plugin for using MathClamp when it's possible 2026-04-03 21:12:52 +02:00
Tim van der Meij
bb1033053c
Merge pull request #21029 from Snuffleupagus/Object-hasOwn
Replace all `Object.prototype.hasOwnProperty` usage with `Object.hasOwn`
2026-04-03 19:51:09 +02:00
Jonas Jenwald
f09b03c062 Enable the prefer-object-has-own ESLint rule
Please see https://eslint.org/docs/latest/rules/prefer-object-has-own
2026-04-02 13:24:31 +02:00
Jonas Jenwald
579589a38a Use OffscreenCanvas unconditionally in the web/pdf_thumbnail_view.js file
Given that `OffscreenCanvas` is available in all supported browsers and that the code in the `web/` folder is only intended to run in browsers, the fallback should no longer be necessary.

Please note:
 - https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
 - https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas#browser_compatibility
2026-04-01 16:32:07 +02:00
Jonas Jenwald
e0423ebbe4 [api-minor] Update the minimum supported Node.js version to 22
This patch updates the minimum supported environments as follows:
 - Node.js 22, which was initially released on 2024-04-24 and has now entered the "Maintenance"-phase; see https://github.com/nodejs/release#release-schedule

Furthermore, note also that Node.js 20 will reach end-of-life on 2026-04-30 which coincides (approximately) with the next PDF.js release.
2026-04-01 12:06:32 +02:00
Calixte Denizet
9f3de1edf6
Add an interpreter for optimized ps code
It'll be used as a fallback when wasm is disabled.
And add in the debugger a view for the generated js code and one for the ps code.
2026-03-31 21:00:22 +02:00
Tim van der Meij
9026329d3d
Merge pull request #21003 from Snuffleupagus/applyOpacity-map
Simplify the `applyOpacity` helper function
2026-03-29 16:06:28 +02:00
Jonas Jenwald
498daadf3c Simplify the applyOpacity helper function
This function only has a single call-site (if we ignore the unit-tests), where the colors are split into separate parameters.
Given that all the color components are modified in the exact same way, it seems easier (and shorter) to pass the colors as-is to `applyOpacity` and have it use `Array.prototype.map()` instead.
2026-03-29 14:52:06 +02:00
Jonas Jenwald
0060eeb726 Use more logical assignment in the code-base 2026-03-27 12:18:04 +01:00
calixteman
0128ead18a
Merge pull request #20985 from calixteman/bug2023150_2
Avoid to be blocked when searching after a page move (bug 2023150)
2026-03-26 23:28:33 +01:00
Calixte Denizet
f98ce9ca85
Avoid to have multiple selected pages after copy/cut operations (bug 2026639) 2026-03-26 21:35:10 +01:00
calixteman
466c6263ad
Merge pull request #20974 from calixteman/bug2025674
Don't walk the children of a node having some attached MathML (bug 2025674)
2026-03-26 21:33:13 +01:00
Tim van der Meij
377f6d8b73
Merge pull request #20984 from calixteman/debugger_dont_update_canvas_view
Update the canvas detail view only when drawing is done
2026-03-26 20:41:22 +01:00
Tim van der Meij
a924af2e0b
Merge pull request #20990 from calixteman/bug2026564
Hide the new badge while a page is selected (bug 2026564)
2026-03-26 20:35:56 +01:00
Calixte Denizet
b1d93d0e51 Hide the new badge while a page is selected (bug 2026564) 2026-03-26 19:23:04 +01:00
Calixte Denizet
2d43ba2b67 Avoid to be blocked when searching after a page move (bug 2023150) 2026-03-26 16:49:44 +01:00
Calixte Denizet
c2ba6b0e33 Update the canvas detail view only when drawing is done
And remove the canvas from the view once it's destroyed.
2026-03-26 15:51:46 +01:00
Calixte Denizet
265de5d453
Debugger: in the tree view, display the white spaces as they're
And in the debug view, display the ltr chars in the same order as they are in showText argument.
2026-03-25 19:46:16 +01:00
calixteman
eff11e88bb
Don't walk the children of a node having some attached MathML (bug 2025674)
And now Chrome has a MathML Sanitizer implementation (146), the tests related to MathML are updated to reflect that.
2026-03-25 10:21:34 +01:00
Jonas Jenwald
777251da85
Merge pull request #20968 from Snuffleupagus/getNetworkStream
Move the `NetworkStream` choice from `src/display/api.js` and into a separate file
2026-03-25 08:33:08 +01:00
Calixte Denizet
f608d5682c Enable hardware acceleration by default 2026-03-24 23:41:05 +01:00
Jonas Jenwald
a0102abe76 Move the NetworkStream choice from src/display/api.js and into a separate file
This code already isn't used (or even bundled) in the Firefox PDF Viewer, and it also slightly reduces the number of import maps that need to be maintained.
2026-03-24 17:08:04 +01:00