Commit Graph

18662 Commits

Author SHA1 Message Date
Jonas Jenwald
eb5e6e68d6
Merge pull request #17663 from Snuffleupagus/pr-17428-test
Tweak the issue 11878 unit-test parsing time check (PR 17428 follow-up)
2024-02-12 14:14:29 +01:00
calixteman
f0343dcfdb
Merge pull request #17662 from calixteman/bug1879108
[Editor] Set rotated free highlight at the right position after having changed its thickness (bug 1879108)
2024-02-12 12:41:43 +01:00
Jonas Jenwald
19ef3e367b Tweak the issue 11878 unit-test parsing time check (PR 17428 follow-up)
This unit-test has been failing occasionally in Chrome and Node.js, hence we tweak the parsing time check to reduce the likelihood of that happening.
2024-02-12 12:31:55 +01:00
Jonas Jenwald
18959e80be
Merge pull request #17661 from timvandermeij/modernize-webserver
Modernize the webserver code (part 1)
2024-02-12 11:50:24 +01:00
Jonas Jenwald
4ab0ad3216 Move the __non_webpack_import__ re-writing into the Babel plugin
Note how we're using custom `__non_webpack_import__`-calls in the code-base, that we replace during the post-processing stage of the build, to be able to write `import`-calls that Webpack will leave alone during parsing.
This work-around is necessary since we let Babel discards all comments, given that we generally don't need/want them in the builds, hence why we cannot utilize `/* webpackIgnore: true */`-comments in the source-code.

After the changes in PR 17563 it thus seems to me that we should be able to just move this re-writing into the Babel plugin instead.
2024-02-12 10:49:43 +01:00
Jonas Jenwald
d742daf4b7
Merge pull request #17647 from Snuffleupagus/babel-rm-empty-nodes
Remove empty, top-level, nodes in the Babel plugin
2024-02-12 09:25:59 +01:00
Calixte Denizet
de1985abbb [Editor] Set rotated free highlight at the right position after having changed its thickness (bug 1879108) 2024-02-11 21:06:56 +01:00
Tim van der Meij
ce4fe0c234
Extract and modernize the webserver's directory listing code
The `handler` method contained this code in an inline function, which
made the `handler` method big and harder to read. Moreover, this code
relied on variables from the outer scope, which made it harder to reason
about because the inputs and outputs weren't easily visible.

This commit fixes the problems by extracting the directory listing code
into a dedicated private method, and modernizing it to use e.g. `const`/
`let` instead of `var` and using template strings.
2024-02-11 20:06:21 +01:00
calixteman
5cfaff508c
Merge pull request #17651 from calixteman/add_enableStamp_pref
Revert "Remove the `enableStampEditor` preference" (bug 1879588)
2024-02-11 18:53:09 +01:00
calixteman
f15b4b34fd
Merge pull request #17650 from calixteman/editor_highlight_keyboard
[Editor] Add a way to highlight text in using the keyboard (bug 1877426)
2024-02-11 18:52:37 +01:00
calixteman
9980447d25
Merge pull request #17652 from calixteman/editor_disable_thickness
[Editor] Disable the thickness slider for non-free highlight
2024-02-11 18:32:36 +01:00
Tim van der Meij
336fcffd28
Extract and modernize the webserver's range file serving code
The `handler` method contained this code in an inline function, which
made the `handler` method big and harder to read. Moreover, this code
relied on variables from the outer scope, which made it harder to reason
about because the inputs and outputs weren't easily visible.

This commit fixes the problems by extracting the range file serving code
into a dedicated private method, and modernizing it to use e.g. `const`/
`let` instead of `var` and using template strings.
2024-02-11 17:04:38 +01:00
Tim van der Meij
56d9930a7b
Extract and modernize the webserver's file serving code
The `handler` method contained this code in an inline function, which
made the `handler` method big and harder to read. Moreover, this code
relied on variables from the outer scope, which made it harder to reason
about because the inputs and outputs weren't easily visible.

This commit fixes the problems by extracting the file serving code into
a dedicated private method, and modernizing it to use e.g. `const`/`let`
instead of `var` and using template strings.
2024-02-11 17:04:30 +01:00
Tim van der Meij
12b9685714
Convert the webserver to a proper class with private methods 2024-02-11 16:56:53 +01:00
Tim van der Meij
440208daa6
Merge pull request #17658 from Snuffleupagus/ESLint-more-rules
Enable the `no-new-symbol` and `require-yield` ESLint rules
2024-02-11 13:50:33 +01:00
Jonas Jenwald
8f67ea6dc6 Enable the no-new-symbol and require-yield ESLint rules
Given that we use both `Symbol`s and generator functions in the code-base enabling these rules cannot hurt (and there's no existing failures). Please find additional information at:
 - https://eslint.org/docs/latest/rules/no-new-symbol
 - https://eslint.org/docs/latest/rules/require-yield
2024-02-11 13:27:22 +01:00
Tim van der Meij
4b7382edcb
Merge pull request #17657 from Snuffleupagus/eslint-jasmine-no-dupes
Prevent duplicate names in unit/integration tests
2024-02-11 12:18:31 +01:00
Tim van der Meij
422e46dae9
Merge pull request #17655 from timvandermeij/updates
Update translations and dependencies to the most recent versions
2024-02-11 12:09:54 +01:00
Jonas Jenwald
5732faee1e Prevent duplicate names in unit/integration tests
Having identical names for different test-cases may result in less helpful output, which we can avoid with the use of the ESLint Jasmine plugin.
This patch enables the rules at the `branch` level, to limit the amount/scope of the changes slightly. (We could thus make this rule more strict in the future, if that's deemed useful.)

Please refer to:
 - https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/no-spec-dupes.md
 - https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/no-suite-dupes.md
2024-02-11 11:45:09 +01:00
Jonas Jenwald
485e9cecd7
Merge pull request #17646 from Snuffleupagus/app-break-import-cycles
Break import cycles, in the viewer, for `PDFViewerApplication`
2024-02-10 23:22:49 +01:00
Jonas Jenwald
e98b9b019a Break import cycles, in the viewer, for PDFViewerApplication
Currently the `web/app.js` file pulls in various build-specific dependencies, via the use of import maps, and those files in turn import from `web/app.js` thus creating undesirable import cycles.
To avoid this we instead pass in a `PDFViewerApplication`-reference, immediately after it's been created, to the relevant code.

Note that we use an ESLint plugin rule, see `import/no-cycle`, that is normally able to catch import cycles. However, in this case import maps are involved which is why this wasn't caught.
2024-02-10 23:15:57 +01:00
Tim van der Meij
28418598e5
Update puppeteer to version 22.0.0
This is a major version bump that requires two changes on our side:

- The new headless mode is now the default, so we can remove our
  transformation code (see https://github.com/puppeteer/puppeteer/pull/11815).
- The `page.waitForTimeout` API is removed. Sadly we still used it in
  the integration tests (but fortunately much less than before we worked
  on fixing intermittent failures), so until we remove the final
  occurrences we provide an implementation ourselves (see
  https://github.com/puppeteer/puppeteer/pull/11780).

The full changelog can be found here:
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v22.0.0
2024-02-10 19:05:36 +01:00
Tim van der Meij
4feab0c1fa
Update gulp-postcss to version 10.0.0
This is a major version bump, but the breaking changes don't affect us;
please see https://github.com/postcss/gulp-postcss/releases/tag/10.0.0.
2024-02-10 19:05:28 +01:00
Tim van der Meij
29a665981a
Update eslint-plugin-unicorn to version 51.0.1
This is a major version bump, but the breaking changes don't affect us;
please see https://github.com/sindresorhus/eslint-plugin-unicorn/releases.
2024-02-10 19:04:54 +01:00
Tim van der Meij
913c2caf37
Update globals to version 14.0.0
This is a major version bump, but the breaking changes don't affect us;
please see https://github.com/sindresorhus/globals/releases/tag/v14.0.0.
2024-02-10 19:04:50 +01:00
Tim van der Meij
7da6f94ca3
Update dependencies to the most recent versions 2024-02-10 19:04:48 +01:00
Tim van der Meij
b278a74b6b
Update translations to the most recent versions 2024-02-10 19:04:46 +01:00
Calixte Denizet
b5e446213e [Editor] Disable the thickness slider for non-free highlight 2024-02-09 22:54:53 +01:00
Calixte Denizet
8fc6c5c8a6 [Editor] Add a way to highlight text in using the keyboard (bug 1877426) 2024-02-09 22:52:24 +01:00
Calixte Denizet
bcc95460b6 Revert "Remove the enableStampEditor preference" (bug 1879588)
This reverts commit e820688510.
2024-02-09 18:21:21 +01:00
Jonas Jenwald
14ef0b4211 Remove empty, top-level, nodes in the Babel plugin
Looking at the *built* files you'll notice some lines containing nothing more than a semicolon. This is the result of (mostly top-level) `if`-statements, which include `PDFJSDev`-checks, that evalute to `false` during Babel parsing.

This has always annoyed me a bit, and looking at Babel plugin it seems that we can fix this simply by *removing* the relevant nodes.
2024-02-09 13:58:24 +01:00
calixteman
7cfcd00a38
Merge pull request #17645 from calixteman/update_quickjs_3f81070e573e3592728dbbbd04c84c498b20d6dc
Update quickjs to 3f81070e573e3592728dbbbd04c84c498b20d6dc
2024-02-09 13:56:21 +01:00
Calixte Denizet
275b6748b6 Update quickjs to 3f81070e573e3592728dbbbd04c84c498b20d6dc
According to:
3f81070e57
this is a new release of quickjs.
2024-02-09 11:51:24 +01:00
calixteman
964bfe522b
Merge pull request #17643 from calixteman/bug1879113
[Editor] Compute the position of the last point before applying rotation (bug 1879113)
2024-02-08 21:30:22 +01:00
Calixte Denizet
8d61fc1fde [Editor] Compute the position of the last point before applying rotation (bug 1879113) 2024-02-08 21:08:24 +01:00
Jonas Jenwald
0d5183a49f
Merge pull request #17634 from Snuffleupagus/rm-preprocessor-require
Remove support for `require` statements from the build system
2024-02-08 16:22:17 +01:00
calixteman
939134ee55
Merge pull request #17639 from calixteman/bug1879102
[Editor] Correctly rotate the mask when rotation a free highlight (bug 1879102)
2024-02-08 16:13:58 +01:00
Calixte Denizet
c4ac7eef95 [Editor] Correctly rotate the mask when rotation a free highlight (bug 1879102) 2024-02-08 15:29:29 +01:00
calixteman
d7479a59b7
Merge pull request #17638 from calixteman/bug1879107
[Editor] Set the right color to size samples in the highlight thickness panelwhen in HCM (bug 1879107)
2024-02-08 15:25:14 +01:00
Calixte Denizet
3f68a08ef3 [Editor] Set the right color to size samples in the highlight thickness panelwhen in HCM (bug 1879107) 2024-02-08 14:31:10 +01:00
Jonas Jenwald
6da9448f6c Remove the web-com import map (PR 17588 follow-up)
With the changes in PR 17588 we're already importing the relevant code via the `web/app.js` file.
2024-02-07 16:33:27 +01:00
Jonas Jenwald
898172e9d2 Re-factor PDFPrintServiceFactory to use import maps
This is very old code, which can (ever so slightly) be simplified now that import maps are available.
2024-02-07 16:33:25 +01:00
Jonas Jenwald
6a78cf0d93 Remove support for require statements from the build system
This part of the (modern) preprocessor is now dead code, since we no longer use `require` statements anywhere in the main code-base.

Note that as part of the changes leading up to PDF.js version `4` we removed all[1] the remaining `require` statements, and we also have an ESLint rule to ensure that no new ones are accidentally added.

---
[1] With two small exceptions, in benchmarking-code and in the Webpack-example.
2024-02-07 13:34:46 +01:00
calixteman
60fd9d583d
Merge pull request #17611 from calixteman/caret_browsing_mode
Implement caret browsing mode (bug 807730)
2024-02-07 10:16:52 +01:00
Calixte Denizet
81466ee039 Implement caret browsing mode (bug 807730)
The users will be able to navigate within the pdf in using the arrows
and they'll be able to select some text, for example in order to
highlight it.
2024-02-07 09:35:22 +01:00
Tim van der Meij
7d9cc49010
Merge pull request #17620 from Snuffleupagus/PDFDataTransportStream-signature
Simplify the signature of the `PDFDataTransportStream` constructor
2024-02-04 15:24:26 +01:00
Jonas Jenwald
06cd278808 Simplify the signature of the PDFDataTransportStream constructor
Given that we need to pass in a `PDFDataRangeTransport`-instance a number of the needed parameters can be obtained from it, rather than having to specify them manually.
2024-02-03 13:10:42 +01:00
Jonas Jenwald
247af2ee09
Merge pull request #17619 from Snuffleupagus/string-split-limit
Use a limit, in more places, when splitting strings
2024-02-02 15:04:12 +01:00
Jonas Jenwald
363dce6744 Use a limit, in more places, when splitting strings
This should be a *tiny* bit more efficient, since it avoids parsing substrings that we don't care about.

*Please note:* I cannot find an ESLint rule to enforce this automatically.
2024-02-02 13:10:52 +01:00
Jonas Jenwald
af4d2fa53c
Merge pull request #17610 from Snuffleupagus/createBundleFallback-dev-path
Point the *development mode* fallback locale-path to the `l10n`-folder (issue 17609, PR 17603 follow-up)
2024-02-01 14:22:19 +01:00