Commit Graph

14582 Commits

Author SHA1 Message Date
Brendan Dahl
6cf1ee3251
Merge pull request #13858 from brendandahl/xfa-aria-label
Add aria-labels to XFA form elements. (bug 1723422)
2021-08-03 17:18:08 -07:00
Brendan Dahl
6ea56f35ab Add aria-labels to XFA form elements. (bug 1723422) 2021-08-03 15:58:33 -07:00
Tim van der Meij
b317e9311d
Merge pull request #13846 from Snuffleupagus/test-xfa
Add a special `gulp xfatest` command, to limit the ref-tests to only XFA-documents (issue 13744)
2021-08-03 23:47:30 +02:00
Jonas Jenwald
844319cdb0 Add a special gulp xfatest command, to limit the ref-tests to only XFA-documents (issue 13744)
The new command is a *variation* of the standard `gulp test` command and will run all unit/font/integration-tests just as normal, while *only* running ref-tests for XFA-documents to speed up development.
Given that we currently have (some) unit-tests for XFA-documents, and that we may also (in the future) want to add integration-tests, it thus makes sense to run all test-suites in my opinion.

*Please note:* Once this patch has landed, I'll submit a follow-up patch to https://github.com/mozilla/botio-files-pdfjs such that we can also run the new command on the bots.
2021-08-03 23:41:10 +02:00
Tim van der Meij
85be62c684
Merge pull request #13854 from Snuffleupagus/issue-13851
Prevent breaking errors when an optional content group is undefined (issue 13851)
2021-08-03 23:34:34 +02:00
Tim van der Meij
ad90fe90ed
Merge pull request #13848 from Snuffleupagus/rm-lgtm
Remove the LGTM configuration and inline disable comments (issue 13829)
2021-08-03 23:13:05 +02:00
Tim van der Meij
892af51269
Merge pull request #13859 from Snuffleupagus/refactor-EOF
Remove the `isEOF` helper function and slightly re-factor `EOF`
2021-08-03 23:11:10 +02:00
Jonas Jenwald
ad702d7088
Merge pull request #13860 from mozilla/dependabot/npm_and_yarn/tar-4.4.15
Bump tar from 4.4.8 to 4.4.15
2021-08-03 22:20:32 +02:00
dependabot[bot]
81a6ade590
Bump tar from 4.4.8 to 4.4.15
Bumps [tar](https://github.com/npm/node-tar) from 4.4.8 to 4.4.15.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.8...v4.4.15)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-03 19:41:11 +00:00
Jonas Jenwald
766299016f Remove the isEOF helper function and slightly re-factor EOF
Given how trivial the `isEOF` function is, we can simply inline the check at the various call-sites and remove the function (which ought to be ever so slightly more efficient as well).
Furthermore, this patch also changes the `EOF` primitive itself to a `Symbol` instead of an Object since that has the nice benefit of making it unclonable (thus preventing *accidentally* trying to send `EOF` from the worker-thread).
2021-08-03 20:19:32 +02:00
calixteman
0b95d698d8
Merge pull request #13852 from calixteman/xfa_print_1
XFA - Page can be too small when printing (bug 1723705)
2021-08-03 16:28:26 +02:00
Jonas Jenwald
d5e14d3dc3 Prevent breaking errors when an optional content group is undefined (issue 13851)
In the referenced PDF document *most* of the form `/Form` XObjects don't have an `/OC` entry, which thus causes the runtime failure during rendering.
2021-08-03 15:59:29 +02:00
Calixte Denizet
19309c1f28 XFA - Page can be too small when printing (bug 1723705) 2021-08-03 15:07:33 +02:00
Jonas Jenwald
d5302315ce
Merge pull request #13847 from Snuffleupagus/issue-13835
Remove useless assignment of `availableSpace` in the `src/core/xfa/template.js` file (issue 13829, 13835)
2021-08-03 11:49:01 +02:00
Jonas Jenwald
8fef8630fe Remove the LGTM configuration and inline disable comments (issue 13829)
Given that the GitHub Advanced Security workflow now covers everything that LGTM does, but generally faster and with better GitHub-integration, there's no longer much point in also running LGTM separately.
As a follow-up to this patch, we should also disable/remove the LGTM-integration from the PDF.js repository.
2021-08-03 11:14:49 +02:00
Jonas Jenwald
705d1cfad3 Remove useless assignment of availableSpace in the src/core/xfa/template.js file (issue 13829, 13835) 2021-08-03 10:58:57 +02:00
Jonas Jenwald
01fd0f59b7
Merge pull request #13842 from Rob--W/text-selection-br
Visually hide br in text selections
2021-08-01 21:30:53 +02:00
Jonas Jenwald
bcdf006a71
Merge pull request #13841 from Rob--W/crx-viewerCssTheme
Allow customization of theme in Chrome extension + set default theme
2021-08-01 20:32:56 +02:00
Rob Wu
1eeb153688 Visually hide br in text selections
Fixes #13840
2021-08-01 19:42:05 +02:00
Rob Wu
a51b4a9cb0 [CRX] Use dark theme by default in Chrome extension
Default to the dark theme for consistency with the previous version of the
published extension (was 12ff252751).
2021-08-01 19:37:49 +02:00
Rob Wu
867150e4f0 [CRX] Add option to customize Theme in options UI
The `viewerCssTheme` option was not rendered because its entry in
`preferences_schema.json` did not have a `title`.

The order of keys in `preferences_schema.json` determines the order of the
rendered preferences in the options UI. Since `viewerCssTheme` affects the UI
very significantly, I have moved the option to the top.
2021-08-01 18:54:49 +02:00
Tim van der Meij
4cdac66663
Merge pull request #13839 from Snuffleupagus/issue-13838
Fix a broken regular expression in the `docId` unit-test (issue 13838, PR 13813 follow-up)
2021-08-01 18:40:32 +02:00
Jonas Jenwald
16a09eaed8 Fix a broken regular expression in the docId unit-test (issue 13838, PR 13813 follow-up)
The current regular expression contains a typo, leading to intermittent test-failures for certain `docId`s; sorry about that!
2021-08-01 15:18:25 +02:00
Tim van der Meij
273cea8675
Merge pull request #13837 from timvandermeij/unit-test-query-string
Implement unit tests for the `parseQueryString` utility function
2021-08-01 14:26:33 +02:00
Tim van der Meij
d1c0f8f91c
Implement unit tests for the parseQueryString utility function
Now that these unit tests are in place, we also take the opportunity to
slightly modernize the code itself by using a `for ... of` loop.
2021-08-01 14:14:33 +02:00
Tim van der Meij
449f941b7b
Merge pull request #13831 from Snuffleupagus/parseQueryString-Map
Change the `parseQueryString` function to return a `Map` rather than an Object (issue 13829)
2021-08-01 12:21:43 +02:00
Jonas Jenwald
1ea8cfa2f2
Merge pull request #13836 from timvandermeij/cmaps
Fix inefficient regular expressions in `external/cmapscompress/parse.js`
2021-08-01 12:20:51 +02:00
Tim van der Meij
0d84f57cfa
Fix inefficient regular expressions in external/cmapscompress/parse.js
The only purpose, according to the README and existing files, is to
parse an integer from those lines, so (\d+) is sufficient for that. This
avoids potential exponential backtracking as flagged by CodeQL. I have
compared the output of the script with and without these changes and the
resulting files are the same.
2021-08-01 12:12:42 +02:00
Jonas Jenwald
4483cba724
Merge pull request #13833 from tamuratak/add_peer_dep_meta_for_worker_loader
Make worker-loader optional as peerDependencies. Close #13825.
2021-08-01 11:28:59 +02:00
Takashi Tamura
9eca5e5c86 Make worker-loader optional as peerDependencies. Close #13825.
- https://docs.npmjs.com/cli/v7/configuring-npm/package-json#peerdependencies
- https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/
- https://docs.npmjs.com/cli/v7/configuring-npm/package-json#peerdependenciesmeta

Update worker-loader to v3.0.8.
2021-08-01 17:44:31 +09:00
Jonas Jenwald
4ab4efd42f Change the parseQueryString function to return a Map rather than an Object (issue 13829)
Even though the code as-is *should* be safe, given that we're using an Object with a `null` prototype, it cannot hurt to change this to a Map to prevent any issues (since we're parsing unknown and potentially unsafe data).

Overall I also think that these changes improve the `parseQueryString` call-sites, since we now have a proper way of checking for the existence of a particular key (and don't have to use `in` which stringifies the keys in the Object).

This patch also changes the default, when no `value` exists, from `null` to an empty string since the use of `decodeURIComponent` currently can modify the value in a somewhat surprising way (at least to me).
Note how `decodeURIComponent(null) === "null"` which is unlikely to be what you actually want, whereas `decodeURIComponent("") === ""` which seems much more helpful.
2021-07-31 23:24:49 +02:00
Jonas Jenwald
222c9e7e84
Merge pull request #13830 from timvandermeij/codeql
Improve the code analysis workflow with quality checks
2021-07-31 16:25:24 +02:00
Tim van der Meij
574fed2bdf
Improve the code analysis workflow with quality checks
This allows us to get the quality checks that LGTM does into GitHub
Advanced Security. Since it not only runs security checks anymore, the
workflow is also renamed to CodeQL to make this more explicit (and this
matches the documentation better).
2021-07-31 15:33:07 +02:00
Tim van der Meij
3ec1bac901
Merge pull request #13828 from timvandermeij/github-advanced-security
Introduce the GitHub Advanced Security workflow
2021-07-31 13:44:24 +02:00
Tim van der Meij
5a08d62e76
Improve the CI workflow YAML file
This makes it consistent with the GitHub Advanced Security file and,
more importantly, ensures that all steps have a proper name for better
visibility.
2021-07-31 13:33:14 +02:00
Mathew Payne
4774858d3c
Introduce the GitHub Advanced Security workflow
This can help to find security problems sooner.
2021-07-31 13:32:22 +02:00
Tim van der Meij
10a1db6980
Merge pull request #13824 from Snuffleupagus/issue-13823
When no "V" entry exists, let the fieldValue fallback to the "DV" entry (issue 13823)
2021-07-30 22:48:38 +02:00
Tim van der Meij
67f4c34f63
Merge pull request #13822 from Snuffleupagus/ReadableStreams-cancel-no-Uncaught_promise
Prevent "Uncaught promise" messages in the console when cancelling (some) `ReadableStream`s
2021-07-30 22:09:29 +02:00
Tim van der Meij
99b14a9da0
Merge pull request #13813 from Snuffleupagus/rm-closure-API
Remove a couple of closures in the `src/display/api.js` file
2021-07-30 21:55:45 +02:00
Tim van der Meij
314a1365bc
Merge pull request #13816 from Snuffleupagus/rm-BaseViewer-enableScripting-option
[api-minor] Remove the separate `enableScripting` option in `BaseViewer`
2021-07-30 21:49:14 +02:00
Jonas Jenwald
ff71be793d When no "V" entry exists, let the fieldValue fallback to the "DV" entry (issue 13823) 2021-07-30 16:17:42 +02:00
calixteman
649d091167
Merge pull request #13819 from calixteman/xfa_exdata
XFA - Avoid an error when an exdata is a string (bug 1723114)
2021-07-30 16:12:32 +02:00
Calixte Denizet
7bb5331087 XFA - Avoid an error when an exdata is a string (bug 1723114) 2021-07-30 14:43:53 +02:00
Jonas Jenwald
1df9da949e Prevent "Uncaught promise" messages in the console when cancelling (some) ReadableStreams
While fixing issue 13794, I noticed that cancelling the `ReadableStream` returned by the `PDFPageProxy.streamTextContent`-method could lead to "Uncaught promise" messages in the console.[1]
Generally speaking, we don't really care about errors when *cancelling* a `ReadableStream` and it thus seems reasonable to simply suppress any output in those cases.

---
[1] Although, after that issue was fixed you'd now need to set the API-option `stopAtErrors = true` to actually trigger this.
2021-07-30 14:27:38 +02:00
Jonas Jenwald
5fac0a4350 Simplify some code related to fallbackWorkerSrc and getMainThreadWorkerMessageHandler 2021-07-30 11:34:47 +02:00
Jonas Jenwald
4c679d80ac Remove the closure used with the InternalRenderTask class
This patch utilizes the same approach as used in lots of other parts of the code-base, which thus *slightly* reduces the size of this code.
2021-07-30 11:34:47 +02:00
Jonas Jenwald
b18620ac0f Remove the closure used with the PDFDocumentLoadingTask class
This patch utilizes the same approach as used in lots of other parts of the code-base, which thus *slightly* reduces the size of this code.

By removing some of the (current) indirection, we can also simplify the JSDocs a little bit. Looking at the `gulp jsdoc` output, this actually seem to *improve* the documentation for this class.
2021-07-30 11:34:47 +02:00
Jonas Jenwald
76c805f83b [api-minor] Remove the separate enableScripting option in BaseViewer
Prior to PR 13042, when scripting wasn't really possible to use outside of the full viewer, the `enableScripting` option made sense.
However, at this point in time having to both pass in a `PDFScriptingManager`-instance *and* set the `enableScripting`-boolean when creating a `BaseViewer`-instance feels redundant and (mostly) annoying. Hence this patch, which removes the *separate* boolean and always enables scripting when `scriptingManager` is provided.

The relevant "viewer component" examples are also updated (with a comment), but in such a way that scripting support won't just break when used with the current PDF.js releases.
2021-07-29 10:06:03 +02:00
Brendan Dahl
4ad5c5d52a
Merge pull request #13808 from brendandahl/pattern-cache-v2
Improve caching of shading patterns. (bug 1721949)
2021-07-28 11:17:16 -07:00
calixteman
edbe9692b4
Merge pull request #13815 from calixteman/xfa_fonts2
XFA - Fix font scale factors (bug 1720888)
2021-07-28 19:45:45 +02:00