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

18846 commits

Author SHA1 Message Date
Tim van der Meij
bda98b91cb
Merge pull request #17967 from Snuffleupagus/eventBus-signal
Add `signal`-support in the `EventBus`, and utilize it in the viewer (PR 17964 follow-up)
2024-04-23 15:55:59 +02:00
Tim van der Meij
522af265a7
Merge pull request #17977 from Snuffleupagus/parseImageProperties-TypedArray
Update `JpxImage.parseImageProperties` to support TypedArray data in IMAGE_DECODERS builds
2024-04-22 18:31:31 +02:00
Jonas Jenwald
9e80c6d228
Merge pull request #17978 from Snuffleupagus/pr-17428-followup
Extend the globally cached image main-thread copying to "complex" images as well (PR 17428 follow-up)
2024-04-22 16:46:23 +02:00
calixteman
f6b0413506
Merge pull request #17985 from calixteman/openjpeg_warn
Use the pdf.js warn when using jpx decoder
2024-04-22 16:06:13 +02:00
Calixte Denizet
55f943c4fa Use the pdf.js warn when using jpx decoder
Fixes #17980.
2024-04-22 16:02:45 +02:00
Tim van der Meij
335d8394cd
Merge pull request #17979 from Snuffleupagus/image-errors-shorter-msg
[api-minor] Remove the image-related error message prefixes
2024-04-22 15:35:10 +02:00
calixteman
c22e64cd05
Merge pull request #17983 from calixteman/openjpeg_simd
Improve jpx decoding by around 20% in enabling simd support when compiling OpenJPEG
2024-04-22 15:33:02 +02:00
Tim van der Meij
22c27f8520
Merge pull request #17972 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-04-22 15:32:10 +02:00
calixteman
9d891883b7
Merge pull request #17970 from calixteman/delete_from_xref
Correctly update the xref table when an annotation is deleted
2024-04-22 15:22:01 +02:00
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
c730a50540 Improve jpx decoding by around 20% in enabling simd support when compiling OpenJPEG 2024-04-22 13:08:47 +02:00
Jonas Jenwald
32b885c5ef Remove event listeners with signal in web/annotation_layer_builder.js and web/text_highlighter.js 2024-04-21 09:41:21 +02:00
Jonas Jenwald
912b57b95d [api-minor] Remove the image-related error message prefixes
Other custom errors, based on `BaseException`, do not use such a format.
2024-04-20 12:51:45 +02:00
Jonas Jenwald
2831caef13 Remove event listeners with signal in web/pdf_scripting_manager.js 2024-04-20 12:00:58 +02:00
Jonas Jenwald
bf785f2180 Remove event listeners with signal in web/pdf_history.js 2024-04-20 12:00:58 +02:00
Jonas Jenwald
702ee7b1e1 Add signal-support in the EventBus, and utilize it in the viewer (PR 17964 follow-up)
This mimics the `signal` option that's available for `addEventListener`, see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal).
2024-04-20 12:00:58 +02:00
Jonas Jenwald
91898e5923 Extend the globally cached image main-thread copying to "complex" images as well (PR 17428 follow-up)
In PR 17428 this functionality was limited to "larger" images, to not affect performance negatively. However it turns out that it's also beneficial to consider more "complex" images, regardless of their size, that contain /SMask or /Mask data; see issue 11518.
2024-04-20 11:10:09 +02:00
Jonas Jenwald
8970786d5b Update JpxImage.parseImageProperties to support TypedArray data in IMAGE_DECODERS builds
Given that the `decode` method only returns the actual image-data, a user would now need to invoke `parseImageProperties` to obtain e.g. the width and height.
This method only accepts `BaseStream`-instances, which are (obviously) not exposed, hence we extend it in IMAGE_DECODERS builds to wrap TypedArray data into the expected format.
2024-04-20 09:38:52 +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
7affc7efa1
Update translations to the most recent versions 2024-04-19 14:57:04 +02:00
Tim van der Meij
0fdecb353d
Update dependencies to the most recent versions 2024-04-19 14:56:57 +02:00
Calixte Denizet
901d995a7e Correctly update the xref table when an annotation is deleted 2024-04-18 21:27:39 +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