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

19839 commits

Author SHA1 Message Date
Tim van der Meij
145951df88
Merge pull request #18404 from timvandermeij/fix-unit-intermittent
Fix the "caches image resources at the document/page level as expected (issue 11878)" unit test
2024-07-06 17:32:55 +02:00
alexcat3
1c364422a6 Handle toUnicode cmaps that omit leading zeros in hex encoded UTF-16 (issue 18099)
Add unit test to check compatability with such cmaps

In the PDF in issue 18099. the toUnicode cmap had a line to map the glyph char codes from 00 to 7F to the corresponding code points. The syntax to map a range of char codes to a range of unicode code points is
<start_char_code> <end_char_code> <start_unicode_codepoint>
As the unicode code points are supposed to be given in UTF-16 BE, the PDF's line SHOULD have probably read
<00> <7F> <0000>
Instead it omitted two leading zeros from the UTF-16 like this
<00> <7F> <00>
This confused PDF.js into mapping these character codes to the UTF-16 characters with the corresponding HIGH bytes (01 became \u0100, 02 became \u0200, et cetera), which ended up turning latin text in the PDF into chinese when it was copied
I'm not sure if the PDF spec actually allows PDFs to do this, but since there's at least one PDF in the wild that does and other PDF readers read it correctly, PDF.js should probably support this
2024-07-06 11:29:21 -04:00
Tim van der Meij
2a44203d96
Fix the "caches image resources at the document/page level as expected (issue 11878)" unit test
This unit test fails occasionally (albeit much less than before thanks
to PR #17663), so we change the parsing time check's divisor to prevent
it from happening again. If the last page's rendering time is less than
or equal to 50% of the first page's rendering time that should be enough
proof that no worker thread re-parsing occurred while also providing a
wide enough range to avoid intermittents.

Note that the assertion is now equal to the one we already have in the
"caches image resources at the document/page level, with main-thread
copying of complex images (issue 11518)" unit test which seems to work
reliably so far.
2024-07-06 16:30:07 +02:00
Tim van der Meij
bb3e3164e6
Merge pull request #18402 from Snuffleupagus/updatedPreference-move-listener
Move the "updatedPreference" event listener registration
2024-07-06 15:54:14 +02:00
Tim van der Meij
fe692435d3
Merge pull request #18401 from timvandermeij/test-orphaned-browsers
Fix orphaned browser processes due to uncaught exceptions in the tests
2024-07-06 15:43:26 +02:00
Jonas Jenwald
9e352a8bad Move the "updatedPreference" event listener registration
This patch fixes a situation that'll probably never happen, but nonetheless seems like something that we should address.
Currently the "updatedPreference" listener isn't registered *until after* the preferences have been read and initialized, which leaves a very short window of time where a preference change could theoretically be skipped.
2024-07-06 15:28:03 +02:00
Tim van der Meij
3afe2d3048
Fix orphaned browser processes due to uncaught exceptions in the tests
If uncaught exceptions occur in the tests (which happened in #17962 and
can be triggered manually by throwing an error in `integration-boot.js`)
the teardown logic of the tests doesn't get to run and thus spawned
browser processes are not closed properly. Given that `test.mjs` is the
only process that has a reference to them they will become orphaned and
keep running if `test.mjs` exits without explicitly closing them.

This commit fixes the issue by always closing the browsers if uncaught
exceptions occur, and we make sure to log them for debugging purposes.
2024-07-06 15:07:54 +02:00
calixteman
db9115625b
Merge pull request #18398 from calixteman/bug1905923
[Editor] Change the enableML pref for enableAltText (bug 1905923)
2024-07-05 22:51:15 +02:00
Tim van der Meij
7a5f5616f4
Merge pull request #18399 from timvandermeij/intermittent-charlimit
Fix the "must check that charLimit is correctly set" scripting integration test
2024-07-05 21:58:04 +02:00
calixteman
9f001058c3
Merge pull request #18397 from calixteman/toolbar_density
Allow to change the toolbar height when changing the pref toolbar.density in Firefox (bug 1171799)
2024-07-05 21:50:10 +02:00
Tim van der Meij
70b44251ed
Fix the "must check that charLimit is correctly set" scripting integration test
This integration test fails intermittently because we're not (correctly)
awaiting the character limit increase sandbox action.

For the first increase an attempt was made to handle this, but it doesn't
work correctly because the text in the field is `abcdefghijklmnopq` and
it's not be truncated until the sandbox action is completed, so because
we didn't await that we would could pass the `value !== "abcdefgh"` check
because `abcdefghijklmnopq !== abcdefgh` is true. For the second increase
we didn't have a check in place.

This commit fixes the issues by using the `waitForSandboxTrip` and
`waitForSelector` helper functions to make sure that we can only proceed
if the sandbox action is completed and the DOM element is updated.
2024-07-05 21:15:44 +02:00
Calixte Denizet
0fba6e570e [Editor] Change the enableML pref for enableAltText (bug 1905923)
We want to use this pref to make a Nimbus experiment in the next weeks.
2024-07-05 21:01:12 +02:00
Calixte Denizet
0910f17a58 Allow to change the toolbar height when changing the pref toolbar.density in Firefox (bug 1171799)
It's a first step to just dispatch the pref change to the toolbar.
The second one, to effectively use it, will come after PR #18385 is merged.
2024-07-05 18:59:29 +02:00
calixteman
e777ae2258
Merge pull request #18380 from calixteman/avoid_dbl_ml_queries
[Editor] Avoid to query ML engine several times for the same image
2024-07-05 17:44:31 +02:00
Tim van der Meij
ccb141e211
Merge pull request #18393 from Snuffleupagus/mustBeViewedWhenEditing-params
Check the relevant parameters inside of the `mustBeViewedWhenEditing` method
2024-07-05 15:33:45 +02:00
Tim van der Meij
cf9dfbc084
Merge pull request #18394 from Snuffleupagus/rm-annotation-getOperatorList-renderForms
Remove the `renderForms` parameter from the Annotation `getOperatorList` methods
2024-07-05 15:30:52 +02:00
Calixte Denizet
5274bab9f3 [Editor] Avoid to query ML engine several times for the same image 2024-07-05 13:43:11 +02:00
Jonas Jenwald
38528d1116 Remove the renderForms parameter from the Annotation getOperatorList methods
The `renderForms` parameter pre-dates the introduction of the general `intent` parameter, which means that we're now effectively passing the same state twice to these `getOperatorList` methods.
2024-07-05 12:25:18 +02:00
Jonas Jenwald
5f744904ac Check the relevant parameters inside of the mustBeViewedWhenEditing method
Similar to the `mustBeViewed` method, we can check the relevant parameters within the `mustBeViewedWhenEditing` method itself since that (in my opinion) slightly helps readability of the code in the `src/core/document.js` file.
2024-07-05 11:38:55 +02:00
Tim van der Meij
9065ee465b
Merge pull request #18387 from Snuffleupagus/RenderingIntentFlag-IS_EDITING
Move the internal API/Worker `isEditing`-state into `RenderingIntentFlag`
2024-07-04 23:42:44 +02:00
Jonas Jenwald
a4ffc1066c Move the internal API/Worker isEditing-state into RenderingIntentFlag
In *hindsight* this seems like a better idea, since it avoids the need to manually pass `isEditing` around as a boolean value.
Note that `RenderingIntentFlag` is *internal* functionality, not exposed in the official API, which means that it can be extended and modified as necessary.
2024-07-04 23:34:30 +02:00
calixteman
8c5b0191cf
Merge pull request #18389 from calixteman/remove_pref_stamp
[Editor] Remove the option enableStamp
2024-07-04 23:06:42 +02:00
Calixte Denizet
74cbfbd09f [Editor] Remove the option enableStamp 2024-07-04 22:01:35 +02:00
Tim van der Meij
790470c1aa
Merge pull request #18383 from calixteman/fix_print_test
Fix the integration tests related to printing
2024-07-04 11:34:06 +02:00
Tim van der Meij
03a0500dcf
Merge pull request #18374 from calixteman/test_editor_visible
Make sure the editor is visible before getting its rect
2024-07-04 11:14:27 +02:00
Calixte Denizet
53ddfd139f Fix the integration tests related to printing 2024-07-04 11:12:31 +02:00
Tim van der Meij
944f3acecd
Merge pull request #18367 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-07-04 11:12:25 +02:00
Jonas Jenwald
396231b90c
Merge pull request #15209 from Snuffleupagus/createDefaultPrefsFile
[Firefox] Generate a PDF.js default-prefs file that can be used directly in mozilla-central (bug 1905864)
2024-07-04 11:06:48 +02:00
calixteman
617f513806
Merge pull request #18369 from calixteman/bug1905623
Use vertical variant of a char when it's in a missing vertical font (bug 1905623)
2024-07-04 09:45:43 +02:00
Calixte Denizet
fd6d0be50f Make sure the editor is visible before getting its rect 2024-07-03 09:57:12 +02:00
Calixte Denizet
832fc93aa4 Use vertical variant of a char when it's in a missing vertical font (bug 1905623) 2024-07-03 09:46:54 +02:00
Tim van der Meij
4e8a015a78
Update translations to the most recent versions 2024-07-02 18:29:19 +02:00
Tim van der Meij
bb54e7e64c
Update dependencies to the most recent versions 2024-07-02 18:20:49 +02:00
Tim van der Meij
ccad2f889a
Merge pull request #18349 from Snuffleupagus/rm-renderTextLayer
[api-minor] Remove the deprecated `renderTextLayer` and `updateTextLayer` functions (PR 18104 follow-up)
2024-07-02 17:23:54 +02:00
calixteman
59620d3748
Merge pull request #18366 from calixteman/clean_switch_annot
[Editor] Make sure everything is cleaned up when we switch to annotation editor mode
2024-07-02 17:13:57 +02:00
Calixte Denizet
68175323f1 [Editor] Make sure everything is cleaned up when we switch to annotation editor mode 2024-07-02 16:54:19 +02:00
calixteman
4f1d4c6bd0
Merge pull request #18365 from calixteman/bump_4.5
Bump library version to 4.5
2024-07-02 15:50:36 +02:00
calixteman
c154b1da23
Update pdfjs.config
Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com>
2024-07-02 15:46:05 +02:00
Calixte Denizet
2060944bda Bump library version to 4.5 2024-07-02 15:08:43 +02:00
calixteman
bdcc4a0feb
Merge pull request #18134 from calixteman/hide_annotations
[api-minor][Editor] When switching to editing mode, redraw pages containing editable annotations (bug 1883884)
2024-07-02 15:05:42 +02:00
Jonas Jenwald
033623c8d6 Update the year in the license_header files 2024-07-02 14:34:59 +02:00
Jonas Jenwald
ecb39a75ed [Firefox] Generate a PDF.js default-prefs file that can be used directly in mozilla-central (bug 1905864) 2024-07-02 14:12:23 +02:00
Calixte Denizet
64635f3b35 [api-minor][Editor] When switching to editing mode, redraw pages containing editable annotations
Right now, editable annotations are using their own canvas when they're drawn, but
it induces several issues:
 - if the annotation has to be composed with the page then the canvas must be correctly
   composed with its parent. That means we should move the canvas under canvasWrapper
   and we should extract composing info from the drawing instructions...
   Currently it's the case with highlight annotations.
 - we use some extra memory for those canvas even if the user will never edit them, which
   the case for example when opening a pdf in Fenix.

So with this patch, all the editable annotations are drawn on the canvas. When the
user switches to editing mode, then the pages with some editable annotations are redrawn but
without them: they'll be replaced by their counterpart in the annotation editor layer.
2024-07-02 14:11:40 +02:00
calixteman
75129fd61a
Merge pull request #18361 from calixteman/issue18360.pdf
[Editor] Take into account the page translation when computing the quadpoints when saving an highlight
2024-07-02 11:21:06 +02:00
Calixte Denizet
576aaf7cc1 [Editor] Take into account the page translation when computing the quadpoints when saving an highlight
It fixes #18360.
2024-07-02 10:12:26 +02:00
Tim van der Meij
c280c520ee
Merge pull request #18359 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2024-07-01 20:14:50 +02:00
Tim van der Meij
2f4d5d25a8
Bump the stable version in pdfjs.config 2024-07-01 20:10:35 +02:00
Tim van der Meij
19fbc89985
Merge pull request #18358 from timvandermeij/npm-url
Fix the repository URL in the `package.json` file for `pdfjs-dist`
2024-07-01 19:55:07 +02:00
Tim van der Meij
bf5dd7ea10
Fix the repository URL in the package.json file for pdfjs-dist
For provenance, enabled in PR #18352, to work the repository URL in
`package.json` is required to match the repository URL of the GitHub
Actions invocation. This should fix the following error we encountered
publishing a new release today:

```
npm error 422 Unprocessable Entity - PUT https://registry.npmjs.org/pdfjs-dist - Error verifying sigstore provenance bundle: Failed to validate repository information: package.json: "repository.url" is "git+https://github.com/mozilla/pdfjs-dist.git", expected to match "https://github.com/mozilla/pdf.js" from provenance
```
2024-07-01 19:32:03 +02:00
Tim van der Meij
7114796430
Merge pull request #18352 from wojtekmaj/provenance
Generate provenance statements on npm publish
2024-07-01 17:42:16 +02:00