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

20562 commits

Author SHA1 Message Date
Yeoh Joer
2221ccf160 Add the missing return type for PDFWorker.fromPort() 2025-02-28 02:49:44 +08:00
Jonas Jenwald
b5ac96da19 Don't bundle the FakeMLManager class in regular builds
Given that this functionality is only used in the development viewer and in TESTING builds, there's no reason to include this in the regular builds.
2025-02-27 12:59:58 +01:00
Jonas Jenwald
50c573d16d
Merge pull request #19563 from Snuffleupagus/loadType3Data-once
Invoke `TranslatedFont.prototype.loadType3Data` only *once* per font
2025-02-27 11:20:26 +01:00
Jonas Jenwald
56a683bc3b
Merge pull request #19562 from Snuffleupagus/issue-19550
Extend `getGlyphMapForStandardFonts` with some Cyrillic entries (issue 19550)
2025-02-27 11:17:42 +01:00
Jonas Jenwald
4a48a7ec0f
Merge pull request #19557 from Snuffleupagus/PDFViewer-cleanupTimeouts
Abort various timeouts, in `PDFViewer`, when closing the document (PR 19128 follow-up)
2025-02-27 11:17:02 +01:00
Jonas Jenwald
21829f4157
Merge pull request #19556 from Snuffleupagus/_initializeViewerComponents-more-local-vars
Use more local variables in `PDFViewerApplication._initializeViewerComponents`
2025-02-27 11:16:04 +01:00
Jonas Jenwald
4e76a78341
Merge pull request #19549 from Snuffleupagus/fewer-EXPORT_DATA_PROPERTIES-2
[api-minor] Stop exporting, by default, a few additional Font properties (PR 11777 follow-up)
2025-02-27 11:15:27 +01:00
calixteman
a4fea2dafd
Merge pull request #19565 from calixteman/signature_fix_telemetry
[Editor] Fix the telemetry for the signature stuff
2025-02-27 10:10:13 +01:00
Calixte Denizet
bbf9bfc3c2 [Editor] Fix the telemetry for the signature stuff 2025-02-27 09:34:31 +01:00
Jonas Jenwald
bdfa96878d Invoke TranslatedFont.prototype.loadType3Data only *once* per font
Currently we're first loading the font, and then for Type3 fonts we're invoking `loadType3Data` every time that the font is encountered.
That seems completely unnecessary, and it's probably connected to the age of this code, since the `loadType3Data`-method will only run once anyway (note the caching).
2025-02-26 15:17:11 +01:00
Jonas Jenwald
da17c7b82f
Merge pull request #19548 from Snuffleupagus/Font-exportData-disableFontFace-fontExtraProperties
Send `disableFontFace` and `fontExtraProperties` as part of the exported font-data
2025-02-26 11:25:29 +01:00
Jonas Jenwald
59cb9a064e Extend getGlyphMapForStandardFonts with some Cyrillic entries (issue 19550) 2025-02-26 10:16:06 +01:00
Jonas Jenwald
0e0872288e
Merge pull request #19558 from Snuffleupagus/RenderingCancelledException-null-#renderError
Reset `#renderError` on `RenderingCancelledException` (PR 19128 follow-up)
2025-02-26 09:43:39 +01:00
Hector Rincon
4069c3a422 Reenable viewerCssTheme option for Firefox
The `viewerCssTheme` was removed in #17222  and subsequently reenabled in #17293,
but only for Chromium and generic builds. This commit reenables the
function using the new method introduced in #17293.
2025-02-25 22:00:32 -08:00
Jonas Jenwald
d50d3b0b0e Reset #renderError on RenderingCancelledException (PR 19128 follow-up)
This restores the behaviour that existed prior to PR 19128, see e.g. 8727a04ae5/web/pdf_page_view.js (L908-L911), since `RenderingCancelledException` should still overwrite any previously seen Error.
2025-02-25 16:46:01 +01:00
Jonas Jenwald
71ad9fd0b7 Abort various timeouts, in PDFViewer, when closing the document (PR 19128 follow-up)
Looking at recent integration-test logs there's occasionally warnings about trying to invoke `PDFViewer.prototype.update` too late, which probably started with PR 19128 (see log excerpt below).
Given that we already had another timeout before that PR the problem was pre-existing, but it seems to trigger more easily now.

```
JavaScript warning: http://127.0.0.1:42333/build/generic/web/viewer.mjs, line 12668: Script terminated by timeout at:
update@http://127.0.0.1:42333/build/generic/web/viewer.mjs:12668:9
@http://127.0.0.1:42333/build/generic/web/viewer.mjs:12373:12
setTimeout handler*_scrollUpdate@http://127.0.0.1:42333/build/generic/web/viewer.mjs:12371:29
viewAreaElementScrolled@http://127.0.0.1:42333/build/generic/web/viewer.mjs:154:15
FrameRequestCallback*debounceScroll@http://127.0.0.1:42333/build/generic/web/viewer.mjs:140:18
EventListener.handleEvent*watchScroll@http://127.0.0.1:42333/build/generic/web/viewer.mjs:165:19
PDFViewer@http://127.0.0.1:42333/build/generic/web/viewer.mjs:11777:19
_initializeViewerComponents@http://127.0.0.1:42333/build/generic/web/viewer.mjs:15081:23
initialize@http://127.0.0.1:42333/build/generic/web/viewer.mjs:14931:16
async*run@http://127.0.0.1:42333/build/generic/web/viewer.mjs:15227:16
webViewerLoad@http://127.0.0.1:42333/build/generic/web/viewer.mjs:17078:24
@http://127.0.0.1:42333/build/generic/web/viewer.mjs:17082:3
```
2025-02-25 13:11:51 +01:00
Jonas Jenwald
cec32c6177 Use more local variables in PDFViewerApplication._initializeViewerComponents
This, ever so slightly, shortens the code which can never hurt.
2025-02-25 12:33:13 +01:00
Jonas Jenwald
aa70b28365
Merge pull request #19555 from rossj/master
Pad rev 4 encryption keys to be >= 16 bytes (issue 19484)
2025-02-25 10:03:56 +01:00
calixteman
e999f77959
Merge pull request #19554 from calixteman/signature_telemetry
[Editor] Add some telemetry for the signature editor (bug 1945827)
2025-02-24 22:53:49 +01:00
Ross Johnson
4f25d7f6cd Fix decryption of R=4, V=4 files with < 16-byte keys by 0-padding - undocumented but matches Acrobat behavior (issue #19484) 2025-02-24 15:36:37 -06:00
Calixte Denizet
9e672ff05e [Editor] Add some telemetry for the signature editor (bug 1945827) 2025-02-24 21:10:04 +01:00
calixteman
fef706233d
Merge pull request #19551 from Snuffleupagus/loadSystemFont-fix-assert
Fix the `assert` in `FontLoader.prototype.loadSystemFont`
2025-02-24 16:49:03 +01:00
calixteman
12d2f1b04a
Merge pull request #19552 from calixteman/add_generated_header_openjpeg
Add a comment 'THIS FILE IS GENERATED - DO NOT EDIT' in openjpeg files generated with emscripten
2025-02-24 16:17:48 +01:00
Jonas Jenwald
2966171a2b Fix the assert in FontLoader.prototype.loadSystemFont
Currently this `assert` isn't actually doing what it's supposed to, since the `FontLoader`-class doesn't have a `disableFontFace`-field.
The `FontFaceObject`-class on the other hand has such a field, hence we update the method-signature to be able to check the intended thing.
2025-02-24 16:09:07 +01:00
calixteman
f9aa8e1d15
Merge pull request #19539 from calixteman/paste_signature
[Editor] Shift the signature editor when pasted
2025-02-24 16:07:50 +01:00
Calixte Denizet
c099245daa Add a comment 'THIS FILE IS GENERATED - DO NOT EDIT' in openjpeg files generated with emscripten 2025-02-24 16:05:19 +01:00
Jonas Jenwald
132ccf04db [api-minor] Stop exporting, by default, a few additional Font properties (PR 11777 follow-up)
None of the "composite", "subtype", or "type" properties are normally used on the main-thread and/or in the API, hence there's no need to include them in the exported font-data by default.
Given that these properties may still be useful when debugging, and that `debugger.mjs` actually relies on the "type" property, they will instead only be sent to the main-thread when the `fontExtraProperties` API-option is used.
2025-02-24 12:27:51 +01:00
Jonas Jenwald
c4784832ac
Merge pull request #19545 from hecerinc/hecerinc/issueLinkFix
Fix the link for issue5939.pdf
2025-02-24 10:08:15 +01:00
Jonas Jenwald
d428db63c3 Improve the "FontFallback" handling on the worker-thread
Remove the `Catalog.prototype.fontFallback` method, and move its code into `PDFDocument.prototype.fontFallback` instead, to reduce the indirection a little bit.
Pass the `evaluatorOptions` directly to the `TranslatedFont.prototype.fallback` method, since nothing else in the `TranslatedFont`-class needs it now.
2025-02-24 09:34:58 +01:00
Jonas Jenwald
839e23f5c2 Send disableFontFace and fontExtraProperties as part of the exported font-data
These options are needed in the `FontFaceObject` class, and indirectly in `FontLoader` as well, which means that we currently need to pass them around manually in the API.
Given that the options are (obviously) available on the worker-thread, it's very easy to just provide them when creating `Font`-instances and then send them as part of the exported font-data. This way we're able to simplify the code (primarily on the main-thread), and note that `Font`-instances even had a `disableFontFace`-field already (but it wasn't properly initialized).
2025-02-24 09:34:48 +01:00
Hector Rincon
c19e70f6d9 Fix the link for issue5939.pdf
Web archive no longer has the revision for the saved PDF referenced in
that test case, so this updates that link to a more recent revision to
enable the tests to run on a clean clone.
2025-02-23 15:15:11 -08:00
Jonas Jenwald
ed64faa88c
Merge pull request #19543 from timvandermeij/integration-tests-helpers
Refactor the editor integration test helper functions
2025-02-23 22:56:38 +01:00
Calixte Denizet
cc3d6ab539 [Editor] Shift the signature editor when pasted
The idea is to avoid to have the pasted editor hidding the copied one:
the user could think that nothing happened.
So the top-left corner of the pasted one is moved to the bottom-right corner of the copied one.
2025-02-23 21:35:01 +01:00
Tim van der Meij
acc5a2153a
Introduce a generic clearEditors helper function
This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
2025-02-23 20:49:04 +01:00
Tim van der Meij
f155b69c07
Introduce a generic selectEditors helper function
This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
2025-02-23 20:48:24 +01:00
Tim van der Meij
060ef0e15e
Deduplicate the waitForPointerUp helper function in the highlight editor integration tests
The helper function is available in `test_utils.mjs` since commit
3fe55ba, so we can remove the local copy by importing it.
2025-02-23 20:48:17 +01:00
Tim van der Meij
07629e105c
Deduplicate the getXY helper function in the highlight editor integration tests
The helper function is available in `test_utils.mjs` since commit
301f1bb, so by exporting it there it can be reused.
2025-02-23 20:48:17 +01:00
Tim van der Meij
4f3dbcf24d
Remove the waitForEditorMovedInDOM helper function export
It's no longer used outside of `test_utils.mjs` since commit 301f1bb.
2025-02-23 20:48:17 +01:00
Tim van der Meij
fcf94e8c38
Merge pull request #19542 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-02-23 20:47:10 +01:00
Tim van der Meij
33c53dfaa9
Update translations to the most recent versions 2025-02-23 19:31:20 +01:00
Tim van der Meij
cd6c5b009f
Upgrade globals to version 16.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/globals/releases/tag/v16.0.0
doesn't indicate any breaking changes that should impact us.
2025-02-23 19:31:20 +01:00
Tim van der Meij
8b0f1641ee
Upgrade eslint-plugin-unicorn to version 57.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v57.0.0
doesn't indicate any breaking changes that should impact us.

However, we do replace the deprecated `no-instanceof-array` rule with
the new `no-instanceof-builtins` rule. Note that the changelog calls
this rule `no-instanceof-builtin-object`, but it got renamed in
https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2537.
2025-02-23 19:28:28 +01:00
Tim van der Meij
08ba910ef0
Update dependencies to the most recent versions 2025-02-23 18:21:50 +01:00
calixteman
878d206c79
Merge pull request #19538 from calixteman/move_draw
[Editor] Fix the position in the page of a drawing after it has been moved with the keyboard
2025-02-22 15:55:26 +01:00
Calixte Denizet
301f1bbf2b [Editor] Fix the position in the page of a drawing after it has been moved with the keyboard
When a drawing was moved with arrow keys and then printed or saved, the drawing wasn't moved finally.
So the fix is just about calling onTranslated once the translation is done.
2025-02-22 15:19:14 +01:00
Jonas Jenwald
a648e1e769
Merge pull request #19537 from Snuffleupagus/api-useWasm
[api-minor] Re-factor how the `useWorkerFetch` option is used internally
2025-02-22 14:16:31 +01:00
Tim van der Meij
23d7398371
Merge pull request #19531 from stof/patch-1
Disable the loading of node types in the type tests
2025-02-22 13:47:44 +01:00
Jonas Jenwald
637e95985a Simplify JpxImage.setOptions a little bit
After PR 19392 we're only invoking this method *once* per document, hence the early-return branch shouldn't be necessary any more.
2025-02-22 13:38:10 +01:00
Jonas Jenwald
641e2f506e [api-minor] Re-factor how the useWorkerFetch option is used internally
With the recently added OpenJPEG no-wasm fallback we need to send the `wasmUrl` option to the worker-thread *regardless* of the value of the `useWorkerFetch` option, since the fallback won't work if we don't have a URL to `import` it from.
For consistency the code is re-factored to always send the factory-urls to the worker-thread, and simply check the `useWorkerFetch` option there instead.

Also, as a follow-up to PR 19525, introduce a new `useWasm` option that can be used in e.g. browser-tests to forcibly disable WebAssembly usage.
2025-02-22 09:56:53 +01:00
Jonas Jenwald
6d3bb47655
Merge pull request #19525 from calixteman/bug1935076_part2
Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076)
2025-02-22 09:34:40 +01:00