1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 07:08:08 +02:00
Commit graph

18826 commits

Author SHA1 Message Date
calixteman
0867a1f9bc
Merge pull request #17973 from calixteman/no_contextmenu_resize
[Editor] Don't show the context menu when resizing
2024-04-22 15:13:26 +02:00
Calixte Denizet
c57a0f38e9 [Editor] Don't show the context menu when resizing 2024-04-19 15:22:46 +02:00
Tim van der Meij
5ad42c13ad
Merge pull request #17964 from Snuffleupagus/addEventListener-signal
Remove *some* event listeners with `signal` in the viewer
2024-04-18 19:13:32 +02:00
Jonas Jenwald
ff2e0c8afd Skip the scroll/scrollend workaround in the Firefox PDF Viewer (PR 17724 follow-up)
Given that [bug 1881974](https://bugzilla.mozilla.org/show_bug.cgi?id=1881974) has been fixed in Firefox 126, the workaround should no longer be necessary in the *built-in* Firefox PDF Viewer.
2024-04-18 18:41:21 +02:00
Jonas Jenwald
46a29ff41b Remove event listeners with signal in web/app.js
By using the `signal` option when invoking `addEventListener`, see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal), we're able to remove an arbitrary number of event listeners with (effectively) a single line of code.
Besides getting rid of a bunch of `removeEventListener`-calls, which means shorter code, we no longer need to manually keep track of event-handling functions.
2024-04-18 18:41:21 +02:00
Jonas Jenwald
0788c4d918 Remove event listeners with signal in web/pdf_presentation_mode.js
By using the `signal` option when invoking `addEventListener`, see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal), we're able to remove an arbitrary number of event listeners with (effectively) a single line of code.
Besides getting rid of a bunch of `removeEventListener`-calls, which means shorter code, we no longer need to manually keep track of event-handling functions.
2024-04-18 18:41:18 +02:00
Tim van der Meij
aaa55d2b38
Merge pull request #17966 from timvandermeij/waitForTimeout
Remove `waitForTimeout` usage from the helper functions
2024-04-18 17:51:34 +02:00
Tim van der Meij
c2e9a6264c
Remove waitForTimeout usage from the dragAndDropAnnotation helper function
The timeout was introduced in commit 402e3fe with equal timeouts around
the helper function call. In commit 55e5af2 the timeouts around the
helper function call have been removed, and it looks like the helper
function itself was not updated purely due to an oversight.

The operations here should not require any timeouts because the promises
only resolve once the action is completed, which also explains why
removing the timeouts surrounding the helper function calls went without
any problems. It should therefore be safe to remove this timeout too.
2024-04-18 16:04:26 +02:00
Tim van der Meij
3f51da147c
Remove waitForTimeout usage from the clearInput helper function
We should wait until the input field's value is actually empty instead
of waiting for a fixed time (which could lead to intermittent failures).
2024-04-18 15:31:49 +02:00
calixteman
4866686749
Merge pull request #17914 from calixteman/freetext_edit
[Editor] Provide an element to render in the annotation layer after a freetext has been edited (bug 1890535)
2024-04-18 14:33:12 +02:00
Calixte Denizet
71ea8499f0 [Editor] Provide an element to render in the annotation layer after a freetext has been edited (bug 1890535) 2024-04-18 13:29:41 +02:00
Tim van der Meij
7290faf840
Merge pull request #17956 from calixteman/jpx_exceptions
[JPX] Throw an exception with the error messages returned by openjpeg
2024-04-16 20:48:23 +02:00
Tim van der Meij
921fae556e
Merge pull request #17951 from timvandermeij/fix-jpx-decoder
Fix `JpxImage` API issues (PR 17946 follow-up)
2024-04-16 19:09:46 +02:00
Calixte Denizet
ebcae3014c [JPX] Throw an exception with the error messages returned by openjpeg 2024-04-16 19:02:24 +02:00
Tim van der Meij
c08b09d3b9
Fix JpxImage API issues (PR 17946 follow-up)
This commit changes the `JpxImage.decode` method signature to define the
`ignoreColorSpace` argument as optional with a default value. Note that
we already set this default value in the `getBytes` method of the
`src/core/decode_stream.js` file since this option only seems useful for
certain special cases and therefore shouldn't be mandatory to provide.

Moreover, the JPX fuzzer is changed to use the new `JpxImage` API.
2024-04-16 18:02:47 +02:00
Tim van der Meij
801a0975f2
Merge pull request #17954 from calixteman/openjpeg_web
Build the openjpeg-based decoder in a web environment in order to avoid issues when used in node
2024-04-16 18:01:05 +02:00
Calixte Denizet
0149a8fc84 Build the openjpeg-based decoder in a web environment in order to avoid issues when used in node 2024-04-16 16:55:38 +02:00
Tim van der Meij
e7c45a001f
Merge pull request #17949 from Snuffleupagus/version-4.2
Bump library version to `4.2`
2024-04-16 14:07:34 +02:00
calixteman
12c4119cbd
Merge pull request #17946 from calixteman/openjpeg
[api-minor] Add a jpx decoder based on OpenJPEG 2.5.2
2024-04-16 13:41:58 +02:00
Calixte Denizet
2e83cfbbc1 [api-minor] Add a jpx decoder based on OpenJPEG 2.5.2
The decoder is compiled in WASM:
https://github.com/mozilla/pdf.js.openjpeg

Fixes #17289, #17061, #16485, #13051, #6365, #4648, #12213.
2024-04-16 12:54:36 +02:00
Jonas Jenwald
c6c60313f0 Bump library version to 4.2 2024-04-16 10:47:42 +02:00
Tim van der Meij
7bd7c6ca5a
Merge pull request #17947 from timvandermeij/scripting-intermittent
Fix the "must check that a field has the correct value when a choice is changed" scripting integration test
2024-04-15 16:19:58 +02:00
Tim van der Meij
0e612fbb7d
Fix the "must check that a field has the correct value when a choice is changed" scripting integration test
We should not wait for an arbitrary amount of time, which can easily
cause intermittent failures, but wait for a value change instead. Note
that this patch mirrors the approach we already use in other scripting
integration tests that also check for a value change; see e.g. the
"must check that a field has the correct formatted value" test.
2024-04-15 15:56:39 +02:00
Tim van der Meij
00af2e7b7a
Merge pull request #17942 from Snuffleupagus/Safari-16
[api-minor] Update the minimum supported Safari version to 16.4
2024-04-15 15:02:51 +02:00
Tim van der Meij
1008a53362
Merge pull request #17938 from timvandermeij/rimraf-test
Remove the `rimraf` dependency in favor of the built-in Node.js `fs.rmSync` in the test folder
2024-04-15 14:21:56 +02:00
Tim van der Meij
60f02ea5fe
Merge pull request #17940 from timvandermeij/scripting-test
Fix the "must check that invisible fields are made visible" scripting integration test
2024-04-15 14:20:34 +02:00
Jonas Jenwald
a41bb40fbb [api-minor] Update the minimum supported Safari version to 16.4
This patch updates the minimum supported browsers as follows:
 - Safari 16.4, which was released on 2023-03-27; see https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes

Nowadays we usually we try, where feasible and possible, to support browsers/environments that are about two years old. The reasons for limiting support to a slightly more recent Safari version include:
 - Safari has always been slower, compared to other browsers, at implementing e.g. new JavaScript features.
 - Trying to provide support for Safari is often difficult, and over the years we have seen *a lot* of bugs that are specific to Safari.
 - Safari is, and has been for many years, only listed as "mostly" supported in the FAQ.
 - This allows us to remove feature-testing, only relevant to Safari, from the main code-base.

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 core 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
2024-04-15 12:44:37 +02:00
Tim van der Meij
2e9bd496ce
Fix the "must check that invisible fields are made visible" scripting integration test
We should not wait for an arbitrary amount of time, which can easily
cause intermittent failures, but wait for a property value change
instead. Note that this patch mirrors the approach we already use in
other scripting integration tests that also check for a visibility
change; see e.g. the "must show a text field and then make in invisible
when content is removed" test.
2024-04-14 18:53:09 +02:00
Tim van der Meij
a562c41e12
Remove the rimraf dependency in favor of the built-in Node.js fs.rmSync in the test folder
In Node.js 14.14.0 the `fs.rmSync` function was added that removes files
and directories. The `recursive` option is used to remove directories
and their contents, making it a drop-in replacement for the `rimraf`
dependency we use.

Given that PDF.js now requires Node.js 18+ we can be sure that this
option is available, so we can safely remove `rimraf` and reduce the
number of project dependencies in the test folder.

This commit also gets rid of the indirection via the `removeDirSync`
test helper function by simply calling `fs.rmSync` directly.

Co-authored-by: Wojciech Maj <kontakt@wojtekmaj.pl>
2024-04-14 16:41:59 +02:00
Tim van der Meij
e08de772ff
Merge pull request #17879 from ex37/master
Improve type definitions for the viewer
2024-04-14 16:35:02 +02:00
Tim van der Meij
14947ad0ad
Merge pull request #17935 from timvandermeij/mkdirp
Remove the `mkdirp` dependency in favor of the built-in Node.js `fs.mkdirSync`
2024-04-14 16:34:13 +02:00
Eduard Ghazanchyan
da43a53a68 Improve type definitions for the viewer
This commit improves compatibility of the viewer code with TypeScript by including missing type imports/definitions and correcting existing ones
2024-04-12 17:12:04 +04:00
Tim van der Meij
13afff48f8
Remove the mkdirp dependency in favor of the built-in Node.js fs.mkdirSync
In Node.js 10.12.0 the `recursive` option was added to `fs.mkdirSync`.
This option allows us to create a directory and all its parent
directories if they do not exist, making it a drop-in replacement for
the `mkdirp` dependency we use.

Given that PDF.js now requires Node.js 18+ we can be sure that this
option is available, so we can safely remove `mkdirp` and reduce the
number of project dependencies.

Co-authored-by: Wojciech Maj <kontakt@wojtekmaj.pl>
2024-04-12 15:06:48 +02:00
Tim van der Meij
2e94511330
Merge pull request #17934 from calixteman/warn_invalid_name
Warn when a non-embedded font has an invalid name
2024-04-12 14:15:02 +02:00
Calixte Denizet
acc56491c9 Warn when a non-embedded font has an invalid name
It can be helpful to find out some heuristics when trying
to find a substitution font.
2024-04-12 13:59:18 +02:00
Tim van der Meij
e005e6ecdd
Merge pull request #17933 from Snuffleupagus/pr-17464-followup
Fix resetting of cursor-tools when closing the document (PR 17464 follow-up)
2024-04-12 13:32:52 +02:00
Tim van der Meij
2d885e2862
Merge pull request #17930 from calixteman/issue17929
Remove the tag for missing font subset when trying to find a substitution
2024-04-12 13:27:32 +02:00
Jonas Jenwald
60832fee27 Fix resetting of cursor-tools when closing the document (PR 17464 follow-up)
With the removal of the "secondarytoolbarreset" event in PR 17464 resetting of cursor-tools state accidentally broke.
2024-04-12 13:16:44 +02:00
Tim van der Meij
f0ad4f00ce
Merge pull request #17927 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-04-12 13:12:56 +02:00
Tim van der Meij
355432fc71
Merge pull request #17925 from timvandermeij/web-history-private-methods
Convert the history code to use proper private methods
2024-04-12 13:12:30 +02:00
Calixte Denizet
52ea2333b3 Remove the tag for missing font subset when trying to find a substitution
Fixes #17929.
2024-04-11 20:34:28 +02:00
Tim van der Meij
ac7bd17cf8
Update translations to the most recent versions 2024-04-11 19:48:32 +02:00
Tim van der Meij
5db84e7930
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`.
2024-04-11 19:48:31 +02:00
Tim van der Meij
b379b0e999
Upgrade eslint-plugin-unicorn to version 52.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v52.0.0
doesn't indicate any breaking changes that should impact us.
2024-04-11 19:48:31 +02:00
Tim van der Meij
28962da91b
Update dependencies to the most recent versions 2024-04-11 19:48:31 +02:00
Tim van der Meij
a45aec6393
Convert the history code to use proper private methods
This allows us to get rid of the `@private` JSDoc comments, which were
used to convey intent back when proper private methods could not be used
yet in JavaScript. This improves code readability/maintenance and enables
better usage validation by tooling such as ESlint.
2024-04-11 15:17:30 +02:00
Tim van der Meij
e78ce74b5f
Merge pull request #17924 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2024-04-11 14:52:11 +02:00
Tim van der Meij
09a8b981f2
Bump the stable version in pdfjs.config 2024-04-11 14:47:17 +02:00
Tim van der Meij
fcb76a78dd
Merge pull request #17893 from timvandermeij/find-integration-test
Fix the "must highlight text in the right position" integration test
2024-04-11 14:10:01 +02:00
Tim van der Meij
253a7333d8
Fix the "must highlight text in the right position" integration test
This commit implements the following improvements for the test:

- Replace the hardcoded highlight padding with a dynamic calculation. It
  turns out that the amount of padding can differ per system, possibly
  due to e.g. local (font) settings, which could cause the test to fail.
  The test now no longer implicitly depends on the environment.
- Remove the page offset subtraction. It's only needed for one assertion,
  and we can simply add the page offset there once.
- Improve the "magic" numbers in the test. The number 5 is removed now
  that the padding calculation made it obsolete, the number 28 is changed
  to 30 because that's the actual value in the PDF data and the number 4
  is explained a bit more to state that the space also counts as a glyph.
- Annotate the steps and checks to improve readability of the test and
  to explain why certain calculations have to be performed.
2024-04-11 13:42:08 +02:00