Commit Graph

17170 Commits

Author SHA1 Message Date
Jonas Jenwald
94c2d08975 Revert "Add a getArrayLookupTableFactory helper function and use it to re-format src/core/{glyphlist, unicode}.js"
This reverts commit 56fa6d414c now that SystemJS is gone.
2023-04-29 13:43:24 +02:00
Jonas Jenwald
95bf9fc17f Remove SystemJS usage, in development mode, from the worker
Now that https://bugzilla.mozilla.org/show_bug.cgi?id=1247687 has landed in Firefox, we're able to use worker-modules during development :-)

This removes the final piece of SystemJS usage from the PDF.js library, thus allowing a fair bit of clean-up, and we now use *only* native `import`/`export` statements everywhere in development mode.
2023-04-29 13:43:24 +02:00
Tim van der Meij
797f8d3dca
Merge pull request #16370 from Snuffleupagus/publish-website-only-master
Limit the `publish_website.yml` work-flow to only the `master` branch (issue 16369)
2023-04-29 11:36:33 +02:00
Tim van der Meij
16017d6669
Merge pull request #16371 from Snuffleupagus/issue-16366
Include the entire `git` history in the work-flows (issue 16366)
2023-04-29 11:34:51 +02:00
Jonas Jenwald
7c1e505f6a Include the entire git history in the work-flows (issue 16366)
Without this change we're not able to correctly determine the version number, please refer to https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
2023-04-29 10:50:37 +02:00
Jonas Jenwald
09edd6657f Limit the publish_website.yml work-flow to only the master branch (issue 16369)
This is a tentative patch, based on https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#using-filters
2023-04-28 10:31:52 +02:00
Jonas Jenwald
f28d915a42
Merge pull request #16362 from SebCorbin/update-types
Update type documentations for #16307, #16359
2023-04-28 10:19:08 +02:00
Sebastien Corbin
d18b9ee472 Update type documentations for #16307 and #16359 2023-04-28 09:28:21 +02:00
Marco Castelluccio
9eea9993df
Merge pull request #16364 from timvandermeij/github-pages
Introduce a GitHub Actions workflow for publishing the website
2023-04-27 23:17:16 +02:00
calixteman
de42ecb59f
Merge pull request #16365 from calixteman/chmod_1
Chmod ugo-x gv-toolbarButton-download.svg
2023-04-27 20:33:16 +02:00
Calixte Denizet
263ef59fc7 Chmod ugo-x gv-toolbarButton-download.svg 2023-04-27 20:27:27 +02:00
Tim van der Meij
30ca27ac48
Introduce a GitHub Actions workflow for publishing the website
This commit migrates this functionality away from the bots. Nowadays
it's possible to build and deploy the website to GitHub Pages directly
through the GitHub Actions, which provides a nice simplication of the
process. Not only does this remove the requirement to have a `gh-pages`
branch in the repository, it also avoids the complexity of having to
configure the workflow to commit to Git branches and allows us to remove
the Git committing code from the Gulpfile.

Note that deploying directly though GitHub Actions workflows needs to be
enabled in the repository settings, but this is easy and well documented
on the link below.

The following resources are relevant for this patch:

- Enabling deployment to GitHub Pages directly through GitHub Actions:
  https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
- Uploading GitHub Pages artifacts example:
  https://github.com/actions/upload-pages-artifact#usage
- Deploying GitHub Pages artifacts example:
  https://github.com/actions/deploy-pages#usage
2023-04-27 19:18:03 +02:00
calixteman
4dee3b83d5
Merge pull request #16344 from calixteman/intermittent_integration_test
Fix two intermittents issues in integration tests
2023-04-27 17:18:41 +02:00
Jonas Jenwald
cefa8c601a
Merge pull request #16361 from timvandermeij/jsdoc-pdfvieweroptions
Declare the `linkService` and `l10n` properties as optional in the `PDFViewerOptions` documentation
2023-04-27 17:16:32 +02:00
Tim van der Meij
8259fb4d2f
Declare the linkService and l10n properties as optional in the PDFViewerOptions documentation
Both properties have a fallback to `SimpleLinkService` respectively
`NullL10n` if no other value is provided explicitly.
2023-04-27 15:39:29 +02:00
Tim van der Meij
34ee77396c
Merge pull request #16356 from Snuffleupagus/issue-16355
Update the styling of the findbar `findMsg`-element (issue 16355)
2023-04-27 14:23:18 +02:00
Tim van der Meij
0ee0fcc6b3
Merge pull request #16350 from Snuffleupagus/dist-rm-lib
[api-minor] Stop including the "lib"-build in the `pdfjs-dist` repository
2023-04-27 14:01:55 +02:00
Tim van der Meij
a86265f7b7
Merge pull request #16354 from Snuffleupagus/crypto-less-stringToBytes
Avoid some repeated `stringToBytes`-calls in the `src/core/crypto.js` file
2023-04-27 14:00:50 +02:00
Tim van der Meij
13b168f1bb
Merge pull request #16357 from Snuffleupagus/network-rm-getXhr
Remove the unused `getXhr`-option in the `NetworkManager` constructor
2023-04-27 13:59:23 +02:00
Jonas Jenwald
924a8901d1 Remove the unused getXhr-option in the NetworkManager constructor
Originally this file was shared, using pre-processor statements, between the generic PDF.js library and the *built-in* Firefox PDF Viewer. In the latter case the `getXhr`-option is being used, see https://searchfox.org/mozilla-central/rev/f32d5f3949a3f4f185122142b29f2e3ab776836e/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#612-621
2023-04-27 11:32:32 +02:00
Jonas Jenwald
89ea6b3bb6 Update the styling of the findbar findMsg-element (issue 16355)
This patch tries to mimic the look of the message-element in the Firefox browser-findbar, and thus makes the following changes:
 - Remove the red colour, since it didn't take the light/dark themes into account.
 - Display the "notFound" message in bold.
2023-04-26 22:11:02 +02:00
Jonas Jenwald
e12535457f Avoid some repeated stringToBytes-calls in the src/core/crypto.js file
Currently we repeatedly lookup, and convert to bytes, the "O" and "U" encryption-dictionary entries.
2023-04-26 17:52:46 +02:00
Jonas Jenwald
62a9435190 [api-minor] Stop including the "lib"-build in the pdfjs-dist repository
The `pdfjs-dist/lib/` directory contains a README file that explicitly advises against using those files, however based on a fairly large number of issues filed over the years users seem to be (mostly) overlooking that warning.
In particular it unfortunately seems to be somewhat common for users to attempt to "combine" proper builds from `pdfjs-dist/build/` together with individual components from the `pdfjs-dist/lib/web/` directory, which more often than not leads to subtle bugs and general problems.

When we receive bug reports about this it's often not immediately obvious what the problem is, given that many issues lack enough details (such as runnable test-cases), but after some back-and-forth it usually turns out that usage of `pdfjs-dist/lib/` is the culprit.
Considering that keeping the general PDF.js library working is challenging and time-consuming enough nowadays, this patch thus proposes that we stop including the "lib"-build in the `pdfjs-dist` repository to both reduce user confusion and the support burden.
2023-04-26 12:11:13 +02:00
Jonas Jenwald
598408b7af
Merge pull request #16347 from Snuffleupagus/getAllTextInProgress-no-copy
Prevent incomplete copy-all behaviour while text-extraction is running (PR 16286 follow-up)
2023-04-26 08:24:17 +02:00
Jonas Jenwald
2de6fd8e70 Prevent incomplete copy-all behaviour while text-extraction is running (PR 16286 follow-up)
Currently we only prevent triggering the actual text-extraction multiple times in "parallel", when using the "copy all text" feature, however the "copy"-event itself is not prevented.
The result is that if the user selects all text in a long PDF document and then uses the copy-shortcut multiple times in quick succession, we'll actually populate the clipboard with "incomplete" contents (via a `TextLayerBuilder` copy-listener) until all text-extraction finishes.
2023-04-25 21:39:16 +02:00
Calixte Denizet
b4264e9648 Fix two intermittents issues in integration tests 2023-04-25 12:31:36 +02:00
Jonas Jenwald
495819fbc6
Merge pull request #16333 from Snuffleupagus/enablePermissions-allow-text-selection
Allow text-selection, but not copying, when `enablePermissions` is set (PR 16320 follow-up)
2023-04-25 11:32:21 +02:00
Jonas Jenwald
8a9d7a18cc Allow text-selection, but not copying, when enablePermissions is set (PR 16320 follow-up) 2023-04-25 11:07:05 +02:00
calixteman
1b79b0cd21
Merge pull request #16340 from calixteman/gv_new_toolbar
[GeckoView] Change the toolbar for a static one on the top of the viewer (bug 1829366)
2023-04-24 14:35:35 +02:00
Calixte Denizet
e00d26798c [GeckoView] Change the toolbar for a static one on the top of the viewer (bug 1829366) 2023-04-24 14:03:23 +02:00
Tim van der Meij
28f96d2ac2
Merge pull request #16336 from timvandermeij/custom-event
Don't use the deprecated `CustomEvent.initCustomEvent` method anymore
2023-04-23 16:06:10 +02:00
Tim van der Meij
870b942568
Don't use the deprecated CustomEvent.initCustomEvent method anymore
In PR #16295 one occurrence of this was changed, but a few more remained
in the codebase. This commit fixes the other occurrences so that we
don't use the deprecated way of creating custom events anywhere anymore.

According to MDN, see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent,
using the `CustomEvent.initCustomEvent` method is deprecated and the
`CustomEvent` constructor should be used instead.

Extends d9bf571f5c.
2023-04-23 15:41:02 +02:00
Tim van der Meij
2f86f5bb75
Merge pull request #16338 from timvandermeij/updates
Update translations and packages
2023-04-23 15:39:06 +02:00
Tim van der Meij
edb09855dc
Fix package vulnerabilities reported by npm audit
This commit is generated automatically using `npm audit fix`.
2023-04-23 14:37:51 +02:00
Tim van der Meij
f6f33065ef
Update mkdirp to version 3.0.0
The only change in this major version is the removal of the default
export, so we must simply use the named export instead.
2023-04-23 14:37:40 +02:00
Tim van der Meij
1b228091fa
Update packages to the most recent versions 2023-04-23 14:12:17 +02:00
Tim van der Meij
9c023c847c
Update translations to the most recent versions 2023-04-23 14:12:05 +02:00
Tim van der Meij
d6d3fdc489
Merge pull request #16335 from timvandermeij/npm-install-force
Don't force-install packages in the CI job anymore
2023-04-23 12:53:18 +02:00
Tim van der Meij
43d390759b
Don't force-install packages in the CI job anymore
In PR #16327 the `eslint-plugin-mozilla` package was updated so we no
longer have to force-install packages, and the force-install flags for
`npm install` were removed. However, the CI job was missing from this
commit, which we fix here. In general force-installing packages
shouldn't be necessary unless there are problems with dependencies,
which we would like to know about, so especially in the CI job it seems
like a good idea to not force-install packages to catch upcoming defects
early on.

Extends 19526d2322.
2023-04-23 12:45:29 +02:00
Tim van der Meij
bf01edb452
Merge pull request #16334 from Snuffleupagus/rm-PDF20-closure
Remove the `PDF20` closure, in the `src/core/crypto.js` file
2023-04-23 11:39:49 +02:00
Jonas Jenwald
74585c7c59 Remove the unused PDF20.hash method
This method was added in PR 4938, almost nine years ago, however it doesn't appear to ever have been used.
Given the similarities between the `PDF17` and `PDF20` classes, and how they're used, if the `PDF20.hash` method was actually necessary you'd also expect a similiar method in the `PDF17` class.
2023-04-23 10:13:46 +02:00
Jonas Jenwald
5e0722e4c2 Remove the PDF20 closure, in the src/core/crypto.js file
To allow doing this the existing helper function was changed into a "private" method instead.
2023-04-23 10:08:17 +02:00
Jonas Jenwald
6e1b234c6b
Merge pull request #16332 from Snuffleupagus/rm-primitives-closures
Remove the remaining unnecessary closures in the `src/core/primitives.js` file
2023-04-22 15:55:10 +02:00
Jonas Jenwald
9cb3236ac0 Remove the remaining unnecessary closures in the src/core/primitives.js file 2023-04-22 15:33:04 +02:00
Tim van der Meij
e304423ba1
Merge pull request #16331 from Snuffleupagus/cmap-rm-closure
Remove unnecessary closures in the CMap code
2023-04-22 14:58:13 +02:00
Tim van der Meij
2588924b0f
Merge pull request #16326 from Snuffleupagus/limit-Chrome-CSS
Don't include Chrome-specific CSS rules in MOZCENTRAL builds
2023-04-22 14:54:50 +02:00
Tim van der Meij
c9359957e6
Merge pull request #16305 from Snuffleupagus/PDFJSDev-skip-PRODUCTION
Remove the `PRODUCTION` build-target
2023-04-22 14:53:30 +02:00
Jonas Jenwald
bc7aa8a585 Re-factor some String.fromCharCode usage in the src/core/binary_cmap.js file
We can replace one case of `apply` with rest parameters, and avoid doing repeated `String.fromCharCode` calls within a loop.
2023-04-21 12:21:31 +02:00
Jonas Jenwald
cabc98f310 Remove the remaining closure in the src/core/cmap.js file
With modern JavaScript we (usually) no longer need to keep old closures, which slightly reduces the size of the code.
2023-04-21 12:21:31 +02:00
Jonas Jenwald
244002502b Move the BinaryCMapReader into its own file
The "binary" CMap-format is specific to the PDF.js library, and is used to reduce the size of the built-in CMap data-files.
By moving this code to its own file we can remove the nowadays unnecessary closures, which helps to slightly reduce the size of this code.
2023-04-21 12:21:20 +02:00