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

20014 commits

Author SHA1 Message Date
Jonas Jenwald
c771ac81cd Add a new helper, in the viewer, to close everything during testing
This has two advantages, as far as I'm concerned:
 - The tests don't need to manually invoke multiple functions to properly clean-up, which reduces the risk of missing something.
 - By collecting all the relevant clean-up in one method, rather than spreading it out, we get a much better overview of exactly what is being reset.
2024-06-19 13:48:08 +02:00
calixteman
c53f71a7d2
Merge pull request #18284 from calixteman/editor_signal
[Editor] Remove the various listeners when destroying the editor manager
2024-06-19 12:36:38 +02:00
Jonas Jenwald
df058edf22 Update the regular expression in tweakWebpackOutput to support minified-legacy builds (issue 18290) 2024-06-19 12:21:10 +02:00
Calixte Denizet
390afcb685 [Editor] Remove the various listeners when destroying the editor manager 2024-06-19 10:33:52 +02:00
calixteman
9dbe4c246b
Merge pull request #18286 from calixteman/call_sandbox
Avoid to call a function in the js sandbox when it has been destroyed
2024-06-18 22:53:16 +02:00
Calixte Denizet
4bdbf4bb3d Avoid to call a function in the js sandbox when it has been destroyed 2024-06-18 22:30:21 +02:00
Tim van der Meij
58dd289971
Upgrade eslint-plugin-unicorn to version 54.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v54.0.0
doesn't indicate any breaking changes that should impact us.
2024-06-18 21:49:38 +02:00
Tim van der Meij
c77dbe0496
Update dependencies to the most recent versions 2024-06-18 21:49:34 +02:00
Tim van der Meij
4b5d5a557c
Merge pull request #18280 from calixteman/issue18279
Pause l10n (i.e. disconnect the mutation observer in fluent) when closing the viewer
2024-06-18 21:47:06 +02:00
Calixte Denizet
34389d4e47 Pause l10n (i.e. disconnect the mutation observer in fluent) when closing the viewer 2024-06-18 21:08:47 +02:00
Tim van der Meij
0d8828f93d
Merge pull request #18282 from Snuffleupagus/issue-18274
Don't save modified documents, when running tests, upon closing the viewer (issue 18274)
2024-06-18 20:55:27 +02:00
Jonas Jenwald
9e811b97b1 Don't save modified documents, when running tests, upon closing the viewer (issue 18274) 2024-06-18 20:05:11 +02:00
Tim van der Meij
c521351338
Merge pull request #18260 from calixteman/dumpio
Enable dumpio when running the tests in order to have some useful debug data
2024-06-18 19:39:59 +02:00
Tim van der Meij
2f462a8afe
Merge pull request #18277 from calixteman/issue18276
[Editor] Fix intermittent failure in integration test when highlighting with the keyboard
2024-06-18 19:34:59 +02:00
calixteman
45762c2f0e
Merge pull request #18275 from calixteman/fix_stamp_css_odd_spread
[Editor] Set the canvas in the stamp editor at the right position in odd spread mode
2024-06-18 18:51:25 +02:00
Calixte Denizet
acf8600a3d [Editor] Set the canvas in the stamp editor at the right position in odd spread mode 2024-06-18 18:44:29 +02:00
Calixte Denizet
4cc77f1470 [Editor] Fix intermittent failure in integration test when highlighting with the keyboard 2024-06-18 18:29:25 +02:00
Jonas Jenwald
701325896a
Merge pull request #18273 from Snuffleupagus/addLocallyCachedImageOps
Add a helper function for handling locally cached image data (PR 18269 follow-up)
2024-06-18 18:11:19 +02:00
Calixte Denizet
3c02dc6d1d Enable dumpio when running the tests in order to have some useful debug data 2024-06-18 18:03:26 +02:00
Jonas Jenwald
604e8977e9 Add a helper function for handling locally cached image data (PR 18269 follow-up)
This avoids having to duplicate the same exact code multiple times.
2024-06-18 17:20:40 +02:00
calixteman
4c041586fb
Merge pull request #18271 from calixteman/clean_before_closing
Clean up before closing the tab in integration tests
2024-06-18 16:55:53 +02:00
Tim van der Meij
4c82438e61
Merge pull request #18269 from Snuffleupagus/issue-18259
Ensure that dependencies are added to the operatorList for locally cached images (issue 18259)
2024-06-18 15:07:07 +02:00
Tim van der Meij
c07dd17162
Merge pull request #18270 from Snuffleupagus/issue-18264
Only use the l10n fallback bundle when normal ftl-file fetching failed (issue 18264)
2024-06-18 14:53:45 +02:00
Calixte Denizet
43be717ce3 Clean up before closing the tab in integration tests 2024-06-18 14:23:19 +02:00
Jonas Jenwald
22ca7d52d3 Ensure that dependencies are added to the operatorList for locally cached images (issue 18259) 2024-06-18 12:25:53 +02:00
Jonas Jenwald
0981716bfa Only use the l10n fallback bundle when normal ftl-file fetching failed (issue 18264) 2024-06-18 11:54:49 +02:00
calixteman
06800cd966
Merge pull request #18255 from calixteman/disable_hwa_only_for_mc
Only disable HWA in m-c build and for local dev
2024-06-16 21:47:34 +02:00
Tim van der Meij
56c396556f
Merge pull request #18257 from calixteman/update_openjpeg_1
Update jpx decoder
2024-06-16 20:44:26 +02:00
Tim van der Meij
ff44c3be1f
Merge pull request #18258 from timvandermeij/release-reproducible
Implement reproducibility for the release builds
2024-06-16 20:39:38 +02:00
Tim van der Meij
44e0fae9d1
Implement reproducibility for the release builds
The release builds are currently not reproducible because ZIP files
record the modification date of files generated during the build
process, meaning that two builds from identical source code, made
at different times, result in different output.

This is undesirable because it makes detecting differences in the output
harder, for instance recently during the Gulp 5 efforts, because the
modification date differences are irrelevant and could obscure actually
important differences in the output during e.g. code changes. Moreover,
reprodicibility of build artifacts has become increasingly important;
please refer to the Reproducible Builds initiative at
https://reproducible-builds.org (note the "Why does it matter?" section
specifically) and https://reproducible-builds.org/docs/timestamps which
further explains the problem of timestamps in build artifacts.

This commit fixes the issue by configuring the ZIP file creation to use
the (fixed) date of the last Git commit for which the release is being
made. With this the build is fully reproducible so that identical source
code builds result in bit-by-bit identical output artifacts.

To improve readability we convert the compression method to take a
parameter object and use template strings where useful.
2024-06-16 20:32:55 +02:00
Calixte Denizet
7255b75ee9 Update jpx decoder
The decoder has been updated to reduce the number of copies after
having decoded an image:
b4ba3b3090
2024-06-16 19:05:26 +02:00
Jonas Jenwald
7b0c0347d0
Merge pull request #18254 from Snuffleupagus/force-save
Ensure that saving, in the viewer, works for partially loaded documents
2024-06-16 17:26:26 +02:00
Tim van der Meij
ee94391794
Merge pull request #18256 from timvandermeij/jsdoc-reproducible
Implement reproducibility for the JSDoc builds
2024-06-16 16:08:56 +02:00
Tim van der Meij
9d0002555d
Implement reproducibility for the JSDoc builds
The JSDoc builds are currently not reproducible because a timestamp is
included in the output, meaning that two builds from identical source
code, made at different times, result in different output.

This is undesirable because it makes diffing the output difficult, for
instance recently during the Gulp 5 efforts, because the timestamp
differences are irrelevant and could obscure actually important
differences in the output during e.g. code changes. Moreover,
reprodicibility of build artifacts has become increasingly important;
please refer to the Reproducible Builds initiative at
https://reproducible-builds.org (note the "Why does it matter?" section
specifically) and https://reproducible-builds.org/docs/timestamps which
further explains the problem of timestamps in build artifacts.

This commit fixes the issue by configuring JSDoc to not include the
timestamps in the output. It's not relevant for end users and without it
the build is fully reproducible so that identical source code builds
result in bit-by-bit identical output artifacts.

Note that this option sadly can only be set via a configuration file,
and not via the command line parameters like we used to have, so for
consistency we also move the other options into the configuration file
so they are all in one place and the Gulpfile becomes a bit simpler.
2024-06-16 15:10:34 +02:00
calixteman
f8acd33527
Merge pull request #18253 from calixteman/bug1539074
Compute correctly the unitsPerEm value from the fontMatrix when converting a font (bug 1539074)
2024-06-16 12:17:10 +02:00
Calixte Denizet
52a06e64f6 Only disable HWA in m-c build and for local dev
This way, we keep pdf.js working as before except for Firefox.
2024-06-16 12:14:33 +02:00
Jonas Jenwald
f4912db2ae Remove the _ensureDownloadComplete helper method in web/app.js
After the previous commit this method has only a single call-site, hence we can inline the needed part of that check directly in `PDFViewerApplication.download` instead.
2024-06-15 18:00:18 +02:00
Jonas Jenwald
7c5e9cf8be Ensure that saving, in the viewer, works for partially loaded documents
Currently saving a modified PDF document may fail *intermittently*, if it's triggered before the entire document has been downloaded.
When saving was originally added we only supported forms, and such PDF documents are usually small/simple enough for this issue to be difficult to trigger. However, with editing-support now available as well it's possible to modify much larger documents and this issue thus becomes easier to trigger.

One way to reproduce this issue *consistently* is to:
 - Open http://localhost:8888/web/viewer.html?file=/test/pdfs/pdf.pdf#disableHistory=true&disableStream=true&disableAutoFetch=true
 - Add an annotation on the first page, it doesn't matter what kind.
 - Save the document.
 - Open the resulting document, and notice that with the `master` branch the annotation is missing.
2024-06-15 17:58:58 +02:00
Calixte Denizet
d1452206d9 Compute correctly the unitsPerEm value from the fontMatrix when converting a font (bug 1539074) 2024-06-15 17:51:34 +02:00
Tim van der Meij
2effc96021
Merge pull request #18250 from Snuffleupagus/api-misc-fixes
Improve some old code in the `src/display/api.js` file
2024-06-15 15:46:44 +02:00
Tim van der Meij
ebb2db7be1
Merge pull request #18251 from timvandermeij/docs-api-inline
Include the generated API documentation directly on the API page
2024-06-15 15:34:27 +02:00
Tim van der Meij
e30dda5261
Include the generated API documentation directly on the API page
This should make the API documentation slightly quicker to access for
users by removing an extra click. Moreover, it makes the API
documentation blend in with the rest of the website/theme (one of the
points in #6526).

Fixes #18249.
2024-06-15 15:13:01 +02:00
Jonas Jenwald
f3f88eecb4 Use an AbortController to remove the temporary "error" handler for the worker 2024-06-15 14:35:32 +02:00
Jonas Jenwald
2d0e08f1c8 Introduce a helper method for resolving the PDFWorker promise
This avoids having to repeat the same code multiple times, since besides resolving the promise we also need to send the "configure" message to the worker-thread.
2024-06-15 14:35:30 +02:00
Jonas Jenwald
8d4456172b Reduce duplication when handling the "test" message from the worker
The feature-testing on the worker-thread has been simplified in previous pull requests, which means that we can simplify this main-thread handler as well.
2024-06-15 14:35:28 +02:00
Jonas Jenwald
0a36b667e4 Use an early return in PDFWorker.prototype._initialize when workers are disabled
This helps reduce overall indentation in the method, thus leading to slightly less code.
Also, remove an old comment referring to Chrome 15 since that's no longer relevant now.
2024-06-15 14:35:12 +02:00
Jonas Jenwald
d6612b3427 Remove some now redundant validation in getDocument
Given that we now check/validate all options properly this old code can be simplified.
2024-06-15 14:35:10 +02:00
Tim van der Meij
831a526c10
Merge pull request #18248 from timvandermeij/metalsmith
Replace Wintersmith with Metalsmith
2024-06-15 12:19:35 +02:00
Tim van der Meij
ce7cdf4670
Replace Wintersmith with Metalsmith
Wintersmith is no longer maintained given that the most recent version
is from six years ago, and all vulnerabilities that NPM reports
originate from Wintersmith's dependencies. Metalsmith, and its plugins,
on the other hand have recently had releases and don't have known
vulnerabilities. In fact, the number of reported vulnerabilities by NPM
even goes down to zero with this patch applied.

This commit therefore replaces Wintersmith with Metalsmith by providing
a transparent drop-in replacement, in a way that requires the least
amount of changes to the code and the generated output.

Note that this patch does update our versions of jQuery, Bootstrap and
the Highlight.js theme because the previous versions were very outdated
and didn't work correctly with Metalsmith. Moreover, those old versions
contained vulnerabilities that are hereby fixed.

Fixes #18198.
2024-06-14 20:37:13 +02:00
Tim van der Meij
7279ce6bad
Merge pull request #18247 from timvandermeij/readme
Don't recommend installing `gulp-cli` globally in the README and on the website
2024-06-14 20:26:12 +02:00