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

20355 commits

Author SHA1 Message Date
Jonas Jenwald
1ddce76a8b Simplify the JSDocs for the various getDocument Factory-parameters
Given that we nowadays provide default Node.js versions of these Factory-parameters it no longer seems necessary to mention that environment specifically.
2025-01-16 23:01:36 +01:00
Jonas Jenwald
75cba72ca6 [api-major] Replace MissingPDFException and UnexpectedResponseException with one exception
These old exceptions have a fair amount of overlap given how/where they are being used, which is likely because they were introduced at different points in time, hence we can shorten and simplify the code by replacing them with a more general `ResponseException` instead.

Besides an error message, the new `ResponseException` instances also include:
 - A numeric `status` field containing the server response status, similar to the old `UnexpectedResponseException`.

 - A boolean `missing` field, to allow easily detecting the situations where `MissingPDFException` was previously thrown.
2025-01-16 22:51:05 +01:00
calixteman
7a57af12e1
Merge pull request #19329 from calixteman/bug1935076_1
[api-major] Add openjpeg.wasm to pdf.js (bug 1935076)
2025-01-16 22:32:46 +01:00
Calixte Denizet
94b4b54ef6 [api-major] Add openjpeg.wasm to pdf.js (bug 1935076)
In order to fix bug 1935076, we'll have to add a pure js fallback in case wasm is disabled
or simd isn't supported. Unfortunately, this fallback will take some space.

So, the main goal of this patch is to reduce the overall size (by ~93k).
As a side effect, it should make easier to use an other wasm file (which must export
_jp2_decode, _malloc and _free).
2025-01-16 21:09:50 +01:00
Jonas Jenwald
711bf2bd12
Merge pull request #19324 from nicolo-ribaudo/search-dash-date
Allow searching for number-number on two lines
2025-01-15 15:04:09 +01:00
Nicolò Ribaudo
8358ab63b3
Allow searching for number-number on two lines
When a dash separates two digits, it's very likely to not be a hyphen
inserted to split a word into two lines (e.g. "par\n-ser"), but rather
either a minus sign, a range, or a date. For example, in the tracemonkey
PDF there is `2008-02` (a date) split across two lines.

Preserving the dash, similarly to how we do for compound words, allows
searches for "2008-02" to find a match.
2025-01-15 14:23:04 +01:00
Jonas Jenwald
2533a08779
Merge pull request #19327 from Snuffleupagus/issue-19326
Access the number of components correctly in JPEG 2000 images with color space entries (issue 19326)
2025-01-15 11:17:24 +01:00
Jonas Jenwald
e5bc760316 Access the number of components correctly in JPEG 2000 images with color space entries (issue 19326)
This small typo appears to be a regression from PR 18204.
2025-01-15 10:16:06 +01:00
Jonas Jenwald
016de74229
Merge pull request #19320 from nicolo-ribaudo/stamp-double-click
Enable editor when double-clicking on stamp annotation
2025-01-14 12:02:30 +01:00
Nicolò Ribaudo
60dd8147c6
Enable editor when double-clicking on stamp annotation
In Firefox, double-clicking on a stamp annotation triggers text
selection (selecting the last text element in the dom before the
annotation): this triggers the logic to make annotations not interfere
with text selection, which in turns prevents the double click from
triggering the annotation editor.

This commit fixes the problem by making annotations non-selectable, so
that clicking on them does not trigger text selection. Freetext
annotations were already non-selectable, so this commit doesn't change
that. However, we need to explicitly mark text in popups as selectable.
2025-01-14 11:16:59 +01:00
Tim van der Meij
61995e9e37
Merge pull request #19321 from Snuffleupagus/issue-19319
Improve performance when reading very large TrueType "cmap" tables (issue 19319)
2025-01-13 20:21:14 +01:00
Tim van der Meij
0b1a840fa2
Merge pull request #19318 from timvandermeij/puppeteer-24
Upgrade Puppeteer to version 24.0.0
2025-01-13 20:18:56 +01:00
Jonas Jenwald
5e569cade5 Improve performance when reading very large TrueType "cmap" tables (issue 19319)
In the affected font the total number of mapping-entries is `1142348`, and no less than `997473` of them are duplicates.
Given that every duplicate causes a lot of Array elements to be moved this becomes extremely inefficient, which we can avoid by keeping track of seen `charCode`s and directly build the final mappings-Array instead.
2025-01-13 13:09:47 +01:00
Tim van der Meij
d7e6d95304
Upgrade Puppeteer to version 24.0.0
This is a major version bump, but the changelog at
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v24.0.0
doesn't indicate any breaking changes that should impact us.
2025-01-12 19:48:05 +01:00
Tim van der Meij
e1b972aac3
Merge pull request #19317 from Snuffleupagus/FontRendererFactory-reuse-helpers
Re-use existing helper functions in `FontRendererFactory`
2025-01-12 15:20:43 +01:00
Tim van der Meij
db40155d33
Merge pull request #19313 from timvandermeij/updates
Update dependencies to the most recent versions
2025-01-12 15:14:56 +01:00
Jonas Jenwald
e0be2a02dc Re-use existing helper functions in FontRendererFactory
Currently we re-implement a number of helper functions specifically for this code, which seems completely unnecessary since there's already general purpose ones available in the `src/core/core_utils.js` file.
2025-01-12 13:01:54 +01:00
calixteman
b5218853b4
Merge pull request #19312 from calixteman/improve_touch
[Editor] Improve zooming with a pinch gesture while drawing
2025-01-10 18:30:55 +01:00
calixteman
3cd5521270
Merge pull request #19311 from calixteman/issue19239
[Editor] Don't try to use an non-existing canvas when rendering an in visible existing stamp editor
2025-01-10 16:32:22 +01:00
Calixte Denizet
8483ae0f88 [Editor] Improve zooming with a pinch gesture while drawing
It lets the user make a pinch gesture with a finger on page with a drawing
and the second finger on an other page.
On mobile, it's pretty easy to be in such a situation.
2025-01-10 16:24:58 +01:00
Calixte Denizet
06f72d5662 [Editor] Don't try to use an non-existing canvas when rendering an invisible existing stamp editor
It fixes #19239.

When the canvas isn't existing the editor has no image: it's fine because the editor is invisible.
Once it's made visible, the canvas is set when the annotation layer has been rendered.
2025-01-10 16:05:59 +01:00
Tim van der Meij
45d2e808fd
Update dependencies to the most recent versions 2025-01-09 22:48:00 +01:00
calixteman
f1166f480f
Merge pull request #19309 from calixteman/make_unique_id_draw_layer
[Editor] Set a unique id for each element in the draw layer
2025-01-08 21:56:52 +01:00
Calixte Denizet
586f45b7b8 [Editor] Set a unique id for each element in the draw layer
It avoids any conflict with existing elements when an elment is moved from a page
to an other.
2025-01-08 20:44:15 +01:00
Jonas Jenwald
573e5f54f1
Merge pull request #19305 from Snuffleupagus/issue-18816
Access the bbox/background data correctly in the `MeshShadingPattern` class (issue 18816)
2025-01-08 16:57:14 +01:00
Jonas Jenwald
916fff0e42 Access the bbox/background data correctly in the MeshShadingPattern class (issue 18816)
This appears to have regressed in PR 13808, since it removed the `matrix`-entry from array returned by the `MeshShading.prototype.getIR` method *without* also updating the indexes in the `MeshShadingPattern` constructor.
2025-01-08 15:57:56 +01:00
Jonas Jenwald
115af68f10
Merge pull request #19307 from Snuffleupagus/rm-fuzz-test
Remove the fuzz tests (issue 19297)
2025-01-08 15:57:31 +01:00
Jonas Jenwald
c32d49117c Remove the fuzz tests (issue 19297)
Reasons for removal:

 - These tests never generated any warnings from OSS-Fuzz, in over a year.

 - An error thrown during image decoding will lead to a broken/missing image, not a security problem.

 - These tests rely on the Jazzer.js library, which has a number of problems: It now causes failures in Node.js v23 in the CI tests, it's no longer being maintained upstream, and it lacks support for some (fairly common) CPU architectures.
2025-01-08 15:54:11 +01:00
calixteman
dfbd1d5db6
Merge pull request #19300 from calixteman/remove_useless_css
Remove unused CSS variables
2025-01-07 14:16:03 +01:00
Calixte Denizet
1608e36de6 Remove unused CSS variables 2025-01-07 10:29:23 +01:00
calixteman
e5ad7ef863
Merge pull request #19295 from calixteman/update_moz_toggle.css
Update the toggle-button css after the changes in m-c (bug 1940085)
2025-01-06 19:00:55 +01:00
Calixte Denizet
6db49bedbe Update the toggle-button css after the changes in m-c (bug 1940085) 2025-01-06 18:34:08 +01:00
calixteman
af5beeb861
Merge pull request #19280 from calixteman/issue19274
Let be more tolerant with predefined phone number format
2025-01-06 17:24:05 +01:00
Calixte Denizet
3dd8752283 Let be more tolerant with predefined phone number format
The long US phone number format should be '(999) 999-9999' but the parenthesis
can be omitted or the space replaced with a dash, ...
2025-01-06 15:24:19 +01:00
Tim van der Meij
3001264801
Merge pull request #19291 from timvandermeij/integration-tests-extract-freetext-commit
Implement a commit helper function for the freetext integration tests
2025-01-05 13:20:12 +01:00
Tim van der Meij
26b0d4f749
Merge pull request #19290 from timvandermeij/integration-tests-use-waitforunselectededitor
Use the `waitForUnselectedEditor` integration test helper function more
2025-01-05 13:19:11 +01:00
Tim van der Meij
e57f2c53a4
Implement a commit helper function for the freetext integration tests
The ink editor integration tests already use a helper function for
committing the editor, so this commit mirrors the approach to the
freetext editor integration tests. This has multiple advantages:

- it improves consistency between the various editor integration tests;
- it makes the code easier to read/understand;
- it reduces code duplication (220 lines of code removed);
- it reduces the number of `getEditorSelector` calls (32 calls removed)
  that contained hardcoded IDs, which helps to isolate the tests and to
  simplify follow-up patches.
2025-01-04 20:22:19 +01:00
Tim van der Meij
5126210fff
Use the waitForUnselectedEditor integration test helper function more
This commit applies the `waitForUnselectedEditor` helper function to the
remaining places, that most likely predate the introduction of the
helper function, to deduplicate the code and to have a unified way of
checking if a given editor is unselected.
2025-01-04 20:15:45 +01:00
Tim van der Meij
4d4e1befeb
Merge pull request #19289 from Snuffleupagus/issue-19281
Skip LinkAnnotations when collecting field objects (issue 19281)
2025-01-04 13:32:18 +01:00
Tim van der Meij
3e822399d8
Merge pull request #19278 from Snuffleupagus/more-Dict-iteration
Use `Dict` iteration more (PR 19051 follow-up)
2025-01-04 13:22:51 +01:00
Tim van der Meij
7f5f4d0e66
Merge pull request #19277 from timvandermeij/integration-tests-remove-getselectededitors
Remove the `getSelectedEditors` integration test helper function
2025-01-04 13:21:45 +01:00
Jonas Jenwald
6f062abb76 Skip LinkAnnotations when collecting field objects (issue 19281)
The `/Root/AcroForm/Fields` array contains a "ridiculous" number of LinkAnnotations, which obviously makes no sense since those are not form fields.
To improve performance we'll thus ignore those when collecting the field objects.
2025-01-04 11:54:45 +01:00
Jonas Jenwald
74c1795c9f Use Dict iteration more (PR 19051 follow-up)
There's a few cases where we're looping through the result of `Dict.prototype.getKeys` and then manually look-up the values, which after PR 19051 can be replaced with direct iteration instead.
2025-01-02 15:09:19 +01:00
Tim van der Meij
9d09c56014
Remove the getSelectedEditors integration test helper function
The `getSelectedEditors` function is largely a copy of the `getEditors`
function, with three small differences:

1. `getEditors` allows getting any kind of editor whereas
   `getSelectedEditors` is harcoded to only getting selected editors.
2. `getEditors` returns editor selectors (strings) whereas
   `getSelectedEditors` returns editor IDs (integers).
3. `getSelectedEditors` returns a sorted array of editor IDs whereas
   `getEditors` does not ensure that the array is sorted.

This commit makes the `getEditors` function a drop-in replacement for
the `getSelectedEditors` function to deduplicate the code and to have a
unified way of getting editors.

Note that we don't actually use the contents of the returned array
(only its length), so we can safely change `getEditors` to return a
sorted array of integer editor IDs instead. Sorting the array makes the
return value deterministic, which is a nice property for test stability,
and integer IDs are also easier to handle in test assertions. Note that
the corresponding selector strings can also easily be obtained from the
integer IDs using the `getEditorSelector` function if needed.
2025-01-01 15:58:09 +01:00
Tim van der Meij
5905eb1253
Merge pull request #19276 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-01-01 14:45:30 +01:00
Tim van der Meij
9bd03e81dc
Bump the stable version in pdfjs.config 2025-01-01 14:42:42 +01:00
Jonas Jenwald
f9bea397f8
Merge pull request #19273 from Snuffleupagus/NetworkManager-request-methods
Remove the `requestRange`/`requestFull` methods from the `NetworkManager` class
2024-12-31 16:26:13 +01:00
Jonas Jenwald
01240fda89 Remove the requestRange/requestFull methods from the NetworkManager class
Originally the code in this file was used in both the GENERIC and MOZCENTRAL builds, however that's no longer the case.
Hence we can now directly call `NetworkManager.prototype.request` and remove these old "helper" methods that only had a single call-site each.
2024-12-31 15:57:26 +01:00
Jonas Jenwald
f19b0a1804
Merge pull request #19271 from Snuffleupagus/l10n-update
Update l10n files
2024-12-31 15:42:36 +01:00
Jonas Jenwald
93ce29f136 Update l10n files
Let's ensure that the l10n files are up-to-date before the next release.
2024-12-31 13:51:43 +01:00