Compare commits

..

2204 Commits

Author SHA1 Message Date
Jonas Jenwald
813d1949ba
Merge pull request #21491 from Snuffleupagus/readCmapTable-sort-last
Sort the mappings *last* in the `readCmapTable` function (PR 19321 follow-up)
2026-06-23 16:01:09 +02:00
Jonas Jenwald
a1acf4fc9f
Merge pull request #21489 from Snuffleupagus/editor-tools-rm-testing-reset
Remove the `AnnotationEditorUIManager` and `IdManager` test-only `reset` methods (PR 19809 follow-up)
2026-06-23 14:03:46 +02:00
Jonas Jenwald
9ca13c9a23 Sort the mappings *last* in the readCmapTable function (PR 19321 follow-up)
This improves performance of `issue19319.pdf` even more, and locally the rendering time of the second page goes from ~300 ms to ~250 ms, since we avoid sorting a bunch of duplicate entries.
2026-06-23 13:51:37 +02:00
Jonas Jenwald
09c9f7f2fe Remove the AnnotationEditorUIManager and IdManager test-only reset methods (PR 19809 follow-up)
These test-only methods became unused in PR 19809.
2026-06-23 12:09:12 +02:00
calixteman
d71fe9025d
Merge pull request #21474 from calixteman/rich_media
Add support for RichMedia annotations
2026-06-22 22:29:14 +02:00
Calixte Denizet
d537f5ba4b
Add support for RichMedia annotations
Render `/Subtype /RichMedia` annotations so embedded video and audio can
be played in the viewer.

The core layer parses the `RichMediaContent` dictionary to locate the
primary playable asset and its MIME type. The display layer overlays a
play button on the annotation's poster; clicking it swaps in a
`<video>`/`<audio>` element backed by a `blob:` URL. Presentation mode
lets events reach the media controls instead of advancing the page.

It fixes #2787.
2026-06-22 21:27:52 +02:00
Tim van der Meij
b6469341c1
Merge pull request #21485 from calixteman/bug2046659
Use AES256 for V=5 documents with a mislabeled AESV2 crypt filter (bug 2046659)
2026-06-22 20:44:48 +02:00
Tim van der Meij
7ac6dff4b7
Merge pull request #21483 from calixteman/issue21430
Reset alpha before drawing a colored glyph in type 3 font
2026-06-22 20:40:55 +02:00
Calixte Denizet
7f7e63333d Use AES256 for V=5 documents with a mislabeled AESV2 crypt filter (bug 2046659)
Some producers wrongly set the crypt filter CFM to AESV2 for V=5 documents;
per the spec these must be decrypted with AES256 using the file encryption key directly.
2026-06-22 14:54:24 +02:00
calixteman
1ddf6449ac
Merge pull request #21478 from calixteman/comb-field-vertical-centering
Vertically center the glyphs in comb text fields
2026-06-22 09:57:55 +02:00
Jonas Jenwald
28a7606c14
Merge pull request #21480 from Snuffleupagus/mathML-FileSpec
A couple of small tweaks of the `StructElementNode.prototype.mathML` getter
2026-06-21 23:44:28 +02:00
calixteman
623e6d9476
Reset alpha before drawing a colored glyph in type 3 font
It fixes #21430.
2026-06-21 23:06:43 +02:00
Jonas Jenwald
9c9b465fd2 A couple of small tweaks of the StructElementNode.prototype.mathML getter
- Use `FileSpec.pickPlatformItem` when getting the fileStream, to ensure that /EF-entries are handled in a consistent way across the code-base.

 - Combine a couple of the data-validation steps, to reduce a tiny bit of duplication. Also, use the `isDict` helper a little more.

 - Finally, avoid using a temporary variable when returning data in the `Page.prototype.getStructTree` method.
2026-06-21 22:47:13 +02:00
Tim van der Meij
8ebc2382e3
Merge pull request #21479 from Snuffleupagus/Annotation-#setOptionalContent-MissingDataException
Don't swallow `MissingDataException`s in the `Annotation.prototype.#setOptionalContent` method (PR 21313 follow-up)
2026-06-21 19:11:54 +02:00
Tim van der Meij
38daede697
Merge pull request #21481 from Snuffleupagus/metadata-isDict
Use the `isDict` helper in the `Catalog.prototype.metadata` getter
2026-06-21 19:10:54 +02:00
Tim van der Meij
86b901fcde
Merge pull request #21470 from Snuffleupagus/AnnotationEditorUIManager-rm-isSelected
Remove the unused `AnnotationEditorUIManager.prototype.isSelected` method
2026-06-21 19:09:32 +02:00
Tim van der Meij
1d8e952062
Merge pull request #21482 from Snuffleupagus/password-input-Enter-preventDefault
Stop event propagation, for the `Enter` key, in the passwordPrompt input
2026-06-21 19:05:50 +02:00
Tim van der Meij
018ba66228
Merge pull request #21472 from mozilla/dependabot/npm_and_yarn/undici-7.28.0
Bump undici from 7.24.3 to 7.28.0
2026-06-21 19:04:29 +02:00
Jonas Jenwald
a911ce22e5 Stop event propagation, for the Enter key, in the passwordPrompt input
**Steps to reproduce:**
 1. Open the viewer.
 2. Show the sidebar, and switch to the "Pages" view if necessary.
 3. Click on the "Add file" button.
 4. Choose a password-protected PDF, e.g. the `issue6010_1.pdf` file, via the "File Upload" dialog opened by the browser.
 5. Enter the password, i.e. `abc`, and press the <kbd>Enter</kbd> key.

**Expected result:**
That the new PDF document is merged into the existing one, without UI side-effects.

**Actual result:**
Merging works, *however* the "File Upload" dialog is re-opened.

---

It seems that when the passwordPrompt dialog closes, the <kbd>Enter</kbd> key press (from the input) is forwarded to the previously focused element which naturally is the "Add file" button.

*Note:* This doesn't seem (easily) possible to test, since the integration-tests directly populate the `viewsManagerAddFilePicker` and doesn't actually "click" on the `viewsManagerAddFileButton` first.
2026-06-21 15:30:05 +02:00
Jonas Jenwald
a46ee2b647 Use the isDict helper in the Catalog.prototype.metadata getter 2026-06-21 12:26:21 +02:00
Jonas Jenwald
bd6541864b Don't swallow MissingDataExceptions in the Annotation.prototype.#setOptionalContent method (PR 21313 follow-up)
Unless the entire document has been loaded, the dictionary lookups in `parseMarkedContentProps` may throw `MissingDataException`s and in that case we need to re-parse the current Annotation rather than ignoring the optionalContent.
2026-06-21 09:13:33 +02:00
Jonas Jenwald
124228e318
Merge pull request #21473 from Snuffleupagus/showText-rm-return-undefined
Remove unnecessary explicit return statements in `CanvasGraphics.prototype.showText`
2026-06-20 22:31:58 +02:00
Jonas Jenwald
bff30726fa
Merge pull request #21476 from Snuffleupagus/relative-URI-action-test
Add a unit-test for relative URI actions specified as /Name instances
2026-06-20 22:31:02 +02:00
Calixte Denizet
34516bcec3 Vertically center the glyphs in comb text fields 2026-06-20 18:47:24 +02:00
Jonas Jenwald
bade1f3190 Add a unit-test for relative URI actions specified as /Name instances
The following branch was added to fix issue 4159, however looking at the coverage data it's not actually tested; see 59df671552/src/core/catalog.js (L1866-L1869) and 59df671552/blob/src/core/catalog.js (L1866)
2026-06-19 23:58:50 +02:00
Jonas Jenwald
00e1aabe93 Remove unnecessary explicit return statements in CanvasGraphics.prototype.showText 2026-06-19 10:58:14 +02:00
dependabot[bot]
dfa673290b
Bump undici from 7.24.3 to 7.28.0
Bumps [undici](https://github.com/nodejs/undici) from 7.24.3 to 7.28.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v7.24.3...v7.28.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 7.28.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-19 07:33:31 +00:00
calixteman
59df671552
Merge pull request #21471 from mozilla/update-locales
l10n: Update locale files
2026-06-19 08:10:32 +02:00
github-actions[bot]
87361aa094 l10n: Update locale files 2026-06-19 01:04:57 +00:00
Jonas Jenwald
786019eb0d Remove the unused AnnotationEditorUIManager.prototype.isSelected method
According to the coverage data this method is unused, see e20c810dd4/blob/src/display/editor/tools.js (L2552), and searching through the entire code-base reveals no call-site invoking an `isSelected` method.
2026-06-18 23:21:53 +02:00
calixteman
e20c810dd4
Merge pull request #21469 from calixteman/issue21466
Avoid too long BlueScale value when rewriting a CFF font
2026-06-18 21:43:05 +02:00
calixteman
07d4c1018a
Avoid too long BlueScale value when rewriting a CFF font
It fixes #21466.
2026-06-18 20:48:13 +02:00
Jonas Jenwald
e74be44919
Merge pull request #21467 from Snuffleupagus/canvas-rm-unused
Remove unused branches in the `src/display/canvas.js` file
2026-06-18 19:57:51 +02:00
Jonas Jenwald
b4b0a3fa04 Remove the unused ImageData branch in the putBinaryImageData function
This branch isn't covered by any tests, and looking at the two existing call-sites we only ever pass in a `CanvasRenderingContext2D` interface to this function.
Based on the git history this branch was added in PR 3312, however as far as I can tell it doesn't actually appear to have been necessary even back then!?
2026-06-18 18:22:55 +02:00
Jonas Jenwald
a443a635a1 Remove the unused HTMLElement branch in the paintInlineImageXObject method
This branch isn't covered by any tests, and as far as I can tell it's been unused ever since PR 11601 which simplified the JPEG image handling.
Prior to that we'd create an `Image` instance in one case, see [this code](https://github.com/mozilla/pdf.js/pull/11601/changes#diff-082d6b37ad01db7ac97cc07c6ddb0dc52040484c5ef91b110b072f50144d9f39L2312-L2314), which is why that branch was necessary since `new Image()` creates a `HTMLImageElement` instance which in itself is an instance of `HTMLElement`; note [this](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) respectively [this](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement).
2026-06-18 17:47:26 +02:00
calixteman
3956ac1b39
Merge pull request #21465 from calixteman/fix_attachments
Re-derive annotation attachment content from the xref after cleanup
2026-06-18 16:48:13 +02:00
Calixte Denizet
9d9fb06d7f Re-derive annotation attachment content from the xref after cleanup
Annotation-local attachments (those not in the catalog `/Names` tree) were
resolved through a dictionary cache that `Catalog.cleanup` clears, so their
content became unreachable once the idle cleanup had run.

Encode the reference of the embedded content in the attachment id and re-fetch
it from the xref on demand instead of caching the dictionary, so the content
stays reachable without anything having to survive cleanup.

It fixes a regression introduced by #21351.
2026-06-18 16:03:32 +02:00
calixteman
187c22126a
Merge pull request #21310 from calixteman/dont_save
Add a 'supportsDownloading' browser option to gate saving/downloading
2026-06-18 15:36:41 +02:00
Calixte Denizet
ece1e2ed0c Add a 'supportsDownloading' browser option to gate saving/downloading
Introduces a 'supportsDownloading' browser option (defaulting to false)
that lets embedders disable the save/download paths entirely. When
disabled:
  - the toolbar and secondary-toolbar download buttons are hidden;
  - PDFViewerApplication.{download,save,downloadOrSave} and the
    "beforeunload" save prompt bail out early;
  - the BaseDownloadManager helpers (download, downloadData,
    openOrDownloadData) and the Firefox/generic _triggerDownload
    implementations no-op.
2026-06-18 14:51:32 +02:00
Jonas Jenwald
2ed018ec2d
Merge pull request #21460 from Snuffleupagus/autolinking-check-every-LinkAnnotation
Check every LinkAnnotation when testing if inferred links overlap (issue 21458)
2026-06-16 22:32:07 +02:00
calixteman
eae42379f2
Merge pull request #21462 from calixteman/bluescale-small-zones
Don't clamp BlueScale up when a font genuinely has small zones
2026-06-16 21:52:25 +02:00
calixteman
d28030f838
Merge pull request #21463 from calixteman/fix_unit_test
Adjust the 'BaseException' unit-test for the 'Error.stack' changes in Firefox
2026-06-16 21:43:49 +02:00
Jonas Jenwald
cbefb334fd Check every LinkAnnotation when testing if inferred links overlap (issue 21458)
Currently we only check LinkAnnotations with URLs, but completely ignore e.g. internal destinations, named actions, attachments, SetOCGState actions, JS actions, and ResetForm actions when testing if inferred links overlap any existing annotation.
This seems conceptually wrong, since it may easily break intended functionality by overlaying the *correct* DOM element with an inferred link (as was the case in issue 21458).
2026-06-16 21:35:44 +02:00
Calixte Denizet
5432642250 Adjust the 'BaseException' unit-test for the 'Error.stack' changes in Firefox
Firefox 154 no longer walks the prototype chain in the `Error.stack`
getter, so `BaseException`-derived instances return an empty string
rather than the prototype `Error`'s stack (see bug 1946559).
2026-06-16 21:30:41 +02:00
Tim van der Meij
f0dc2166ab
Merge pull request #21464 from mozilla/dependabot/npm_and_yarn/markdown-it-14.2.0
Bump markdown-it from 14.1.1 to 14.2.0
2026-06-16 21:16:19 +02:00
dependabot[bot]
9ed97a859f
Bump markdown-it from 14.1.1 to 14.2.0
Bumps [markdown-it](https://github.com/markdown-it/markdown-it) from 14.1.1 to 14.2.0.
- [Changelog](https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md)
- [Commits](https://github.com/markdown-it/markdown-it/compare/14.1.1...14.2.0)

---
updated-dependencies:
- dependency-name: markdown-it
  dependency-version: 14.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-16 19:01:51 +00:00
Tim van der Meij
8bc13d502b
Merge pull request #21459 from Snuffleupagus/PDFEditor-ternary-Dict-set
Use ternary expressions to shorten code in `src/core/editor/pdf_editor.js`
2026-06-16 20:50:05 +02:00
Tim van der Meij
36eae2c978
Merge pull request #21461 from mozilla/dependabot/github_actions/github/codeql-action-4.36.2
Bump github/codeql-action from 4.36.1 to 4.36.2
2026-06-16 20:48:22 +02:00
calixteman
bc99fc0678
Don't clamp BlueScale up when a font genuinely has small zones
The lower BlueScale clamp from #21343 guarded foundry fonts via
`blueScale < DEFAULT_BLUE_SCALE`, but that lets a near-default value
(e.g. 0.037) with small zones get raised to `0.5 / maxZoneHeight`. On
macOS' Core Text rasterizer this collapses the overshooting glyphs, so
most text disappears (not reproducible on Linux/Windows).
2026-06-16 19:34:48 +02:00
calixteman
fdeed2af5e
Merge pull request #21455 from calixteman/bug1873345
Draw non-isolated blend-mode groups against their backdrop (bug 1873345)
2026-06-16 15:26:00 +02:00
Calixte Denizet
082ad21387 Draw non-isolated blend-mode groups against their backdrop (bug 1873345)
A non-isolated transparency group must blend with its backdrop, but a group
containing a blend mode was forced onto a transparent intermediate canvas;
e.g. a /Multiply highlight then painted opaquely over the text behind it,
 making that text invisible.
2026-06-16 15:09:39 +02:00
dependabot[bot]
6cdd3c19fd
Bump github/codeql-action from 4.36.1 to 4.36.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.36.1 to 4.36.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](87557b9c84...8aad20d150)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-16 12:14:06 +00:00
Jonas Jenwald
6c0ad865c6 Use ternary expressions to shorten code in src/core/editor/pdf_editor.js
This makes setting a few Dictionary entries a little bit shorter, which shouldn't hurt.
(Part of this code isn't fully covered by tests, so it improves overall code coverage as well.)
2026-06-16 11:50:53 +02:00
Tim van der Meij
7f7b38b424
Merge pull request #21457 from Snuffleupagus/GetAnnotationsByType-rm-page-check
Remove unneeded check in the "GetAnnotationsByType" worker-thread handler
2026-06-15 21:41:10 +02:00
Tim van der Meij
7d3ec9da1e
Merge pull request #21456 from Snuffleupagus/rm-classNamesForOutlining
Remove the unused `HighlightOutline.prototype.classNamesForOutlining` getter
2026-06-15 20:46:32 +02:00
calixteman
67e6ff0090
Merge pull request #21428 from calixteman/checkubtton_opt
Resolve checkbox/radio export values from the 'Opt' entry
2026-06-15 19:43:28 +02:00
Calixte Denizet
2550b91be9 Resolve checkbox/radio export values from the 'Opt' entry
For checkbox and radio button fields, the export value can differ from the
appearance-state name: the field's inheritable `Opt` array holds the real
export values (used for non-Latin text, or values shared between buttons).
We previously exposed the appearance-state name as the export value.
2026-06-15 18:23:26 +02:00
Jonas Jenwald
d9e4cc5f65 Remove unneeded check in the "GetAnnotationsByType" worker-thread handler
Given that the Promise returned by the `PDFDocument.prototype.getPage` method *always* resolves with a `Page` instance, checking that the page is defined isn't necessary; note 3a09329113/src/core/document.js (L1702-L1723)

Furthermore the `Page.prototype.collectAnnotationsByType` method is asynchronous, and thus it always returns a Promise, hence it's "pointless" to fallback to return an empty Array.
2026-06-15 13:12:47 +02:00
Jonas Jenwald
f781ac33da Remove the unused HighlightOutline.prototype.classNamesForOutlining getter
This was added in PR 18972 and it became unused in PR 19085, however it was accidentally left behind.
2026-06-15 12:02:46 +02:00
Tim van der Meij
3a09329113
Merge pull request #21454 from timvandermeij/eslint-plugin-unicorn
Upgrade `eslint-plugin-unicorn` to version 66.0.0
2026-06-14 21:51:42 +02:00
Tim van der Meij
0ea67ed96f
Upgrade eslint-plugin-unicorn to version 66.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v66.0.0
doesn't indicate any breaking changes that should impact us.

However, improved rules do require a small number of changes here:

- The `prefer-array-some` rule no longer reports a false positive after
  https://github.com/sindresorhus/eslint-plugin-unicorn/issues/3198 got
  fixed, so the ignore line that was added in commit 68a5ec1 is removed.

- The `prefer-ternary` rule triggers on more cases now, in particular
  `let` declarations with `if` reassignments, so a number of changes are
  made to make it pass again.

- The `prefer-at` rule triggers on more cases now, in particular
  `substring` calls that just extract a single character, so one change
  is made to make it pass again.
2026-06-14 20:20:34 +02:00
calixteman
92bd2dbb38
Merge pull request #21453 from timvandermeij/puppeteer-skip-download
Don't download Puppeteer browsers on `npm install`
2026-06-14 19:25:32 +02:00
Tim van der Meij
26b4206d87
Configure Puppeteeer to not download Chrome/Firefox by default
We currently download Chrome/Firefox immediately on `npm install`
invocations because Puppeteer's postinstall script does that by default.
However, this is wasteful if the user/workflow doesn't actually need to
run Puppeteer or its browsers, for example in GitHub Actions workflows
that do linting, static analysis or other tasks like updating locales or
publishing artifacts.

This commit therefore makes sure no browser binaries get pulled in by
default anymore, and defers doing that until it's actually necessary,
which is when we want to start the browsers in the `startBrowsers`
function of `test.mjs`.

Locally this brings the `npm install` runtime down from 8.998 to 1.800
seconds, and as a bonus it results in better log output too because it
now shows which browser versions were used in the run (whereas
previously with `npm install` this information was not sent to stdout).
2026-06-14 17:15:47 +02:00
Tim van der Meij
6bfefa53da
Configure Puppeteer to use the stable version of Chrome
We currently use the pinned version of Chrome as hardcoded in the
Puppeteer release, which is based on the version of Chrome that was
deemed stable at the time of the Puppeteer release.

However, this is not ideal because it means that Chrome updates are
strongly tied to Puppeteer releases, so if Puppeteer releases are slow
we could be missing out on e.g. (security) patches being applied on the
stable channel. It's also not consistent with Firefox where we don't
use a hardcoded pinned version either.

This commit therefore configures Puppeteer to use (resolve) the most
recent stable version of Chrome at the time of the installation so that
determining the browser version to use is fully decoupled from the
Puppeteer release we're running.

The effect of this change can be seen in the output of running
`npx puppeteer browsers list`:

Before:

`chrome@149.0.7827.22 (linux) <path>`

After (note the slightly newer version):

`chrome@149.0.7827.115 (linux)` <path>`
2026-06-14 17:12:43 +02:00
Tim van der Meij
66c22b1fc5
Configure Puppeteer to not download Chrome headless shell
Nowadays Chrome has a built-in (new) headless mode in the regular
binary, but before that time there was an old headless mode that was
essentially a separate binary [1]. We don't use the latter, but it turns
out that Puppeteer downloads it automatically if it's not explicitly
skipped, which is wasteful because it costs extra time and resources for
each `npm install` invocation.

This commit therefore skips downloading Chrome headless shell explictly,
which results in the local runtime of `npm install` going from 10.125
seconds to 8.998 seconds (which can't hurt in e.g. GitHub Actions).

[1] https://developer.chrome.com/blog/chrome-headless-shell.
2026-06-14 16:59:13 +02:00
Tim van der Meij
8560125056
Merge pull request #21448 from timvandermeij/comment-intermittent
Fix intermittent failure in the `must check that the comment sidebar is resizable` comment integration test
2026-06-14 16:35:20 +02:00
Tim van der Meij
ed1b2f91be
Merge pull request #21440 from Snuffleupagus/putBinaryImageData-convertRGBToRGBA
Use the `convertRGBToRGBA` helper with RGB images in `putBinaryImageData`
2026-06-14 14:20:11 +02:00
Tim van der Meij
bfcafbc004
Merge pull request #21444 from Snuffleupagus/merge-test-password
Add an integration-test for merging a password-protected PDF
2026-06-14 14:16:35 +02:00
Jonas Jenwald
2dc73ad2a7 Collect coverage data from all workers when closing integration-tests
The "Merge PDF" integration-tests will (indirectly) invoke `PDFViewerApplication.open` as part of loading the new PDF document, which will end up creating a new `PDFWorker` instance.
Currently worker coverage is only collected at the end of each integration-test, which means that in these cases we miss the coverage data from any "previous" workers.
2026-06-14 13:27:06 +02:00
Jonas Jenwald
feec28583d Add an integration-test for merging a password-protected PDF
Looking at the coverage data the password-handling part of the merge functionality wasn't being tested; see e75a7cfd62/blob/src/core/worker.js (L652)
2026-06-14 13:17:33 +02:00
Jonas Jenwald
1373aa4a48
Merge pull request #21452 from Snuffleupagus/merge-test-corrupt
Add an integration-test for merging a corrupt PDF
2026-06-14 13:13:47 +02:00
Jonas Jenwald
e1c930adfe Add an integration-test for merging a corrupt PDF
Currently when opening a PDF document the following code is used, where `checkFirstPage`/`checkLastPage` helps detect XRef corruption; note 86a18bd5fe/src/core/worker.js (L167-L176)

However when merging a PDF into an existing document the parsing is only "partial"; note 86a18bd5fe/src/core/worker.js (L632-L634)

It seems a little strange to not support corrupt PDFs in a consistent manner in the code-base, hence this patch adds a new `BasePdfManager` helper that handles all the relevant parsing/checking and re-uses that when merging PDFs.
2026-06-14 09:49:23 +02:00
Tim van der Meij
d305b542df
Fix intermittent failure in the must check that the comment sidebar is resizable comment integration test
We use the generic `page.mouse.move(x, y, { steps }` API, but that purely
performs the mouse move steps without having knowledge about if/how the
application handles any events caused by it, so it doesn't wait for the
sidebar to render before moving on. This causes intermittent failures if
the sidebar didn't get enough time to render before the next mouse move
is initiated (which can happen in slower environments).

This commit fixes the issue by doing the mouse move steps ourselves and
by waiting for a browser trip between each of them to make sure that the
sidebar got a chance to render.

Fixes #21447.
Relates to #21044 / #21045 / 24e5377.
2026-06-13 21:32:00 +02:00
Tim van der Meij
86a18bd5fe
Merge pull request #21446 from timvandermeij/updates
Update dependencies to the most recent versions
2026-06-13 21:15:55 +02:00
Tim van der Meij
68a5ec1403
Upgrade eslint-plugin-unicorn to version 65.0.1
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v65.0.0
doesn't indicate any breaking changes that should impact us.

However, there is one false positive, possibly introduced by patch
https://github.com/sindresorhus/eslint-plugin-unicorn/pull/3028:

```
src/core/xfa/factory.js
  104:54  error  Prefer `.some(…)` over `.find(…)`  unicorn/prefer-array-some
```

This is incorrect because on this line we're not dealing with an array
but with a `FontFinder` instance instead (and that doesn't have a
`.some()` method), so we ignore the rule for this line.
2026-06-13 19:33:50 +02:00
Tim van der Meij
827ddf6e09
Update dependencies to the most recent versions 2026-06-13 19:12:35 +02:00
Tim van der Meij
01948aff23
Merge pull request #21443 from Snuffleupagus/finishWorkerTask-finally
Reduce duplication when invoking `finishWorkerTask`
2026-06-13 19:01:04 +02:00
Jonas Jenwald
c88f0bba04 Reduce duplication when invoking finishWorkerTask
By utilizing `Promise.prototype.finally()` more it's possible to avoid a bit of duplication when invoking `finishWorkerTask`.
2026-06-13 16:52:47 +02:00
Jonas Jenwald
55c8516944 Use the convertRGBToRGBA helper with RGB images in putBinaryImageData
This removes a little bit of code duplication, which only exist since the `src/display/canvas.js` code pre-dates the helper function by many years.

Note: Given that `OffscreenCanvas` is enabled by default there's currently not a lot of test coverage for this code-path, hence the added browser-test.
2026-06-13 13:14:50 +02:00
Tim van der Meij
e75a7cfd62
Merge pull request #21441 from Snuffleupagus/JpegImage-isSourcePDF-conditional
Re-factor the `isSourcePDF` handling in the `JpegImage` class
2026-06-13 12:48:00 +02:00
Tim van der Meij
5f8f6b1e40
Merge pull request #21439 from Snuffleupagus/more-getOrInsertComputed
Use `Map.prototype.getOrInsertComputed()` more in the code-base
2026-06-13 12:44:51 +02:00
Jonas Jenwald
ec1e94423b Re-factor the isSourcePDF handling in the JpegImage class
This functionality was added specifically for the standalone image-decoders, and by utilizing the pre-processor we can reduce the amount of "unnecessary" code in the regular builds.

Also, shorten a few loop variables a little bit since less code is always good.
2026-06-13 10:59:02 +02:00
Jonas Jenwald
5873e1cbc0
Merge pull request #21431 from Snuffleupagus/more-isDict
Use the `isDict` helper function in a few more places
2026-06-12 23:32:22 +02:00
Jonas Jenwald
ffa7ac7a91 Use Map.prototype.getOrInsertComputed() more in the code-base 2026-06-12 23:21:16 +02:00
Tim van der Meij
ca34359e1f
Merge pull request #21426 from Snuffleupagus/rm-convertToViewportRectangle
[api-minor] Remove the unused `convertToViewportRectangle` method in the `PageViewport` class
2026-06-12 22:06:19 +02:00
calixteman
35d275d3b1
Merge pull request #18907 from calixteman/bug1802506
Use the checkboxes and radio button appearances as defined in the pdf to render them in the annotation layer (bug 1802506)
2026-06-12 22:04:29 +02:00
Tim van der Meij
4781194b37
Merge pull request #21437 from Snuffleupagus/issue-21436
Handle corrupt PDFs that lack /Kids array and just inline the /Page dictionary (issue 21436)
2026-06-12 20:49:27 +02:00
Calixte Denizet
069b757998 Use the checkboxes and radio button appearances as defined in the pdf to render them in the annotation layer (bug 1802506)
The idea is to generate two operator lists for the Yes/Off states and render them on a separate canvas.
These canvases are then attached the annotation and we modify their display depending on the input state.

It fixes #18021.
2026-06-12 20:10:56 +02:00
Jonas Jenwald
131d6b7d38 Handle corrupt PDFs that lack /Kids array and just inline the /Page dictionary (issue 21436)
This basically extends PR 9549 to the fallback `getAllPageDicts` method, which didn't exist at the time, in order to support more cases of corrupt PDF documents.
2026-06-12 12:04:58 +02:00
calixteman
63db4bb777
Merge pull request #21433 from mozilla/update-locales
l10n: Update locale files
2026-06-12 08:45:22 +02:00
github-actions[bot]
53d0856ee9 l10n: Update locale files 2026-06-12 01:00:11 +00:00
Jonas Jenwald
3b628d59fb Use the isDict helper function in a few more places 2026-06-11 17:24:03 +02:00
Jonas Jenwald
2466a76ba4
Merge pull request #21429 from Snuffleupagus/getAttachmentContent-fix-unit-test
Fix the unit-tests for on-demand password handling of encrypted attachments (issue 21425)
2026-06-11 15:13:46 +02:00
Jonas Jenwald
587abf0ef4 Re-use the getPassword helper function more in the src/core/worker.js file
Currently the same code, for requesting the password from the main-thread, is now duplicated three times.
Let's avoid that by moving the new `getPassword` helper function, added in the previous commit, and re-use that everywhere instead.
2026-06-11 10:07:39 +02:00
Jonas Jenwald
f3f5acc418 Fix the unit-tests for on-demand password handling of encrypted attachments (issue 21425)
These unit-tests used a PDF that prompted for password on document load, which meant that the on-demand password handling wasn't actually being tested as intended.

Updating the unit-tests also caused the "re-prompts for encrypted attachments after incorrect passwords" test to fail, since the `INCORRECT_PASSWORD` password reason was being accidentally "swallowed" in the worker-thread.
2026-06-10 23:08:34 +02:00
Jonas Jenwald
ac64bcfa2b
Merge pull request #21427 from Snuffleupagus/putBinaryImageData-convertBlackAndWhiteToRGBA
Use the `convertBlackAndWhiteToRGBA` helper with grayscale images in `putBinaryImageData`
2026-06-10 21:23:03 +02:00
Jonas Jenwald
d1926fb179 Use the convertBlackAndWhiteToRGBA helper with grayscale images in putBinaryImageData
This removes a little bit of code duplication, which only exist since the `src/display/canvas.js` code pre-dates the helper function by many years.

*Note:* Given that `OffscreenCanvas` is enabled by default there's currently not a lot of test coverage for this code-path, hence the added browser-test.
2026-06-10 18:31:07 +02:00
Jonas Jenwald
a543d0a2e0 [api-minor] Remove the unused convertToViewportRectangle method in the PageViewport class
This method has been completely unused for many years, possibly as far back as PR 8030, hence we can avoid shipping a little bit of dead code.

*Note:* If there's any third-party code depending on it, updating it ought to be as simple as changing
```javascript
const r = viewport.convertToViewportRectangle(rect);
```
into
```javascript
const r = [
  ...viewport.convertToViewportPoint(rect[0], rect[1]),
  ...viewport.convertToViewportPoint(rect[2], rect[3])
];
```
2026-06-10 14:19:20 +02:00
calixteman
ce08a803c4
Merge pull request #21416 from calixteman/drop-css-unsafe-inline
Drop 'unsafe-inline' from the CSP style-src directives
2026-06-09 23:16:38 +02:00
calixteman
a13f2aa793
Merge pull request #21413 from calixteman/improve_comb
Improve rendering of comb text fields
2026-06-09 23:10:49 +02:00
Calixte Denizet
fe5eb0f779
Improve rendering of comb text fields
Center each glyph within its comb cell instead of left-aligning it,
both in the HTML annotation layer and in the printed/saved appearance,
to match Acrobat. Cell width is now the single source of truth via the
--comb-width CSS variable, and field text-alignment (center/right) is
applied as a whole-cell --comb-offset that stays in sync on input,
blur, resetform and updatefromsandbox. The field no longer grows on
focus; trailing letter-spacing is clipped and cell dividers are drawn
on focus.
2026-06-09 22:15:40 +02:00
Calixte Denizet
5ca6026d80
Drop 'unsafe-inline' from the CSP style-src directives
The print service injected the per-PDF `@page { size }` rule as an inline
<style> element, which required 'unsafe-inline' on style-src-elem.

Inject it through a constructable CSSStyleSheet attached to
document.adoptedStyleSheets instead. Constructable stylesheets aren't
subject to style-src's inline restrictions in browsers.
2026-06-09 22:08:08 +02:00
calixteman
cb53dbecb9
Merge pull request #21419 from calixteman/chrome_ext_csp
[CRX] List all viewer-accessible schemes in the connect-src CSP
2026-06-09 21:32:08 +02:00
Tim van der Meij
c541d24ac3
Merge pull request #21407 from calixteman/fix_hidden_updated_field
Fix form fields with their own canvas updated on non-rendered pages
2026-06-09 20:03:20 +02:00
Tim van der Meij
29ad297626
Merge pull request #21409 from Snuffleupagus/PDFViewer-#setPrintingAllowed
Add a `PDFViewer` helper method for setting `#printingAllowed` and dispatching the event
2026-06-09 19:43:26 +02:00
Tim van der Meij
8a80f1b8b7
Merge pull request #21418 from Snuffleupagus/getAttachments-Map
[api-minor] Convert `getAttachments` to return data in a `Map`
2026-06-09 19:42:23 +02:00
Tim van der Meij
7f5b42140d
Merge pull request #21414 from calixteman/issue21406
Handle TR2 with /Default entry
2026-06-09 19:26:57 +02:00
Tim van der Meij
9e5cbcef50
Merge pull request #21421 from mozilla/dependabot/github_actions/github/codeql-action-4.36.1
Bump github/codeql-action from 4.36.0 to 4.36.1
2026-06-09 19:24:13 +02:00
Tim van der Meij
cf8677154b
Merge pull request #21420 from mozilla/dependabot/github_actions/actions/checkout-6.0.3
Bump actions/checkout from 6.0.2 to 6.0.3
2026-06-09 19:23:29 +02:00
calixteman
3602db7456
[CRX] List all viewer-accessible schemes in the connect-src CSP 2026-06-09 16:55:19 +02:00
dependabot[bot]
5140371ebe
Bump github/codeql-action from 4.36.0 to 4.36.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.36.0 to 4.36.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](7211b7c807...87557b9c84)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-09 12:14:30 +00:00
dependabot[bot]
380c4c8139
Bump actions/checkout from 6.0.2 to 6.0.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](de0fac2e45...df4cb1c069)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-09 12:13:07 +00:00
Jonas Jenwald
ea139e7df1 [api-minor] Convert getAttachments to return data in a Map
Compared to regular `Object`s there's a number of advantages to using `Map`s:
 - They support "proper" iteration.
 - They have a simple way to check for the existence of data.
 - They have a simple/efficient way to check the number of elements.

If this functionality was added today, I cannot imagine that we'd choose an `Object` for this sort of data.
Furthermore, in PR 21351 the data returned by `getAttachments` changed slightly and third-party users will need to update their code anyway (hence why `[api-minor]` should be fine here).
2026-06-09 10:17:23 +02:00
Calixte Denizet
473b53fe3c Handle TR2 with /Default entry
It fixes #21406.
2026-06-08 19:09:45 +02:00
calixteman
ea4fe68c01
Merge pull request #21405 from Snuffleupagus/scripting-rm-getOrInsertComputed-polyfill
Remove the `Map.prototype.getOrInsertComputed` polyfill from the scripting implementation (PR 21399 follow-up)
2026-06-08 17:25:47 +02:00
Calixte Denizet
ecd43bc8e1 Fix form fields with their own canvas updated on non-rendered pages
When a read-only field (which has its own canvas) is updated by the
sandbox while its page isn't rendered, showElementAndHideCanvas
isn't called, so once the page is finally rendered the field still
shows its outdated canvas instead of the new value.

Replace the imperative canvas/element toggling with a `sandboxModified`
class, set from the annotation storage both at render time and on
sandbox updates, and let the CSS show the element and hide the canvas.
2026-06-08 17:22:11 +02:00
calixteman
879437247b
Merge pull request #21408 from wooorm/wooorm/selection-color-transparent
Fix transparent color of `::selection` in Firefox
2026-06-08 16:57:34 +02:00
Jonas Jenwald
f93faae01c Add a PDFViewer helper method for setting #printingAllowed and dispatching the event
This reduces a little bit of code duplication, which shouldn't hurt.
2026-06-08 15:30:05 +02:00
Titus Wormer
7b54ec0a8d
Fix transparent color of ::selection in Firefox
This forces `color: transparent` on selections.
In latest Firefox Nightly, this is no longer inherited on
`::selection` from the normal element.

References: <753827d749>
2026-06-08 15:14:21 +02:00
calixteman
fadd201c09
Merge pull request #21404 from matasaru/master
fixed typo in README.md
2026-06-08 11:56:28 +02:00
Jonas Jenwald
5f83408099 Remove the Map.prototype.getOrInsertComputed polyfill from the scripting implementation (PR 21399 follow-up)
All unit- and integration-tests pass with this patch, and according to the QuickJS changelog this is supported now; note 3d5e064e9d/Changelog (L10) and https://github.com/tc39/proposal-upsert.
2026-06-08 11:48:42 +02:00
calixteman
52a44a68be
Merge pull request #21399 from calixteman/update_quickjs_3d5e064
Update quickjs to rev 3d5e064e9dd67c70f7962836505a7fa067bf0a4e
2026-06-08 10:38:44 +02:00
calixteman
7a7e4fd382 Update quickjs to rev 3d5e064e9dd67c70f7962836505a7fa067bf0a4e 2026-06-08 09:26:36 +02:00
radu
82098f175b fixed typo in README.md 2026-06-07 18:52:07 -04:00
Tim van der Meij
ff88446d01
Merge pull request #21402 from timvandermeij/updates
Update dependencies to the most recent versions
2026-06-07 17:08:06 +02:00
Jonas Jenwald
4a01dd669a
Merge pull request #21400 from Snuffleupagus/workflows-test-external-folder
Run various test-suite when the `external/` folder is modified
2026-06-07 16:52:39 +02:00
Tim van der Meij
4112c2953b
Upgrade @eslint/json to version 2.0.0
This is a major version bump, but the changelog at
https://github.com/eslint/json/releases/json-v2.0.0
doesn't indicate any breaking changes that should impact us.
2026-06-07 16:14:37 +02:00
Tim van der Meij
984fcd4bae
Update dependencies to the most recent versions 2026-06-07 16:13:36 +02:00
Jonas Jenwald
9c0b56ac07 Run various test-suite when the external/ folder is modified
Given that the `external/` folder contains various imported code/resources, all of which could affect functionality and/or rendering, it seems safest to simply run browser/font/integration/unit tests whenever any part of that folder is touched.
2026-06-07 16:03:40 +02:00
Tim van der Meij
f86b5abb05
Merge pull request #21398 from timvandermeij/codecov-ci-fix
Upgrade `codecov/codecov-action` to version 7.0.0
2026-06-07 15:39:39 +02:00
Tim van der Meij
b8ad7c8d0f
Upgrade codecov/codecov-action to version 7.0.0
Codecov had to migrate to a new Keybase account after losing access to
their old Keybase account, and because of that the old account got
bricked to prevent misuse [1] which resulted in GPG verification
failures in our builds [2]. This new version of the action fixes the
issue by using the new account.

Fixes #21394.

[1] https://github.com/codecov/codecov-action/issues/1956
[2] https://github.com/codecov/codecov-action/issues/1955
2026-06-07 14:52:24 +02:00
Tim van der Meij
d9eea18876
Merge pull request #21396 from Snuffleupagus/injectLinkAnnotations-move-call
Prevent intermittent issues when invoking the `PDFPageView.prototype.#injectLinkAnnotations` method
2026-06-07 14:42:14 +02:00
Tim van der Meij
bfc33678da
Merge pull request #21395 from Snuffleupagus/DrawLayerBuilder-cancel-optional-chaining
Shorten the `DrawLayerBuilder.prototype.cancel` method a tiny bit
2026-06-07 14:35:40 +02:00
Jonas Jenwald
43dd2781a0 Prevent intermittent issues when invoking the PDFPageView.prototype.#injectLinkAnnotations method
Looking at the coverage data there are cases where we attempt to insert inferred link-annotations *before* the annotationLayer has rendered, see [here](2348365874/blob/web/annotation_layer_builder.js (L246)), which shouldn't happen and why that's treated as an Error.

This is most likely caused by the asynchronicity of all the relevant code, since the `Autolinker` functionality can only be invoked after both the annotationLayer *and* the textLayer have finished rendering.
Given that those operations are asynchronous, by the time that they complete it's possible that the annotationLayer (and also the textLayer) has been replaced by a new instance. In that case we might thus attempt to inject inferred link-annotations before the "new" annotationLayer has rendered.

To avoid this intermittent issue, we now ensure that the annotationLayer and textLayer haven't changed between those layers rendering and the `Autolinker` functionality being invoked. (If they did change, then a future `render` call will trigger the inferred link-annotations handling).
2026-06-07 11:28:57 +02:00
Jonas Jenwald
0eca809589 Shorten the DrawLayerBuilder.prototype.cancel method a tiny bit
By replacing the early return with optional chaining, a pattern that we already use in lots of places, the code becomes a tiny bit shorter and more importantly the code coverage for this file becomes 100 percent.
2026-06-06 23:41:31 +02:00
Tim van der Meij
f12c463452
Merge pull request #21393 from Snuffleupagus/PDFCursorTools-tests
Add basic integration-tests for the `PDFCursorTools` functionality
2026-06-06 19:51:52 +02:00
Tim van der Meij
81f15c3437
Merge pull request #21390 from Snuffleupagus/getDocument-binary-string-unit-test
Add a unit-test for passing a binary string to `getDocument`
2026-06-06 19:46:45 +02:00
Tim van der Meij
f4d6b4ef85
Merge pull request #21391 from Snuffleupagus/getDocument-Node-fs-unit-test
Add a unit-test for passing a filesystem URL-string (in Node.js) to `getDocument`
2026-06-06 19:45:26 +02:00
Jonas Jenwald
0b3b101dbc Remove the unused GrabToPan.prototype.toggle method
Given that the cursor tools are managed via the `PDFCursorTools` class, of which the `GrabToPan` instance is essentially a (semi) private implementation detail, the `GrabToPan.prototype.toggle` method is completely unused and can thus be removed.
2026-06-06 17:27:19 +02:00
Jonas Jenwald
a5333f2a92 Add a unit-test for passing a binary string to getDocument
This format is obviously not very efficient however it's been supported since "forever" and there's even examples using, hence it seems like a good idea to actually test this.
2026-06-06 14:37:25 +02:00
Jonas Jenwald
ae30748956 Add basic integration-tests for the PDFCursorTools functionality 2026-06-06 14:32:15 +02:00
calixteman
2348365874
Merge pull request #21392 from Snuffleupagus/Autolinker-invalid-email-domain-test
Add one more unit-test case for invalid email domains in the `Autolinker` class
2026-06-06 13:17:11 +02:00
Jonas Jenwald
08b704d4b1 Add one more unit-test case for invalid email domains in the Autolinker class
This improves coverage for a branch of the `Autolinker` class that wasn't previously tested.
2026-06-06 11:57:22 +02:00
Jonas Jenwald
a7d32f4518 Add a unit-test for passing a filesystem URL-string (in Node.js) to getDocument
This improves coverage for a part of the API that previously wasn't tested.
2026-06-05 23:17:11 +02:00
Tim van der Meij
9c437e6ab4
Merge pull request #21388 from calixteman/strip_jbig2_header
Strip the JBIG2 file header from JBIG2Decode streams
2026-06-05 20:06:02 +02:00
Tim van der Meij
4ed78beb38
Merge pull request #21387 from Snuffleupagus/ChunkedStream-abort-reject
Reject the stream-capability when aborting the `ChunkedStreamManager`
2026-06-05 20:02:02 +02:00
Tim van der Meij
e34e11cf78
Merge pull request #21386 from KonstantinRight/print-params-flag-fix
fix typo in bit flag value for suppressCropClip
2026-06-05 19:58:58 +02:00
Tim van der Meij
c8fb1be7b6
Merge pull request #21389 from calixteman/readme_ccov
Update the README in order to add some info about code coverage
2026-06-05 19:57:18 +02:00
Calixte Denizet
9ab6b743ea Update the README in order to add some info about code coverage 2026-06-05 17:45:20 +02:00
calixteman
173e083c71
Merge pull request #21350 from calixteman/kb_shortcuts_l10n
Match editor keyboard shortcuts by event.code as a fallback
2026-06-05 17:19:17 +02:00
Calixte Denizet
88c52a1523 Strip the JBIG2 file header from JBIG2Decode streams
It's rendering correctly in Acrobat and PdfBox.
2026-06-05 16:31:44 +02:00
Jonas Jenwald
959ce38f5b Reject the stream-capability when aborting the ChunkedStreamManager
Given that any incoming data is already being ignored after loading has been aborted, it seems reasonable to reject the stream-capability to avoid it remaining in a pending state indefinitely.

*Note:* This is something that I noticed while looking at the coverage data, since the `ChunkedStreamManager.prototype.onError` method is not used and from a brief look at the history of the code it never appears to have been used either.
2026-06-05 12:25:53 +02:00
Konstantin
a66782615e fix typo in bit flag value for suppressCropClip 2026-06-05 11:30:20 +03:00
calixteman
091f459d2e
Merge pull request #21358 from sfoster/bug-203525-viewer-favicon
Bug 2035251 - Use toolkit's pdf icon as favicon
2026-06-04 21:35:28 +02:00
Tim van der Meij
23ea0810d9
Merge pull request #21379 from calixteman/dedup_stream_merging
Deduplicate shared font/image streams when merging PDFs
2026-06-04 20:58:22 +02:00
Sam Foster
b9e3a6b5d0 Bug 2035251 - Use toolkit's pdf icon as favicon 2026-06-04 11:58:12 -07:00
Tim van der Meij
7f15bd6591
Merge pull request #21383 from calixteman/ko_inner_bd
Add knockout_inner_backdrop ref test
2026-06-04 20:41:50 +02:00
Tim van der Meij
dc3696f23c
Merge pull request #21384 from Snuffleupagus/Stream-getBytes-shorten
Shorten the `getBytes` method in the `Stream`/`ChunkedStream` classes
2026-06-04 20:41:07 +02:00
Tim van der Meij
0cc139fdfc
Merge pull request #21385 from Snuffleupagus/AppOptions-unittest-EVENT_DISPATCH
Extend the `AppOptions` unit-tests to also cover the `EVENT_DISPATCH` option-kind
2026-06-04 20:36:17 +02:00
Tim van der Meij
d619ff3207
Merge pull request #21380 from Snuffleupagus/AnnotationLayerBuilder-rm-#externalHide
Remove the `#externalHide` field from the `AnnotationLayerBuilder` class
2026-06-04 20:35:14 +02:00
Tim van der Meij
f45a1b4df5
Merge pull request #21382 from mozilla/dependabot/github_actions/github/codeql-action-4.36.0
Bump github/codeql-action from 4.35.5 to 4.36.0
2026-06-04 20:32:41 +02:00
Jonas Jenwald
dc602ae543 Extend the AppOptions unit-tests to also cover the EVENT_DISPATCH option-kind 2026-06-04 17:51:41 +02:00
Jonas Jenwald
d36d3ab893 Shorten the getBytes method in the Stream/ChunkedStream classes
This is very old code and there's currently a bit of unneeded duplication in these methods, especially in the `ChunkedStream` class.
2026-06-04 13:10:24 +02:00
Calixte Denizet
e4a3e91444 Add knockout_inner_backdrop ref test
Non-isolated subgroup needing isolation (Multiply BM) nested in a KO
group, exercising the inner-backdrop blend path.
2026-06-04 09:13:43 +02:00
dependabot[bot]
936a472f05
Bump github/codeql-action from 4.35.5 to 4.36.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.5 to 4.36.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9e0d7b8d25...7211b7c807)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-04 00:19:24 +00:00
calixteman
9071f451a5
Merge pull request #21359 from Snuffleupagus/coverage-browser-tests
Run browser tests to collect code coverage data
2026-06-03 19:01:52 +02:00
Jonas Jenwald
890edc9265 Run browser tests to collect code coverage data
Obviously it's not yet possible to just migrate `gulp browsertest` to GitHub Actions, however it's already possible to at least run the browser tests there which allows collection of more code coverage data.
This should thus give us more realistic coverage numbers, since currently there's many `src/` files that have very low code coverage.

By taking advantage of the fact that the GitHub Actions runners provide multiple cores, these tests are also fairly fast:
 - The ubuntu-latest/firefox job complete in ~9 minutes.
2026-06-03 18:15:18 +02:00
Jonas Jenwald
b168293c17
Merge pull request #21351 from wooorm/wooorm/auth-event-and-encrypted-attachments
[api-minor] Add support for `/AuthEvent`, on-demand decryption
2026-06-03 18:13:44 +02:00
Titus Wormer
4db9e45b8c
Add support for /AuthEvent, on-demand decryption
Normally entire PDFs are encrypted (or not).
But it is also possible to only encrypt attachments.
It is then also possible to *only* prompt for a password when the user opens
them.

In the existing flow, prompting for passwords happens because things are decrypted.
A specific error is thrown, caught, and the user is prompted.
To keep this flow working, this PR changes to decrypting attachments on demand,
instead of eagerly.
This sounds logical: to not read attachments on startup.

I’ve extensively tested this, not only with regular attachments, but also with outline items
and attachments in annotations.

This PR builds on GH-21234.
It’s an alternative to the naïve GH-20732.

Closes GH-20049.
2026-06-03 16:44:57 +02:00
Jonas Jenwald
5907d87774 Remove the #externalHide field from the AnnotationLayerBuilder class
Prior to PR 20321 the annotationLayer was hidden when there was no regular annotations on the page, which meant that if there were any inferred links (from the textLayer) the annotationLayer needed to be made visible but in such a way that it wouldn't override an explicit `hide`-call from the `PDFPageView` class.

With the changes in the aforementioned PR the annotationLayer is now always "visible", and this code can thus be simplified a little bit.
2026-06-03 13:56:43 +02:00
Calixte Denizet
836a08084e Match editor keyboard shortcuts by event.code as a fallback
So that Ctrl+A, Ctrl+Z, etc. still fire on non-US keyboard layouts where
the physical "A" key produces a non-Latin character (Cyrillic, Greek,
some AZERTY combinations, ...). KeyboardManager now tries event.key first
and falls back to a US-layout translation of event.code (KeyA => a,
Digit1 => 1, Numpad1 => 1) when no shortcut is bound on event.key.

Also refactors KeyboardManager to store modifiers as a bitmask instead
of a serialized string, and treats a shortcut array without any
"mac+"-prefixed entry as applying on all platforms, letting us drop the
redundant "mac+X" duplicates of bare "X" entries across the editor code.
2026-06-03 10:13:41 +02:00
Calixte Denizet
1a7821ab13 Deduplicate shared font/image streams when merging PDFs
Identical embedded fonts and images across the merged documents are now
written once and shared, instead of being copied per source file.
And avoid to compress already compressed stream with Brotli.
2026-06-02 22:08:21 +02:00
Jonas Jenwald
19046a6949
Merge pull request #21349 from Snuffleupagus/OptionalContentConfig-serializable
Implement proper serialization of `OptionalContentConfig`
2026-06-02 21:57:16 +02:00
Tim van der Meij
e9a946ec0b
Merge pull request #21378 from wooorm/wooorm/fix-selection-rendering-off
Fix broken `enableSelectionRendering: false`
2026-06-02 21:02:18 +02:00
Tim van der Meij
744c1e6d7a
Merge pull request #21372 from calixteman/issue7998
Render gray transparency groups in grayscale
2026-06-02 20:10:18 +02:00
Tim van der Meij
e9ee61f67c
Merge pull request #21347 from calixteman/issue21240
Restore editor layer state for unchanged pages after page mutations
2026-06-02 20:08:14 +02:00
Tim van der Meij
27b345a61e
Merge pull request #21361 from timvandermeij/is-canvas-monochrome
Fix intermittent failure in the "must check that a freetext is still here after having updated it and scroll the doc" freetext editor integration test
2026-06-02 20:01:24 +02:00
Titus Wormer
a8cf37f6bc
Fix broken enableSelectionRendering: false
Closes GH-21374.
Related-to GH-20981.
2026-06-02 12:57:04 +02:00
Jonas Jenwald
b43ef1c746
Merge pull request #21373 from Snuffleupagus/presentation-mode-test-links
Add an integration-test for clicking on internal links in presentation mode
2026-06-02 10:56:14 +02:00
Jonas Jenwald
065ea625dd
Merge pull request #21371 from Snuffleupagus/BaseStream-clone-fix
Improve the `BaseStream.prototype.clone` implementations
2026-06-02 10:54:36 +02:00
Jonas Jenwald
4e6b7be4d7 Add an integration-test for clicking on internal links in presentation mode 2026-06-01 14:25:55 +02:00
calixteman
69e8d6900f Render gray transparency groups in grayscale
It fixes #7998.
2026-05-31 21:16:29 +02:00
Jonas Jenwald
a6321e7201 Improve the BaseStream.prototype.clone implementations
- The `dict` field is optional, hence avoid an Error if trying to clone a non-existent dictionary.

 - Use the `length` getter in the `Stream` class, to avoid duplication.

 - Fix the `DecodeStream` implementation, since it has a couple of bugs:
    - The `clone` method currently uses `start`/`end` fields, despite these only existing on `Stream` instances.
    - Given the previous point, we ended up creating the cloned `Stream` instance using the *entire* underlying `buffer`. This is problematic since the length of a `DecodeStream` cannot be accurately estimated before decoding, and the `buffer`-length is simply a multiple of two.
       Unless the size of the decoded-data just happens to also be a multiple of two, this causes the cloned `Stream` instance to be "padded" with zeros at the end.
2026-05-31 20:24:39 +02:00
Tim van der Meij
5fbab91f71
Merge pull request #21368 from Snuffleupagus/more-internal-events
Mark a couple of viewer, and editor, EventBus listeners as "internal"
2026-05-31 14:35:18 +02:00
Jonas Jenwald
94fdea15f4
Merge pull request #21366 from Snuffleupagus/StringStream-dict
Update the `StringStream` constructor to accept an optional dictionary argument
2026-05-31 13:01:43 +02:00
Jonas Jenwald
04237100a5 Mark a couple of viewer, and editor, EventBus listeners as "internal"
There's currently a few EventBus listeners that aren't marked as "internal", however I'm assuming that they probably should be (e.g. to reduce the risk of intermittent failures in the integration-tests).
2026-05-31 12:12:41 +02:00
Jonas Jenwald
345089de1f
Merge pull request #21367 from Snuffleupagus/canvas-MathClamp
Use the `MathClamp` helper function in the `src/display/canvas.js` file
2026-05-31 11:55:48 +02:00
Tim van der Meij
add30f3ca0
Fix intermittent failure in the "must check that a freetext is still there after having updated it and scroll the doc" freetext editor integration test
The problem is that we screenshot the page itself rather than the
canvas, even though we specifically care about the latter according to
the comment, which means that we manually have to take care of hiding and
showing the annotation editor. This is problematic because even though
we signal that the annotation editor should be hidden, we don't wait
until that is actually done, which leads to a situation where we can
take the screenshot before the annotation editor is actually invisible
in the view.

This commit fixes the issue by screenshotting the canvas instead, which
avoids the need for manually hiding/showing the annotation editor. This
makes the test less fragile, and matches other tests better.
2026-05-31 11:36:44 +02:00
Jonas Jenwald
06439a95c3 Update the StringStream constructor to accept an optional dictionary argument
There's currently some amount of `StringStream` usage where the `dict`-parameter is manually assigned, and by updating the signature of the constructor this can be avoided.
2026-05-31 11:36:32 +02:00
Tim van der Meij
327822c21f
Merge pull request #21365 from calixteman/cmap_overflow
Skip the format 4 cmap sub-table when it doesn't fit its 16-bits fields
2026-05-31 11:32:58 +02:00
Tim van der Meij
af2380060a
Merge pull request #21364 from timvandermeij/webgpu-logs
Disable WebGPU for Firefox tests
2026-05-31 11:19:22 +02:00
Jonas Jenwald
0e1660700a Use the MathClamp helper function in the src/display/canvas.js file 2026-05-31 11:13:42 +02:00
calixteman
5d28cf5e88 Skip the format 4 cmap sub-table when it doesn't fit its 16-bits fields
It's a follow-up of bug 199861 (see https://bugzilla.mozilla.org/show_bug.cgi?id=1998618#c2).
2026-05-30 21:53:29 +02:00
Tim van der Meij
eef4ea620e
Disable WebGPU for Firefox tests
The GitHub Actions workflow for the integration tests on Windows logs
the following line for every test:

`JavaScript warning: http://127.0.0.1:62313/build/generic/build/pdf.mjs,
line 134934: WebGPU is disabled by blocklist.`

On Linux WebGPU is disabled by default because of missing support, but on
Windows it's enabled by default since bug 1972486, so we try to obtain a
GPU adapter which fails (and logs) if there is no actual GPU like on
GitHub Actions. Coverage data confirms that our own WebGPU code is
already uncovered because of the lack of a GPU, so having WebGPU enabled
or disabled doesn't change that, but if it causes log spam it seems
better to disable it, which this commit does.

Note that Chrome doesn't seem to have a matching flag, but Chrome already
doesn't log anything about this (which is the primary driver for this
change), so that's not a problem.
2026-05-30 19:30:24 +02:00
Tim van der Meij
145feeaa3f
Merge pull request #21360 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-05-30 15:19:21 +02:00
Tim van der Meij
6701ccd86b
Bump the stable version in pdfjs.config 2026-05-30 15:14:47 +02:00
Jonas Jenwald
241dbabbf1
Merge pull request #21355 from Snuffleupagus/INTERNAL_EVT
Re-factor how "internal" EventBus listeners are handled in the viewer
2026-05-30 11:39:22 +02:00
Jonas Jenwald
74db085794 Re-factor how "internal" EventBus listeners are handled in the viewer
Currently the viewer uses semi-private `EventBus.prototype.{_on, _off}` methods, to try and ensure that all internal viewer state is updated *before* any "external" listeners are invoked.
For all use-cases outside of the viewer, e.g in the integration-tests, the `EventBus.prototype.{on, off}` methods are supposed to be used instead.

Unfortunately this isn't currently enforced in any way, except (hopefully) during review, and generally speaking it's not really possible to prevent the semi-private methods being used (e.g. by third-party users).
Hence this patch adds a new `INTERNAL_EVT` property which is *not* exposed anywhere (neither in the API nor globally), and whose value is generated at build-time, that the viewer uses to mark its `EventBus` listeners are internal.
This allows us to remove the semi-private `EventBus` methods, which helps to simplify that class a little bit.
2026-05-29 22:11:58 +02:00
Tim van der Meij
19d95c8fee
Merge pull request #21285 from timvandermeij/puppeteer-25
Upgrade Puppeteer to version 25.1.0
2026-05-29 21:09:24 +02:00
Tim van der Meij
b9b7661e64
Upgrade Puppeteer to version 25.1.0
This is a major version bump, but the changelog at
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v25.0.0
doesn't indicate any breaking changes that should impact us.

Moreover, this release contains the fix for the memory leak from
puppeteer/puppeteer#14876, so we can remove
the workaround related to that now.

Finally, we rename `.puppeteerrc` to `.puppeteerrc.json` because of
https://github.com/puppeteer/puppeteer/issues/15076, but in general it's
a good idea to be explicit about the file format via its extension, so
even if this upstream bug is fixed we don't need to revert this.
2026-05-29 20:24:42 +02:00
Tim van der Meij
e7f951dc1b
Merge pull request #21357 from timvandermeij/fix-browser-test-exit-code
Fix missing non-zero exit code for failure cases in `test.mjs`
2026-05-29 20:23:22 +02:00
Tim van der Meij
8d5fe521b3
Fix missing non-zero exit code for failure cases in test.mjs
The two affected code paths caught and logged errors, but that wasn't
reflected in the exit code of the process, and that is what GitHub
Actions (and other tools) to determine if process execution was
successful or not. This commit fixes the issue by making sure we
consistently exit with code 1 in case of errors so that GitHub Actions
pipelines correctly reflect the outcome of the test run.
2026-05-29 19:24:31 +02:00
calixteman
80c8e62e65
Merge pull request #21308 from calixteman/bug2036265
Add a pref to postMessage when mozPrintCallback has completed (bug 2036265)
2026-05-29 14:32:29 +02:00
calixteman
c7a32c3db6
Merge pull request #21343 from calixteman/issue9437
Clamp out-of-range BlueScale to Adobe's valid window
2026-05-29 08:58:05 +02:00
calixteman
3fe3321f7a
Merge pull request #21334 from calixteman/merge_images
Allow inserting an image as a new page when editing a PDF (bug 2032967)
2026-05-29 08:22:53 +02:00
calixteman
3e76bfd364
Merge pull request #21354 from mozilla/update-locales
l10n: Update locale files
2026-05-29 08:17:11 +02:00
github-actions[bot]
fc6e19b9cb l10n: Update locale files 2026-05-29 00:55:59 +00:00
Calixte Denizet
600986b51d Allow inserting an image as a new page when editing a PDF
Image files dropped on or selected via the thumbnail viewer's
"add file" picker are now accepted alongside PDFs and inserted
as synthetic pages sized to the document's modal page dimensions.

The image-encoding helper previously embedded in StampAnnotation has
moved to src/core/editor/pdf_images.js so it can be shared between
stamp annotations and page synthesis.
2026-05-28 22:11:13 +02:00
calixteman
389853d473
Merge pull request #21336 from calixteman/issue15292
Parse CID-keyed Type 1 fonts instead of falling back to a system font
2026-05-28 21:45:30 +02:00
Tim van der Meij
7d305ff281
Merge pull request #21335 from calixteman/multiple_merge
Allow merging several PDFs at once via the picker or drag-and-drop
2026-05-28 21:01:05 +02:00
Tim van der Meij
be8a8c4309
Merge pull request #21348 from calixteman/issue21346
Use a black backdrop for Luminosity SMasks when /BC is missing
2026-05-28 20:46:47 +02:00
Tim van der Meij
5d7ec1fb79
Merge pull request #21345 from mozilla/dependabot/github_actions/codecov/codecov-action-6.0.1
Bump codecov/codecov-action from 6.0.0 to 6.0.1
2026-05-28 20:42:47 +02:00
Tim van der Meij
6e9ee9fcdc
Merge pull request #21344 from mozilla/dependabot/github_actions/github/codeql-action-4.35.5
Bump github/codeql-action from 4.35.4 to 4.35.5
2026-05-28 20:42:09 +02:00
calixteman
974f98613f
Merge pull request #21234 from wooorm/wooorm/encrypted-attachments
Add support for encrypted attachments
2026-05-28 16:07:00 +02:00
Titus Wormer
45cdb5d3e8
Add support for encrypted attachments
This PR is related to GH-20732, which is about `AuthEvent` (to delay
promting for a password), but instead adds the actual support for
encrypted attachments.
“Encrypted attachments” means that the main things are plain text.
Note that some PDF viewers, like Preview/QuickLook/Safari or Chrome,
do not support attachments at all.
Note that the file checked into the tests is the same as
`output-no-auth-event.pdf` referenced in
<https://github.com/mozilla/pdf.js/issues/20139#issuecomment-3952462166>.

Closes GH-20139.
2026-05-28 10:30:37 +02:00
Jonas Jenwald
ce45d5a443 Implement proper serialization of OptionalContentConfig
I happened to notice that the way the `OptionalContentConfig`-data handled in the PR that implements worker-rendering leaves a lot to be desired:
 - The way that the optional content state is handled is not correct, since that PR collects the "effective visibility" of the optional content groups rather than their *actual* internal state.

 - The necessary `OptionalContentConfig`-data is collected piecemeal in the API, which leads to quite frankly very messy code that's hard to read and will be even harder to maintain.

The solution to all of these issues seem really simple though, just add a couple of `OptionalContentConfig` methods that serialize/de-serialize the necessary data.
In the API calling `optionalContentConfig.serializable` will get *all* of the needed data for transferring to the worker-renderer, and once received there calling `OptionalContentConfig.fromSerializable(/* transferred data here */)` will create an `OptionalContentConfig` instance with the correct internal state.

As part of this patch, to avoid increasing bundle-size unnecessarily, a couple of existing methods are stubbed out when the `OptionalContentConfig` class ends up in a worker-file (since they're unused there).
This part assumes that the new worker-renderer is built correctly, note how the existing `pdf.worker.mjs` is handled in 03eda70d7e/gulpfile.mjs (L539-L545)

(*Note:* Submitting a PR was a lot faster than trying to provide review comments, since writing this commit message took longer than writing the patch.)
2026-05-27 11:06:57 +02:00
Calixte Denizet
a33e06cafb Use a black backdrop for Luminosity SMasks when /BC is missing
It fixes #21346.
2026-05-26 22:36:50 +02:00
Calixte Denizet
8e6e35473f Restore editor layer state for unchanged pages after page mutations
It fixes #21240.
2026-05-26 22:27:35 +02:00
dependabot[bot]
8666bca8ae
Bump codecov/codecov-action from 6.0.0 to 6.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](57e3a136b7...e79a6962e0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-26 19:41:27 +00:00
dependabot[bot]
e1ddc6614b
Bump github/codeql-action from 4.35.4 to 4.35.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.4 to 4.35.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](68bde559de...9e0d7b8d25)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-26 19:41:13 +00:00
calixteman
385b1ca412 Clamp out-of-range BlueScale to Adobe's valid window
Fonts that ship a BlueScale outside the range AFDKO considers valid
for their zone heights (0.5/maxZoneHeight <= BlueScale <= 1/maxZoneHeight)
cause Firefox's CFF rasterizer to misalign overshooting glyphs against
flat-topped ones at body sizes.
Clamp into that window, only apply the lower clamp when BlueScale is
also smaller than the default, so foundry fonts that pair the default
0.039625 with small zones are untouched.

Fixes #9437.
2026-05-26 21:24:51 +02:00
Jonas Jenwald
b849567c10
Merge pull request #21342 from mozilla/revert-21339-remove-unused-variables
Revert "Remove unused variables with the Babel plugin"
2026-05-26 21:04:45 +02:00
Jonas Jenwald
6d8d6f1349
Revert "Remove unused variables with the Babel plugin" 2026-05-26 21:00:25 +02:00
Jonas Jenwald
6a1368ad81
Merge pull request #21339 from nicolo-ribaudo/remove-unused-variables
Remove unused variables with the Babel plugin
2026-05-26 18:59:32 +02:00
calixteman
e1de5c30b5 Parse CID-keyed Type 1 fonts instead of falling back to a system font
It fixes #15292.

PDFs can embed a CID-keyed Type 1 program (Adobe TechNote 5014,
CIDFontType 0) under /Subtype /CIDFontType0 + /FontFile. Its binary
CIDMap/SubrMap layout has no eexec block, so Type1Font's eexec-only
parser used to fall through and trigger the work-around added in
PR #15397.
Split the constructor and parse the binary CIDMap, SubrMap
and charstrings (encrypted with the standard Type 1 charstring cipher)
through the existing Type1CharString.convert + CFF wrap pipeline.

Only single-FDArray fonts are supported; the StartData length is
clamped to the stream's remaining bytes before allocating.
2026-05-26 17:49:56 +02:00
Nicolò Ribaudo
2691868904 Remove unused variables with the Babel plugin
- functions were already removed
- variables can be removed when their initializer does not have side effects
- classes can be removed when they have no static blocks

Fixes #21337
2026-05-26 16:35:57 +02:00
calixteman
03eda70d7e
Merge pull request #21340 from Snuffleupagus/test-modified-external-builder
Run unit-tests and integration-tests when the `external/builder/` folder is changed
2026-05-26 16:14:36 +02:00
Jonas Jenwald
927da8c78e Run unit-tests and integration-tests when the external/builder/ folder is changed
Given that changes to either the Babel plugin or the "old" builder could accidentally cause issues in the built files, it seems like a good idea to run all test-suites when the `external/builder/` folder is changed.
2026-05-26 15:12:22 +02:00
Calixte Denizet
6b92ad5924 Allow merging several PDFs at once via the picker or drag-and-drop 2026-05-25 21:09:42 +02:00
Tim van der Meij
e7661983f7
Merge pull request #21333 from calixteman/fix_test_timeout
Recover the browser session on test timeout to keep running subsequent tests
2026-05-25 18:27:31 +02:00
Tim van der Meij
d1c85f87f7
Merge pull request #21330 from calixteman/fix_regex
Enable 'eslint-plugin-regexp' and fix existing findings
2026-05-25 18:22:21 +02:00
Calixte Denizet
91ca580f31 Recover the browser session on test timeout to keep running subsequent tests
When a reftest hangs and trips the per-browser timeout, the session was
closed, which left every remaining task in the per-browserType queue with
no consumer and effectively skipped the rest of the manifest. Instead,
mark the in-flight task(s) as failed, reload the page so the driver can
reconnect and request the next task, and only fall back to closing the
session if the reload itself fails.
2026-05-25 16:50:55 +02:00
calixteman
f82382e010
Merge pull request #21331 from calixteman/fix_cjk_file
Load the predefined CMap for composite fonts that omit the FontDescriptor
2026-05-25 16:40:11 +02:00
Jonas Jenwald
f156b8190b
Merge pull request #21332 from Snuffleupagus/direct-return
Avoid a temporary variable and return results directly in a couple of functions
2026-05-25 16:14:15 +02:00
Calixte Denizet
567f585def Add a pref-controlled method to notify embedders that mozPrintCallback has completed (bug 2036265)
Adds a `postMessageAfterPrintCallback` browser option (off by default).
When enabled by Firefox, the print service posts "ready" or "error" to
the window after each page's mozPrintCallback resolves, so embedders
(e.g. print-preview test harnesses) can observe when rendering is done.

Upstreams the viewer-side portion of Phabricator D297837.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Daniel Holbert <dholbert@cs.stanford.edu>
2026-05-25 15:42:19 +02:00
Jonas Jenwald
48a12ac225 Avoid a temporary variable and return results directly in a couple of functions 2026-05-25 15:33:39 +02:00
Calixte Denizet
8f85e3f20b Load the predefined CMap for composite fonts that omit the FontDescriptor
and add font substitutions for the standard Acrobat CJK families.
2026-05-25 14:44:48 +02:00
calixteman
164ffb9042
Merge pull request #21321 from danyalahmed1995/fix/issue-21259-text-layer-spacing
Prevent inherited spacing from affecting text layer
2026-05-25 14:36:22 +02:00
Calixte Denizet
7bda0fc97c Enable 'eslint-plugin-regexp' and fix existing findings
Enable the recommended preset and fix or per-line-disable the 78
findings it surfaces. Most are equivalent rewrites, intentional
patterns (control chars, the whatwg email regex, autolinker URL regex)
keep their behavior via targeted disables.
2026-05-25 14:31:55 +02:00
Tim van der Meij
87b436ddd4
Merge pull request #21329 from calixteman/fix_selection_color
Force the text selection color to be in light mode
2026-05-25 13:59:13 +02:00
Calixte Denizet
f7af3ea9ac Force the text selection color to be in light mode
Most of the pdfs have a white background, so it makes sense to use the colors for light mode.
2026-05-25 12:59:54 +02:00
calixteman
1cb14a02d3
Merge pull request #21314 from calixteman/issue21312
Recover CFF FontBBox with negative coordinates encoded as unsigned 16-bit
2026-05-25 08:57:43 +02:00
Calixte Denizet
9391296036 Recover CFF FontBBox with negative coordinates encoded as unsigned 16-bit
It fixes #21312.
2026-05-25 08:36:18 +02:00
calixteman
5f2691e77d
Merge pull request #21328 from timvandermeij/updates
Update dependencies to the most recent versions
2026-05-25 08:33:34 +02:00
Danyal Ahmed
4ee9c39fc8 Prevent inherited spacing from affecting text layer
Fixes #21259.

Reset letter-spacing and word-spacing on the text layer and hidden measurement canvas so inherited page styles do not affect text layer alignment. Add an integration regression test for inherited spacing.
2026-05-24 23:56:23 +05:00
Tim van der Meij
33d8f45fc5
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`, and brings
the number of reported vulnerabilities back to zero by patching:

- GHSA-jxxr-4gwj-5jf2: "brace-expansion: Large numeric range defeats
  documented `max` DoS protection"
- GHSA-58qx-3vcg-4xpx: "ws: Uninitialized memory disclosure"
2026-05-24 19:34:07 +02:00
Tim van der Meij
f1f8e2c04e
Upgrade postcss-values-parser to version 8.0.0
This is a major version bump, but the changelog at
17304bbe9c
doesn't indicate any breaking changes that should impact us.
2026-05-24 19:29:57 +02:00
Tim van der Meij
0fa006997b
Update dependencies to the most recent versions 2026-05-24 19:29:09 +02:00
Tim van der Meij
e6cb600896
Merge pull request #21320 from calixteman/issue7625
Substitute a system font when an embedded CFF is truncated
2026-05-24 19:00:50 +02:00
calixteman
adcde1175e Substitute a system font when an embedded CFF is truncated
It fixes #7625.

If the Top DICT's Private DICT extends past the end of the font data,
the Local Subrs INDEX is unreachable and every CharString that calls
a subr ends up as a blank glyph. Throw from parsePrivateDict so the
existing catch in translateFont triggers fallbackToSystemFont, then
run getFontSubstitution post-construction so we pick a close local
match instead of the generic fallbackName.
2026-05-24 18:10:09 +02:00
calixteman
143a7244a3
Merge pull request #21315 from calixteman/issue18548
Keep the first /Subrs and /CharStrings block
2026-05-24 18:07:20 +02:00
Tim van der Meij
13a61b1f72
Merge pull request #21319 from Snuffleupagus/XRefWrapper-fix
Fix the `XRefWrapper` implementation, in the `src/core/editor/pdf_editor.js` file
2026-05-24 15:06:22 +02:00
Tim van der Meij
941e17296e
Merge pull request #21313 from Snuffleupagus/Annotation-OC
Add support for Optional Content in the AnnotationLayer (issue 20433)
2026-05-24 15:02:06 +02:00
calixteman
1f8eed020f Keep the first /Subrs and /CharStrings block
Some Type1 fonts (the embedded Optima variants in orw1972.pdf) ship
two /Subrs and /CharStrings blocks wrapped in save/restore frames
gated on an Adobe hires/lores runtime switch.
In such cases, we just use the first /Subrs and /CharStrings block,
which is the one that is actually used by the font renderer in Acrobat.

It fixes #18548.
2026-05-24 15:01:22 +02:00
Tim van der Meij
bbfbe5159c
Merge pull request #21324 from Snuffleupagus/scaleCharBBox
Simplify how the character BBox is scaled in `src/display/canvas_dependency_tracker.js`
2026-05-24 14:41:34 +02:00
Tim van der Meij
4daca805d6
Merge pull request #21323 from Snuffleupagus/integration-test-more-fromBase64
Use `Uint8Array.fromBase64` in the `test/integration/highlight_editor_spec.mjs` file
2026-05-24 14:37:27 +02:00
Tim van der Meij
d37e0b40a5
Merge pull request #21317 from Snuffleupagus/XfaLayerBuilder-render-shorten
Shorten the `XfaLayerBuilder.prototype.render` method
2026-05-24 14:36:33 +02:00
Tim van der Meij
46b16bd42e
Merge pull request #21322 from Snuffleupagus/fontFile-lookup-shorten
Shorten the `fontFile` lookup a tiny bit
2026-05-24 14:33:25 +02:00
Jonas Jenwald
59086fa582 Simplify how the character BBox is scaled in src/display/canvas_dependency_tracker.js
In many/most PDF documents every glyph will require that the character BBox has scaling/offset applied, which can be made a tiny bit more efficient. In particular:
 - Avoid creating one additional temporary Array for every glyph.
 - Simplify the helper function, since there's no skew-components.
2026-05-24 12:32:19 +02:00
Jonas Jenwald
057507f6ce Use Uint8Array.fromBase64 in the test/integration/highlight_editor_spec.mjs file 2026-05-24 10:56:51 +02:00
Jonas Jenwald
31c6561b91 Shorten the fontFile lookup a tiny bit
Rather than effectively duplicating code, we can use a loop instead.
2026-05-24 10:19:34 +02:00
Jonas Jenwald
05de3c8a88 Fix the XRefWrapper implementation, in the src/core/editor/pdf_editor.js file
When comparing this code with the full `XRef` class it doesn't seem to be entirely correctly implemented, since the `fetch` method is basically doing what the `fetchIfRef` method is intended to do.
2026-05-23 22:40:14 +02:00
calixteman
ea18e73de2
Merge pull request #20542 from calixteman/fontfile3
Use the CFF program directly for CID fonts wrapped in OpenType FontFile3
2026-05-23 21:39:13 +02:00
Jonas Jenwald
bd14524536 Shorten the XfaLayerBuilder.prototype.render method
Given that the "print" intent is handled separately, there's currently a little bit of unnecessary code duplication in this method.
2026-05-23 16:33:23 +02:00
Jonas Jenwald
fb9758303b Add support for Optional Content in the AnnotationLayer (issue 20433) 2026-05-23 12:33:56 +02:00
calixteman
25c7d9eaac
Merge pull request #21316 from mozilla/update-locales
l10n: Update locale files
2026-05-22 08:11:19 +02:00
github-actions[bot]
d8c08b980a l10n: Update locale files 2026-05-22 00:51:32 +00:00
calixteman
98e3a85a44
Merge pull request #21300 from calixteman/issue21298
Sanitize glyf composite cycles, OS/2 length and maxp version mismatches
2026-05-21 21:45:33 +02:00
Calixte Denizet
d6a2b91243 Sanitize glyf composite cycles, OS/2 length and maxp version mismatches
Prune the back-edge components from cyclic composite glyphs in
sanitizeGlyphLocations (leaving non-cyclic siblings intact), reject OS/2
tables whose length is too short for the declared version so a clean
table gets regenerated, and upgrade a version 0.5 maxp table to 1.0 for
TrueType fonts to silence OTS' "wrong maxp version for glyph data".

It fixes #21298.
2026-05-21 21:24:00 +02:00
Tim van der Meij
52d574c539
Merge pull request #21306 from calixteman/dnd_pdf_merging
Allow merging a PDF by dropping it onto the thumbnail viewer
2026-05-21 21:01:42 +02:00
Tim van der Meij
9b5cd3db64
Merge pull request #21304 from Snuffleupagus/PdfTextExtractor-tests
Add basic integration-tests for the `PdfTextExtractor` class
2026-05-21 20:27:53 +02:00
Tim van der Meij
93f01aa412
Merge pull request #21311 from Snuffleupagus/getPdfFilenameFromUrl-test-corrupt-relative
Extend unit-test coverage for the `getPdfFilenameFromUrl` helper function
2026-05-21 20:19:48 +02:00
Tim van der Meij
83c37357dc
Merge pull request #21302 from mozilla/dependabot/github_actions/github/codeql-action-4.35.4
Bump github/codeql-action from 4.35.3 to 4.35.4
2026-05-21 20:18:52 +02:00
Tim van der Meij
223170694c
Merge pull request #21301 from mozilla/dependabot/github_actions/actions/create-github-app-token-3.2.0
Bump actions/create-github-app-token from 3.1.1 to 3.2.0
2026-05-21 20:18:09 +02:00
Tim van der Meij
42db304268
Merge pull request #21305 from Snuffleupagus/integration-test-EventBus-on
Don't use "internal" `EventBus` methods in the integration-tests
2026-05-21 20:17:28 +02:00
calixteman
78cc2e3d38
Merge pull request #21309 from calixteman/issue21307
Fix 'Select all' after #20981
2026-05-21 18:11:56 +02:00
Calixte Denizet
0f90987927 Fix 'Select all' after #20981 2026-05-21 16:39:34 +02:00
Jonas Jenwald
74471651c7 Extend unit-test coverage for the getPdfFilenameFromUrl helper function
Currently there's a couple of branches, specifically for dealing with corrupt URLs, that are not covered by tests.
2026-05-21 14:03:32 +02:00
Calixte Denizet
d79043b3af Allow merging a PDF by dropping it onto the thumbnail viewer
Drop an external PDF anywhere in the views-manager thumbnail
sidebar to merge it at the cursor, rather than always inserting
after the current page via the "Add file" button.

The drop reuses the blue separator from page-move drag so the
user can see exactly where the inserted pages will land, and the
merge path is shared with the existing picker so post-merge
selection/current-page behavior stays consistent.
2026-05-20 18:06:55 +02:00
Jonas Jenwald
429b469ecb Add basic integration-tests for the PdfTextExtractor class 2026-05-20 17:26:50 +02:00
Jonas Jenwald
abe8b564a3 Don't use "internal" EventBus methods in the integration-tests
This way *guarantees* that any and all internal viewer state has been updated first, before any test-specific code runs.
2026-05-20 16:39:21 +02:00
calixteman
5a4d93a238
Merge pull request #20981 from wooorm/wooorm/hcm
Make text selection more visible (bug 1879559)
2026-05-20 15:49:01 +02:00
dependabot[bot]
16a9f1cafc
Bump github/codeql-action from 4.35.3 to 4.35.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.3 to 4.35.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e46ed2cbd0...68bde559de)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-19 23:20:52 +00:00
dependabot[bot]
5b99173043
Bump actions/create-github-app-token from 3.1.1 to 3.2.0
Bumps [actions/create-github-app-token](https://github.com/actions/create-github-app-token) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md)
- [Commits](1b10c78c78...bcd2ba4921)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-19 23:19:08 +00:00
Tim van der Meij
b13ec1fc3c
Merge pull request #21299 from timvandermeij/disable-gpu
Disable hardware acceleration for Chrome tests
2026-05-19 22:19:32 +02:00
Titus Wormer
957e004e38
Make text selection more visible (bug 1879559)
References <https://bugzilla.mozilla.org/show_bug.cgi?id=1879559>
(“In HCM, the text selection is barely visible”).

Continues work from @calixteman who had a partial patch.

This PR improves viewer text-selection highlighting by rendering
selection shapes in the draw layer.

* add selection overlay rendering in the draw layer
  * significant code relates to selections spanning multiple text
    layers/pages, and edges/end-of-content boundaries
* clear selection on rotate/scale/scroll/spread changes

My main question is: how should it appear?
I don’t have access to the Figma file linked on bugzilla.

In the CSS (`draw_layer-builder.css`) there are 3 blocks:

* default
* `@supports` for browsers supporting `backdrop-filter`
* `forced-colors` mode

So it’s possible to design for those (or more).
Personally, the `backdrop-filter: invert(1)` is the most contrast,
so perhaps it’s better to use something else as the default,
and to use `invert(1)` if high contrast mode is used (maybe with a
`prefers-contrast` media query instead)?
2026-05-19 21:10:12 +02:00
Tim van der Meij
60591388a8
Disable hardware acceleration for Chrome tests
This commit fixes the rendering issue that makes the "must update an
existing annotation" ink editor integration test permafail locally in
Chrome. Note that we already do this for Firefox tests, so this also
improves consistency between the two browsers.

Moreover, improve how we define Chrome options to (similar to their
Firefox counterparts) provide them in a single array, and document the
reasoning for why these options are being set more explicitly.

Fixes #21272.
2026-05-19 21:07:26 +02:00
Jonas Jenwald
f500cffd2e
Merge pull request #21292 from timvandermeij/presentation-mode
Introduce integration tests for the presentation mode functionality
2026-05-19 13:29:45 +02:00
Tim van der Meij
0d69cc4dcf
Introduce integration tests for the presentation mode functionality
This commit provides coverage for the happy flows of basic operations
like entering/exiting and changing pages.
2026-05-18 20:52:00 +02:00
Tim van der Meij
00af75905f
Merge pull request #21295 from Snuffleupagus/PDFDocumentProperties-more-tests
Add more integration-tests, with multi-page documents, for the `PDFDocumentProperties` dialog
2026-05-18 20:24:41 +02:00
Tim van der Meij
9ebee868c9
Merge pull request #21294 from Snuffleupagus/mv-scaleMinMax
Move the `Util.scaleMinMax` helper into `src/display/canvas_dependency_tracker.js`
2026-05-18 20:18:31 +02:00
calixteman
abb8e31408
Merge pull request #21261 from calixteman/bug1960363
Add a Content-Security-Policy to pdf.js' viewer.html (bug 1960363)
2026-05-18 18:24:38 +02:00
Jonas Jenwald
1e62f01773 Improve handling of corrupt pages in the PDFDocumentProperties dialog
If the active page is corrupt that currently results in the entire dialog being "blank", thus providing no information, which seems unfortunate and it's easy enough to only skip `pageSizeField` in that rare case.
2026-05-18 17:38:43 +02:00
Jonas Jenwald
e05b6d6f59 Add more integration-tests, with multi-page documents, for the PDFDocumentProperties dialog
Improve test coverage for multi-page documents, to ensure that:
 - Unnecessary re-parsing is avoided where possible.
 - Rotation, in the viewer, is handled correctly.
 - Different page sizes are handled correctly.
2026-05-18 14:24:05 +02:00
Jonas Jenwald
1e9e8fad7e Add helper functions for opening/closing the document properties dialog during testing
This reduces duplication in the various integration-tests.
2026-05-18 13:31:26 +02:00
Jonas Jenwald
d1da73931a Move the Util.scaleMinMax helper into src/display/canvas_dependency_tracker.js
This method is completely unused in the worker-thread, and it only has a single call-site in the main-thread.
By moving this helper into the `src/display/canvas_dependency_tracker.js` file, the size of the `gulp mozcentral` bundle is reduced by `1220` bytes.
2026-05-18 11:41:37 +02:00
calixteman
deb532334f
Merge pull request #21290 from calixteman/issue20633
Recover CFF private dict defaults zeroed by Ghostscript
2026-05-17 21:57:16 +02:00
calixteman
cd8a78c4e2
Recover CFF private dict defaults zeroed by Ghostscript
It fixes the issue #20633.
2026-05-17 20:51:35 +02:00
Tim van der Meij
2fb2bc13e0
Merge pull request #21275 from timvandermeij/integration-tests-optimize
Optimize runtime and memory usage of the integration tests
2026-05-17 20:41:43 +02:00
Tim van der Meij
f2bf57f444
Merge pull request #21288 from timvandermeij/unskip-test
Enable the `must check that an existing highlight is ignored on hovering` integration test on Windows
2026-05-17 20:19:42 +02:00
Tim van der Meij
b942714f45
Merge pull request #21291 from Snuffleupagus/PDFDocumentProperties-undef-contentLength-test
Add an integration-test for documents without `contentLength` available in the `PDFDocumentProperties` dialog
2026-05-17 18:31:19 +02:00
Jonas Jenwald
2cef900834 Add an integration-test for documents without contentLength available in the PDFDocumentProperties dialog 2026-05-17 16:55:48 +02:00
Tim van der Meij
e98b43879e
Merge pull request #21289 from Snuffleupagus/PDFDocumentProperties-approx-size-test
Add an integration-test for the page-name fuzzy matching in the `PDFDocumentProperties` dialog
2026-05-17 15:23:49 +02:00
Tim van der Meij
af65d7f930
Enable the must check that an existing highlight is ignored on hovering integration test on Windows
It looks like this test passes consistently again, most likely after a
combination of browser/Puppeteer/configuration updates and the completed
switch to the WebDriver BiDi protocol.

Fixes #20136.
2026-05-17 14:47:14 +02:00
Jonas Jenwald
afa9b6ef9b Add an integration-test for the page-name fuzzy matching in the PDFDocumentProperties dialog
Also, test that closing the dialog works correctly.
2026-05-17 14:40:09 +02:00
Tim van der Meij
f290da0e4b
Merge pull request #21287 from Snuffleupagus/rm-_normalizePagePoint
Remove the unused `Outline._normalizePagePoint` method
2026-05-17 12:47:57 +02:00
Jonas Jenwald
036436a0be Remove the unused Outline._normalizePagePoint method
This method was added in PR 19093, back in 2024, however it never actually appears to have been used.
2026-05-16 23:17:10 +02:00
Tim van der Meij
600a4bb1ee
Fix missing page closing for two viewer integration tests
This caused the tab to remain open after the tests ran, which meant
that a total of ~120 MB of memory was not being freed.
2026-05-16 19:30:42 +02:00
Tim van der Meij
c66f9f2497
Reduce the protocol delay for Chrome in the integration tests
Originally we introduced a small delay for Puppeteer operations in
Chrome to avoid intermittent failures where protocol calls were
happening too quickly in succession. However, since then a number of
improvements were made, both locally and upstream, that reduce the need
for this delay:

- the integration tests have been hardened to remove (potential) sources
  of intermittent failures in many places;
- the browsers and Puppeteer have been updated to improve performance
  and support for testing infrastructure;
- the conversion to WebDriver BiDi has been completed, which replaced
  the Chrome-specific CDP protocol with a formalized protocol that could
  provide more safety guarantees.

This commit therefore reduces the Chrome-specific delay from 5 to 3
milliseconds, which should nowadays be a better value to speed up the
Chrome tests and bring them closer to Firefox in terms of runtime.
2026-05-16 19:30:42 +02:00
Tim van der Meij
62b88aa56e
Use Puppeteer's ElementHandle.boundingBox() API in the integration tests
The custom solution for obtaining the bounding box of a given element
that we have now was necessary during the original introduction of the
integration tests because at the time the `ElementHandle.boundingBox()`
API in Puppeteer didn't work correctly in Chrome.

However, `getRect`, where this is used, is a hot utility function
because most tests call it multiple times, either directly or indirectly
via other utility functions, and it turns out that the approach we use
is slower than the native `ElementHandle.boundingBox()` API.

Fortunately, most likely after a combination of Chrome/Puppeteer updates
and the conversion to the formalized WebDriver BiDi protocol the custom
solution is no longer necessary because all tests pass without it too,
so this commit converts `getRect` to use `ElementHandle.boundingBox()`
instead to speed up the tests.
2026-05-16 19:30:34 +02:00
Tim van der Meij
65b8aec420
Merge pull request #21286 from Snuffleupagus/ColorConverters-tests
Add a couple of very basic `ColorConverters` unit-tests
2026-05-16 18:11:16 +02:00
Jonas Jenwald
7f2bb0e991 Add a couple of very basic ColorConverters unit-tests
These tests could obviously be improved/extended, but it's at least a start to ensure that `ColorConverters` is tested since it's used in both the annotation-layer and the scripting-implementation.
2026-05-16 17:17:41 +02:00
calixteman
91f2facce3
Use the CFF program directly for CID fonts wrapped in OpenType FontFile3
When a CIDFontType0 descendant has its program in a FontFile3 stream with
/Subtype /OpenType, the OTF wrapper sometimes lacks a usable cmap and the
CID→GID mapping only exists inside the embedded CFF itself. In that case
the OpenType-table path produces wrong glyphs, so route the font through
CFFFont and let it consume the inner CFF directly.

The file has been found in https://issues.chromium.org/issues/471404119.
2026-05-16 16:30:55 +02:00
Tim van der Meij
3450e95179
Merge pull request #21284 from Snuffleupagus/mv-SVG_NS
Move the `SVG_NS` definition into `src/shared/util.js`
2026-05-16 16:03:10 +02:00
Jonas Jenwald
7c5087cc16 Move the SVG_NS definition into src/shared/util.js
This constant is already defined in both the `src/core/` and `src/display/` folders, and in a few spots the same string was also inlined.
2026-05-16 15:17:04 +02:00
Jonas Jenwald
d27b9ab5fa
Merge pull request #21283 from Snuffleupagus/mv-getXfaPageViewport
[api-minor] Move the `getXfaPageViewport` helper into the `XfaLayer` class
2026-05-16 14:18:22 +02:00
Jonas Jenwald
e8f07d7ca3 [api-minor] Move the getXfaPageViewport helper into the XfaLayer class
This small helper function only exists to support printing of XFA documents, in the viewer, hence it seems like a good idea to (ever so slightly) reduce the official API surface a little bit.
2026-05-16 12:31:53 +02:00
Jonas Jenwald
eda97fe8fc Move the PageViewport class into its own file
This is necessary to prevent import cycles with the next patch.

It also shouldn't hurt to reduce the size of `src/display/display_utils.js` a little bit, since utility-files have a tendency to increase in size over time.
2026-05-16 12:31:40 +02:00
Tim van der Meij
26474b09cb
Merge pull request #21277 from calixteman/issue21276
Clear the full SMask scratch canvas in compose()
2026-05-15 20:04:11 +02:00
Tim van der Meij
77a2dc8532
Merge pull request #21281 from Snuffleupagus/rm-domMatrixToTransform
Remove the `Util.domMatrixToTransform` method
2026-05-15 20:03:19 +02:00
Jonas Jenwald
367f994d94 Remove the Util.domMatrixToTransform method
This method is unused in the worker-thread and has only *a single* call-site in the main-thread, which can be trivially replaced with the `getCurrentTransform` helper function.
2026-05-15 15:07:44 +02:00
Jonas Jenwald
69efba1ca2
Merge pull request #21279 from Snuffleupagus/mv-stringToPDFString
Move the `stringToPDFString` helper function to the worker-thread
2026-05-15 15:01:15 +02:00
Jonas Jenwald
e5330f06fa Move the stringToPDFString helper function into the src/core/string_utils.js file
Given that this function is only ever used during *parsing* of the PDF document, which happens in the worker-thread, this has always added (a little bit of) dead code in the built `pdf.mjs` file.
2026-05-15 12:10:30 +02:00
Jonas Jenwald
7a7e7049c1 Shorten the isAscii helper function a tiny bit 2026-05-15 11:56:33 +02:00
Jonas Jenwald
153cef615e Move a couple of src/core/ string helper functions into their own file
Given that the various utility-files naturally increase in size over time, it shouldn't hurt to shorten `src/core/core_utils.js` a little bit by moving a few of its string helper functions to their own file.
2026-05-15 11:49:54 +02:00
calixteman
d9491ffce3
Merge pull request #21278 from mozilla/update-locales
l10n: Update locale files
2026-05-15 09:34:50 +02:00
github-actions[bot]
0fab33c2e6 l10n: Update locale files 2026-05-15 00:47:51 +00:00
calixteman
5e18cfd8f0
Clear the full SMask scratch canvas in compose()
PR #21101 narrowed `compose()`'s `clearRect` from full canvas to the
caller-supplied dirty box. That leaves pixels outside the current
dirty box on the SMask scratch canvas between `compose()` calls;
subsequent draws into scratch are then source-over-blended on top of
those leftovers, so the output depends on the cumulative draw history
rather than just the current draw.
2026-05-14 23:02:14 +02:00
calixteman
cd4fd7563c
Merge pull request #21218 from RolandWArnold/fix/text-layer-hidden-canvas-layout-neutral
Ensure TextLayer hiddenCanvasElement is layout-neutral by default
2026-05-14 22:11:06 +02:00
Tim van der Meij
d9665c4e0f
Merge pull request #21274 from calixteman/issue21273
Enable Codecov flag carryforward for accurate coverage badge
2026-05-14 18:26:11 +02:00
calixteman
195bfdcfbd
Enable Codecov flag carryforward for accurate coverage badge
It fixes #21273.
2026-05-14 18:13:11 +02:00
Tim van der Meij
b708f59d04
Merge pull request #21271 from Snuffleupagus/unittest-BrotliDecode
Add a simple API unit-test for /BrotliDecode
2026-05-14 16:05:34 +02:00
Jonas Jenwald
949497a3c4 Add a simple API unit-test for /BrotliDecode
This is a new feature in PDF documents, hence it shouldn't hurt to complement the existing ref-test with a simple unit-test as well.
This should also improve test coverage for the `external/` folder, which can't hurt since the other external decoders are already fairly well covered.
2026-05-14 15:44:42 +02:00
Roland Arnold
16d82e094f fix: inline styles for hidden helper elements
Set layout-neutral styles at the creation sites for the hidden TextLayer
canvas and PDFViewer copy element rather than relying on the shared
web/pdf_viewer.css rule.

This keeps the helper elements invisible and out of layout when viewer CSS
selectors are scoped or omitted, and removes the obsolete hiddenCanvasElement
class and shared CSS rule.
2026-05-14 14:28:41 +01:00
Tim van der Meij
7ade637449
Merge pull request #21268 from calixteman/lint_chmod
Add a lint-chmod task to catch stray executable bits
2026-05-14 15:16:08 +02:00
Calixte Denizet
f8f497a03a
Add a lint-chmod task to catch stray executable bits 2026-05-14 13:55:14 +02:00
Tim van der Meij
056837dace
Merge pull request #21173 from timvandermeij/github-actions-integration-tests-coverage
Collect coverage information for the integration tests
2026-05-14 13:40:05 +02:00
Tim van der Meij
71e9eb25f6
Merge pull request #21269 from Snuffleupagus/WORKER_THREAD-define
Avoid bundling DOM-related code in the built `pdf.worker.mjs` file
2026-05-14 13:02:08 +02:00
Calixte Denizet
94de952b65
Add a Content-Security-Policy to pdf.js' viewer.html (bug 1960363) 2026-05-14 12:50:07 +02:00
Tim van der Meij
26dc195a65
Collect coverage information for the integration tests
Note that for the integration tests the coverage information ends up
being processed in the Node.js context where `window` is not available,
so we use `globalThis` instead for the function that merges individual
test's coverage information into the global object because that is
available in all contexts we support. For clarity we also rename said
function since we're not exclusively dealing with `window` nor worker
data anymore.
2026-05-14 12:34:12 +02:00
Jonas Jenwald
204f9203bd Avoid bundling DOM-related code in the built pdf.worker.mjs file
Currently the `isCanvasFilterSupported`/`isAlphaColorInputSupported` getters, on the `FeatureTest` class, contains code that cannot run in the worker-thread since it relies on the DOM being available.
To avoid that a new DEFINE is added, in `gulpfile.mjs`, to allow skipping this sort of dead code in the built `pdf.worker.mjs` file.
2026-05-14 12:21:36 +02:00
calixteman
bf9ae7622f
Merge pull request #21267 from timvandermeij/test-pdf-executable-bit
Remove the executable bit from test PDF files
2026-05-13 09:29:02 +02:00
calixteman
7f151c777b
Merge pull request #21262 from calixteman/issue18032
Fix nested non-isolated groups in knockout rendering
2026-05-12 22:37:31 +02:00
calixteman
0e0f7b7696
Merge pull request #21263 from Snuffleupagus/editor-_l10nAlert
[Editor] Avoid "generating" the l10n-ids used for the `a11yAlert`
2026-05-12 22:07:54 +02:00
Calixte Denizet
0e335d53ee Fix nested non-isolated groups in knockout rendering
It fixes #18032.

Only use the special inner-backdrop compositing path for nested non-isolated groups that actually need isolation.
This preserves the parent/page backdrop for simple nested groups inside knockout groups, preventing later group
compositing from erasing existing backdrop content.
2026-05-12 22:00:44 +02:00
Tim van der Meij
41e47c8b6f
Remove the executable bit from test PDF files
Test PDF files should never be executable because we only read their
contents, so this commit makes sure that all test PDFs have the same
permissions, namely 0644 (read-only for all groups, and writable for the
owner), to limit their permissions for a least-privilege approach.
2026-05-12 20:59:07 +02:00
Tim van der Meij
10abe660e5
Merge pull request #21264 from calixteman/simplify_no_filter
Use FeatureTest.isCanvasFilterSupported in _bakeSMaskCanvas
2026-05-12 20:37:16 +02:00
Tim van der Meij
dc7b6c31ac
Merge pull request #21265 from mozilla/dependabot/github_actions/github/codeql-action-4.35.3
Bump github/codeql-action from 4.35.2 to 4.35.3
2026-05-12 20:28:33 +02:00
Tim van der Meij
a5027bf5e2
Merge pull request #21256 from timvandermeij/updates
Update dependencies to the most recent versions
2026-05-12 20:27:16 +02:00
dependabot[bot]
130aff4257
Bump github/codeql-action from 4.35.2 to 4.35.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.2 to 4.35.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](95e58e9a2c...e46ed2cbd0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-12 18:17:58 +00:00
Calixte Denizet
1dac67ff54 Use FeatureTest.isCanvasFilterSupported in _bakeSMaskCanvas 2026-05-12 20:02:06 +02:00
Jonas Jenwald
4072d3f835 [Editor] Avoid "generating" the l10n-ids used for the a11yAlert
In the `DrawingEditor.prototype.#createDrawOutlines` method the l10n-id was being "generated", which is bad for maintainability since searching for l10n-id becomes more difficult and the `gulp check_l10n` script actually warns about this.

Hence, similar to e.g. the resizer localization, let's define the `a11yAlert` l10n-ids *once* and provide shorthands for accessing them.
2026-05-12 16:41:53 +02:00
calixteman
0c66063cd4
Merge pull request #21242 from calixteman/knockout
Render knockout transparency groups
2026-05-12 12:02:10 +02:00
Jonas Jenwald
5bc5791a86
Merge pull request #21257 from Snuffleupagus/deepCompare-Refs
Update the `deepCompare` helper function to handle `Ref`s and `Name`s correctly
2026-05-12 11:53:02 +02:00
calixteman
d1e9194e1f
Render knockout transparency groups
In a knockout (KO) group each painting operator ("element") composites against
the group's initial backdrop instead of accumulating onto prior elements
of the same group. The backend renders each element to a per-group pooled
temp canvas (keyed off `#groupStackMeta`), builds a binary alpha mask via
a new `feFuncA` filter (`addKnockoutFilter`), `destination-out`s the
group canvas through that mask, restores the initial backdrop into the
cleared footprint for non-isolated groups (cropped to the same mask so
sparse groups don't bleed the whole rectangle), and finally paints the
element on top with the parent's blend mode. Path / clip / transform ops
are mirrored back to the group canvas via `mirrorContextOperations` so
graphics state stays in sync between elements; only the raster pixels
land on the temp canvas.

The temp canvas is forced to source-over for the element raster (`multiply`
on a transparent backdrop would zero the color) and the original GCO is
restored before `copyCtxState` writes back, so the parent's blend mode
survives for the final composite.

Also handled:
  - Nested KO groups (the level is incremented for KO, reset to 0 for
    non-KO subgroups so an ancestor KO doesn't leak in).
  - Non-isolated non-KO subgroups inside a KO parent (`hasInnerBackdrop`
    path: blend the elements against the subgroup's running backdrop for
    color, mask with the elements-only canvas).
  - Soft masks installed inside a KO element (`applySMaskInPlace` in
    `compose`, which runs the SMask destination-in directly on the temp
    canvas; the existing blit-to-suspended step is gated by `if (!ctx)`).
  - Type-3 text, shading fills, image-mask groups, inline images and the
    solid-color mask path: each is wrapped in `#begin/#endKnockoutElement`.
  - `endDrawing` cleanup so cancelled rendering doesn't leak pooled
    canvases or stale knockout state.
2026-05-11 23:08:06 +02:00
Tim van der Meij
4da7a9aa29
Upgrade typescript to version 6.0.3
This is a major version bump containing two breaking changes for us:

- the `baseUrl` option is removed;
- the `moduleResolution` option doesn't support `node10` (or the `node`
  alias) anymore.

The migration guide at https://github.com/microsoft/TypeScript/issues/62508
indicates that we can remove `baseUrl` and change `moduleResolution` to
`bundler` (the latter is consistent with what other projects do that are
linked to the issue, and more details on that configuration option can
be found at https://www.typescriptlang.org/tsconfig/#moduleResolution).

Note that this is enough to get `npx gulp typestest` green and that is
all validation we can do on our side, so as usual if any follow-up fixes
for types are necessary we rely on the community to provide patches and
extend the types test where possible to improve validation.
2026-05-11 21:05:11 +02:00
Tim van der Meij
c67306b435
Upgrade postcss-discard-comments to version 8.0.0
This is a major version bump, but the changelog at
https://github.com/cssnano/cssnano/blob/master/packages/postcss-discard-comments/CHANGELOG.md
doesn't indicate any breaking changes that should impact us.
2026-05-11 21:05:11 +02:00
Tim van der Meij
dd05ebad71
Upgrade @napi-rs/canvas to version 1.0.0
This is a major version bump, but the changelog at
https://github.com/Brooooooklyn/canvas/releases/tag/v1.0.0
doesn't indicate any breaking changes that should impact us.
2026-05-11 21:05:11 +02:00
Tim van der Meij
25a9196d9c
Update dependencies to the most recent versions 2026-05-11 21:05:11 +02:00
Tim van der Meij
6bbcb46db8
Merge pull request #21258 from Snuffleupagus/mv-getModificationDate
Move the `getModificationDate` helper function into `src/core/core_utils.js`
2026-05-11 20:20:05 +02:00
Jonas Jenwald
aecb571ea6 Move the getModificationDate helper function into src/core/core_utils.js
Given that this function is only ever used in `src/core/` code, let's avoid a little bit of dead code in the *built* `pdf.mjs` file.

Also, place the `AnnotationPrefix` and `AnnotationEditorPrefix` constants together in `src/shared/util.js` since that should aid readability.
2026-05-11 14:13:23 +02:00
Jonas Jenwald
326df1f711 Update the deepCompare helper function to handle Refs and Names correctly
Note that `Ref`s and `Name`s are cached globally[1], since that helps reduce object creation (a lot) during parsing.
That cache will be cleared after a period of inactivity in the viewer[2], which is why those primitives cannot *safely* be compared with just `===`/`!==` and also (partially) why abstractions such as `RefSet`/`RefSetCache` are necessary.

Currently `deepCompare` doesn't handle `Ref`s and `Name`s correctly, which may lead to future *intermittent* bugs in any code using the `deepCompare` helper function.

---

[1] This applies to `Cmd` as well, however that doesn't matter in the context of this patch.

[2] Currently, and for more than a decade, set to 30 seconds.
2026-05-11 13:18:54 +02:00
Tim van der Meij
702d60aa18
Merge pull request #21230 from calixteman/avoid_cycles
Avoid cycles when getting operator list in patterns
2026-05-10 18:15:01 +02:00
Tim van der Meij
3b58a339c8
Merge pull request #21213 from saripovdenis/perf-name-tree-getall-queue-index
perf: Avoid multi-second getDestinations stalls for PDFs with many named destinations
2026-05-10 18:13:12 +02:00
Jonas Jenwald
1079535a1e
Merge pull request #21249 from Snuffleupagus/open-filename-unconditional
Support providing a `filename` unconditionally, when passing binary data to `PDFViewerApplication.open`
2026-05-10 15:48:43 +02:00
Tim van der Meij
02c9051b64
Merge pull request #21245 from Snuffleupagus/getDocument-only-DocumentInitParameters
[api-major] Remove support for calling `getDocument` without  a parameter object, and remove the `PDFDocumentProxy.prototype.destroy` method
2026-05-10 14:30:15 +02:00
Tim van der Meij
559e2f2006
Merge pull request #21236 from calixteman/pixel_fallback_smask
Fall back to pixel-buffer SMask filtering when ctx.filter is unavailable
2026-05-10 14:27:52 +02:00
Tim van der Meij
47e32709b3
Merge pull request #21246 from Snuffleupagus/crypto_spec-fromHex
Use `Uint8Array.fromHex` in `test/unit/crypto_spec.js`
2026-05-10 14:12:33 +02:00
Tim van der Meij
33a6f3e206
Merge pull request #21238 from Snuffleupagus/PDFDataRangeTransport-unittest-faster
Make the `PDFDataRangeTransport` streaming unit-tests faster
2026-05-10 14:11:09 +02:00
Tim van der Meij
e8a051cee5
Merge pull request #21248 from mozilla/dependabot/npm_and_yarn/babel/plugin-transform-modules-systemjs-7.29.4
Bump @babel/plugin-transform-modules-systemjs from 7.29.0 to 7.29.4
2026-05-10 14:07:18 +02:00
Tim van der Meij
e511c88f11
Merge pull request #21244 from mozilla/dependabot/npm_and_yarn/fast-uri-3.1.2
Bump fast-uri from 3.1.0 to 3.1.2
2026-05-10 14:06:27 +02:00
Tim van der Meij
58ee4cd18d
Merge pull request #21243 from mozilla/dependabot/npm_and_yarn/fast-xml-builder-1.2.0
Bump fast-xml-builder from 1.1.5 to 1.2.0
2026-05-10 14:06:00 +02:00
Jonas Jenwald
0763c69b6a Support providing a filename unconditionally, when passing binary data to PDFViewerApplication.open
Previously this was only supported in Firefox, however when merging PDFs the `PDFViewerApplication.onSaveAndLoad` method will provide a `filename` unconditionally.
2026-05-10 13:51:33 +02:00
dependabot[bot]
f6e69b8a20
Bump @babel/plugin-transform-modules-systemjs from 7.29.0 to 7.29.4
Bumps [@babel/plugin-transform-modules-systemjs](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-modules-systemjs) from 7.29.0 to 7.29.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.29.4/packages/babel-plugin-transform-modules-systemjs)

---
updated-dependencies:
- dependency-name: "@babel/plugin-transform-modules-systemjs"
  dependency-version: 7.29.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 17:40:37 +00:00
Jonas Jenwald
eb184851a8 Use Uint8Array.fromHex in test/unit/crypto_spec.js
This replaces the old `hex2binary` helper function with the native `Uint8Array.fromHex` method.
2026-05-09 17:17:50 +02:00
Jonas Jenwald
43ce1bb491 [api-major] Remove the PDFDocumentProxy.prototype.destroy method
This is a left-over from very old code, which pre-dates the introduction of the `PDFDocumentLoadingTask` and it's nothing more than an alias for its `destroy` method.
Given that `PDFDocumentProxy` already provides a way to access the underlying `PDFDocumentLoadingTask` instance, it shouldn't be necessary to have an alias for one of its methods.

*Please note:* For any existing code relying on the removed method, updating it should be as simple as replacing `pdfDocument.destroy()` with `pdfDocument.loadingTask.destroy()`.

---

[1] If the `PDFDocumentProxy` class was added today, there's no chance that it'd include a `destroy` method.
2026-05-09 13:20:39 +02:00
Jonas Jenwald
2e7a2215e3 [api-major] Remove support for calling getDocument without a parameter object
This is a left-over from very old code[1], before there were a lot of `getDocument` options and when most of the library configuration was done via the (since removed) `PDFJS` global.
Given all the functionality added through the years, which require configuration[2], in practice it's now unlikely that calling `getDocument` without additional options will work except for the most trivial PDFs.

---

[1] If the `getDocument` function was added today, there's no chance that it'd support anything other than a parameter object.

[2] Note things such as CMaps, standard fonts, wasm-based image decoders, and ICC-based colour spaces.
2026-05-09 13:00:27 +02:00
dependabot[bot]
b5af8151f6
Bump fast-uri from 3.1.0 to 3.1.2
Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.0 to 3.1.2.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](https://github.com/fastify/fast-uri/compare/v3.1.0...v3.1.2)

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 00:28:57 +00:00
dependabot[bot]
e94f9a9797
Bump fast-xml-builder from 1.1.5 to 1.2.0
Bumps [fast-xml-builder](https://github.com/NaturalIntelligence/fast-xml-builder) from 1.1.5 to 1.2.0.
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-builder/blob/main/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-builder/compare/v1.1.5...v1.2.0)

---
updated-dependencies:
- dependency-name: fast-xml-builder
  dependency-version: 1.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-08 18:32:54 +00:00
Jonas Jenwald
15921243d4 Make the PDFDataRangeTransport streaming unit-tests faster
The delay between chunks when testing streaming is necessary to avoid the entire PDF document arriving all at once, since that would render those unit-tests somewhat pointless.
However, the delay is unnecessarily large which causes these unit-tests to be slower than necessary.

Also, update the range unit-tests to check the expected number of fetches *exactly* since those values are not supposed to vary.
2026-05-08 12:44:32 +02:00
calixteman
e86e9d9465
Merge pull request #21237 from mozilla/update-locales
l10n: Update locale files
2026-05-08 08:39:19 +02:00
github-actions[bot]
80dd1b3ecc l10n: Update locale files 2026-05-08 00:45:17 +00:00
Calixte Denizet
29fcf0aa76
Avoid cycles when getting operator list in patterns 2026-05-07 22:30:51 +02:00
calixteman
a5e9940d14
Merge pull request #21231 from calixteman/simplify_extract
Simplify '#getFilteredPageIndices' and '#resolveInsertAfterIndices'
2026-05-07 22:28:48 +02:00
calixteman
b8232710c8
Fall back to pixel-buffer SMask filtering when ctx.filter is unavailable
For now OffscreenCanvas in worker threads doesn't support ctx.filter,
so we need to fall back to a more expensive pixel-buffer SMask filtering in that case.
As a side effect, this also allows to support correctly smask in Safari.
2026-05-07 22:27:04 +02:00
Calixte Denizet
b39440b6e0
Simplify '#getFilteredPageIndices' and '#resolveInsertAfterIndices' 2026-05-07 21:41:37 +02:00
Tim van der Meij
a328294713
Merge pull request #21235 from calixteman/bug2033095
Improve soft mask composition performance (bug 2033095)
2026-05-07 21:35:09 +02:00
Tim van der Meij
e81507c167
Merge pull request #21228 from calixteman/bug2027682
Place new annotations on the correct page when extracting pages (bug 2027682)
2026-05-07 21:12:15 +02:00
Tim van der Meij
9953501a0d
Merge pull request #21223 from calixteman/bug2034827
Make sure the focus moves on the first page of the added pdf after a merge (bug 2034827)
2026-05-07 21:04:29 +02:00
Tim van der Meij
4b4666e302
Merge pull request #21232 from mozilla/dependabot/npm_and_yarn/ip-address-10.2.0
Bump ip-address from 10.1.0 to 10.2.0
2026-05-07 20:54:27 +02:00
Calixte Denizet
1658a792ce Improve soft mask composition performance (bug 2033095)
Prepare reusable soft-mask canvases for filtered and backdrop-dependent masks,
and use a faster destination-in composition path where possible.
Handle Alpha SMask /BC correctly, preserve OOB alpha behavior, and mirror canvas path
operations needed while rendering inside soft-mask mode (mirrored clip was buggy).

Add reftest PDFs covering Alpha masks, transfer functions, backdrop/OOB
alpha, and the optimized composition paths.
2026-05-07 19:06:49 +02:00
dependabot[bot]
175c184956
Bump ip-address from 10.1.0 to 10.2.0
Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.1.0 to 10.2.0.
- [Commits](https://github.com/beaugunderson/ip-address/commits)

---
updated-dependencies:
- dependency-name: ip-address
  dependency-version: 10.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-07 00:37:45 +00:00
Calixte Denizet
4c62a49483
Place new annotations on the correct page when extracting pages (bug 2027682) 2026-05-06 18:44:02 +02:00
Jonas Jenwald
cce61cb7f4
Merge pull request #21229 from Snuffleupagus/WasmImage-private
Tweak the `WasmImage` implementation a little bit (PR 21225 follow-up)
2026-05-06 18:27:44 +02:00
Jonas Jenwald
3f6a2feef6 Tweak the WasmImage implementation a little bit (PR 21225 follow-up)
This fixes two things that I overlooked in PR 21225, more specifically:

 - Use proper, rather than semi, private class fields in `WasmImage`.

 - Make tracking of `WasmImage` instances optional, to avoid keeping data alive permanently in the `IMAGE_DECODERS` build.
2026-05-06 17:52:35 +02:00
Calixte Denizet
a6cb30a9e5
Make sure the focus moves on the first page of the added pdf after a merge (bug 2034827) 2026-05-06 13:42:49 +02:00
saripovdenis
473f9b4592 Avoid quadratic traversal in NameOrNumberTree.getAll
Using Array.prototype.shift() to drain the traversal queue makes each
visited node move the remaining queued entries. For large name/number
trees this can make getAll() spend quadratic time in queue management.

Iterate over the queue with for...of instead. Children pushed while
iterating are still visited, and the queue no longer needs repeated
front removals.
2026-05-06 09:51:57 +08:00
Jonas Jenwald
cd1b5f57c7
Merge pull request #21226 from Snuffleupagus/unittestcli-coverage-external
Include the `external/` folder in the coverage report for `gulp unittestcli`
2026-05-05 22:52:39 +02:00
Jonas Jenwald
d33d9fc61d Include the external/ folder in the coverage report for gulp unittestcli
Given that the (browser) `gulp unittest` coverage includes the `external/` folder, it seems reasonable to include that folder in the coverage report when running unit-tests in Node.js as well.
2026-05-05 22:12:18 +02:00
Tim van der Meij
ac51bdf745
Merge pull request #21222 from Snuffleupagus/getPdfFilenameFromUrl-tweaks
A couple of small tweaks of the `getPdfFilenameFromUrl` helper
2026-05-05 20:27:55 +02:00
Tim van der Meij
d36e61d020
Merge pull request #21224 from Snuffleupagus/Node-26
Run unit-tests in Node.js version 26
2026-05-05 20:20:48 +02:00
Tim van der Meij
a1d9f13278
Merge pull request #21219 from calixteman/issue21217
Clear the text layer container when cancelling rendering
2026-05-05 20:19:13 +02:00
Jonas Jenwald
5967f720b9
Merge pull request #21225 from Snuffleupagus/WasmImage
Add an abstract `WasmImage` class, that `JBig2CCITTFaxImage` and `JpxImage` inherit from
2026-05-05 20:10:27 +02:00
Jonas Jenwald
6ff0f8690f Add an abstract WasmImage class, that JBig2CCITTFaxImage and JpxImage inherit from
Given that these classes are, with the exception of their `decode` methods, virtually identical this helps reduce code duplication and simplifies maintenance.

These changes reduce the size of the `gulp mozcentral` build-target by `1292` bytes, which obviously isn't a lot but still cannot hurt.
2026-05-05 17:25:18 +02:00
Jonas Jenwald
9efb4aa4aa Run unit-tests in Node.js version 26
This was just released, see https://nodejs.org/en/blog/release/v26.0.0, hence it seems like a good idea to start running unit-tests in that version.

Also, stop running the unit-tests in Node.js version 25 since it'll soon reach EOL anyway and testing in three separate Node.js versions ought to suffice.
2026-05-05 17:09:19 +02:00
Jonas Jenwald
e8d3d19f67
Merge pull request #21220 from Snuffleupagus/DataBuilder
Replace `TrueTypeTableBuilder` and `CompilerOutput` with a single class
2026-05-05 13:07:31 +02:00
Jonas Jenwald
8fc56772e8 A couple of small tweaks of the getPdfFilenameFromUrl helper
- Shorten the `getURL` function slightly, by re-factoring the try-catch blocks.
 - Change how the `decode` function looks for a decoded ".pdf" name, to skip the regular expression matching when it's not needed and to allow re-using the already defined `pdfRegex`.
2026-05-05 12:16:57 +02:00
Jonas Jenwald
ac6a9230d1 Replace TrueTypeTableBuilder and CompilerOutput with a single class
Given that both of these classes are so similar, let's replace them with a single `DataBuilder` class instead to reduce unnecessary code-duplication.
2026-05-04 15:01:53 +02:00
Calixte Denizet
82f55e7dd9
Clear the text layer container when cancelling rendering
It fixes #21217.
2026-05-04 14:36:12 +02:00
Tim van der Meij
a55cec4a0f
Merge pull request #21216 from Snuffleupagus/CFFCharset-rm-raw
Remove the unused `raw` field from the `CFFCharset` class
2026-05-03 19:31:04 +02:00
Jonas Jenwald
53fd89682c Remove the unused raw field from the CFFCharset class
This was necessary before charset compilation was implemented, however that's been supported for many years and this is just dead code now.
 - PR 9340, back in 2018, stopped using the `raw` field.
 - PR 10591, back in 2019, implemented proper charset compilation.
2026-05-03 18:51:24 +02:00
Tim van der Meij
f54f4b606d
Merge pull request #21215 from Snuffleupagus/compileFDSelect-TypedArray-set
Replace a loop with `TypedArray.prototype.set()` in the `compileFDSelect` method
2026-05-03 18:30:18 +02:00
Jonas Jenwald
027671e6dc Replace a loop with TypedArray.prototype.set() in the compileFDSelect method
Given that the `fdSelect.fdSelect` data is a regular Array, this code can simplified a tiny bit.
2026-05-03 16:32:48 +02:00
Tim van der Meij
c196fa8196
Merge pull request #21214 from Snuffleupagus/CFFFont-improvements
Remove the `CompilerOutput.prototype.finalData` getter, and a few other font improvements (PR 21053 follow-up)
2026-05-03 16:07:22 +02:00
Jonas Jenwald
e5e82b9617 Don't create a DataView for the "CFF " TrueType table in readTableEntry
Given that the "CFF " table may be replaced completely, during font-parsing, it shouldn't make sense to read and/or modify it piecewise.
2026-05-03 13:17:23 +02:00
Jonas Jenwald
b65eedc636 Set the correct data if compilation fails in the CFFFont constructor
The `CFFFont.prototype.data` should contain a `Uint8Array`, however if compilation failed it was being set to a `Stream` instance which will thus fail elsewhere in the font-code.

*Please note:* This was found by code inspection, since I don't have a PDF document that's fixed by this change.
2026-05-03 13:17:18 +02:00
Jonas Jenwald
521f4dc554 Remove the CompilerOutput.prototype.finalData getter (PR 21053 follow-up)
Return the data as-is from the `CFFCompiler.prototype.compile` method, rather than making a copy of it first.
The reason that it was implemented this way in PR 21053 was to avoid keeping a potentially large `ArrayBuffer` alive, see https://github.com/mozilla/pdf.js/pull/21053#discussion_r3045402988

Having traced all the call-sites in the font-code that directly or indirectly invoke that code, I've now managed to conclude that the compiled CFF-data is never stored on the `Font` instance and using the data as-is thus shouldn't increase permanent memory usage.
2026-05-03 13:13:50 +02:00
Tim van der Meij
6d5e8696c4
Merge pull request #21211 from Snuffleupagus/JpxStream-rm-params
Don't provide unused /DecodeParms when initializing `JpxStream`
2026-05-02 14:11:36 +02:00
Tim van der Meij
ccf9e03e18
Merge pull request #21210 from timvandermeij/unit-test-optimize-find
Optimize runtime of the find controller unit tests
2026-05-02 14:10:38 +02:00
Jonas Jenwald
a8715f6f96 Don't provide unused /DecodeParms when initializing JpxStream 2026-05-02 12:20:28 +02:00
Tim van der Meij
038ca33f8e
Optimize runtime of the find controller unit tests
The find controller tests consistently show up in the list of slowest
tests reported by Jasmine. Profiling shows that most of the time is
spent waiting for the find results to arrive, even though the find
command itself is quite fast.

It turns out that the slowdown occurs between receiving the `find` event
and actually triggering the search. The find controller has a hardcoded
delay of 250 milliseconds built in, which was introduced for viewer
performance many years ago because otherwise every keystroke would
trigger a search even though the user's query was not complete yet.

For the unit tests we don't need this delay because, contrary to the
viewer use case, we don't have to account for user interaction and
instead dispatch complete `find` events on the event bus ourselves.
However, since the unit tests were introduced well over a year after
the delay was introduced, due to an oversight it was never made
configurable so we could skip it for the unit tests.

This commit fixes the issue, which locally results in the runtime of
`npx gulp unittest --noChrome` dropping from 39.991 seconds before this
patch to 29.116 seconds afterwards, which is a 27% speedup.
2026-05-01 19:31:13 +02:00
Jonas Jenwald
091b172a22
Merge pull request #21209 from Snuffleupagus/version-6.0
Bump library version to `6.0`
2026-05-01 13:26:22 +02:00
Jonas Jenwald
2c445a2bc1 Bump library version to 6.0
See commit e6e06cf6b5307fe39e0de69c6c884f816b0cb21b
2026-05-01 13:12:29 +02:00
Jonas Jenwald
8142937ac4
Merge pull request #20961 from calixteman/use_image_decoder_chrome
[api-minor] Use the ImageDecoder by default on Chrome
2026-05-01 13:09:43 +02:00
Tim van der Meij
e6e06cf6b5
Merge pull request #21152 from Snuffleupagus/update-supported
[api-major] Update the minimum supported browsers, and remove no longer needed polyfills
2026-05-01 12:07:45 +02:00
Tim van der Meij
330ab4d066
Merge pull request #21208 from mozilla/update-locales
l10n: Update locale files
2026-05-01 12:04:06 +02:00
github-actions[bot]
35429af43e l10n: Update locale files 2026-05-01 00:48:41 +00:00
Jonas Jenwald
270b68feb9 [api-major] Update the minimum supported browsers, and remove no longer needed polyfills
By removing support for older browsers it's possible to simplify both the code and the build-scripts, in addition to removing manually implemented polyfills.
Using the PDF.js library/viewer will now require native support for the following features:
 - The `AbortSignal.any()` static method, see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static#browser_compatibility
 - The `:dir()` CSS pseudo-class, see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:dir#browser_compatibility
 - The `light-dark()` CSS function, see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark#browser_compatibility
 - The CSS `&` nesting selector, see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Nesting_selector#browser_compatibility

This patch updates the minimum supported browsers as follows:
 - Google Chrome 125, which was released on 2024-05-15; see https://chromereleases.googleblog.com/2024/05/stable-channel-update-for-desktop_15.html
 - Safari 18, which was released on 2024-09-16; see https://developer.apple.com/documentation/safari-release-notes/safari-18-release-notes
   *Note:* This version is the first with experimental support for the `CanvasRenderingContext2D.filter` property, which is a long-standing missing feature in Safari, however it must be *manually enabled*; see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter#browser_compatibility

Note that nowadays we usually try, where feasible and possible, to support browsers that are about two years old. By limiting support to only "recent" browsers we reduce the risk of holding back improvements of the *built-in* Firefox PDF Viewer, and also (significantly) reduce the maintenance/support burden for the PDF.js contributors.

*Please note:* As always, the minimum supported browser version assumes that a `legacy`-build of the PDF.js library is being used; see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
2026-04-30 20:32:08 +02:00
calixteman
7ebf3a4d7c
Merge pull request #21196 from calixteman/bug2035530
Fix free highlight on pages without images (bug 2035530)
2026-04-30 19:34:02 +02:00
calixteman
4d91026178
Merge pull request #21207 from Snuffleupagus/unittest-11878-reduced
Use a reduced test-case for the "caches image resources at the document/page level as expected (issue 11878)" unit-test
2026-04-30 19:33:12 +02:00
Jonas Jenwald
3eef724d15 Use a reduced test-case for the "caches image resources at the document/page level as expected (issue 11878)" unit-test 2026-04-30 18:47:42 +02:00
Tim van der Meij
468d38e17c
Merge pull request #21206 from Snuffleupagus/unittest-11878-hash
Improve performance of the "caches image resources at the document/page level as expected (issue 11878)" unit-test
2026-04-30 16:19:59 +02:00
Jonas Jenwald
c5296986fa Improve performance of the "caches image resources at the document/page level as expected (issue 11878)" unit-test
Compare `Uint32Array`s of the image-data, since that's more efficient than comparing the `Uint8ClampedArray`s directly.
2026-04-30 16:09:56 +02:00
calixteman
1ebaa03b25
Merge pull request #21192 from calixteman/colored_logs
Add some colors in the logs in order to easily see failures and add a summary of the failures at the end
2026-04-30 14:50:20 +02:00
Tim van der Meij
87e5241ed3
Merge pull request #21203 from timvandermeij/unit-test-obsolete-pdfbug
Remove obsolete `pdfBug: true` flag in the image caching unit test
2026-04-30 14:28:39 +02:00
Tim van der Meij
55e0f7e97f
Remove obsolete pdfBug: true flag in the image caching unit test
In a previous commit the time-based checks, which were based on
statistics provided by the `pdfBug: true` flag, got replaced by
test-only property checks that don't use said statistics anymore.

Fixes b01eeaf8.
2026-04-30 14:07:39 +02:00
Calixte Denizet
46fd67a191
Add some colors in the logs in order to easily see failures and add a summary of the failures at the end 2026-04-30 14:00:54 +02:00
Tim van der Meij
8f170307ed
Merge pull request #21195 from timvandermeij/unit-test-optimizations
Optimize memory usage in the unit tests
2026-04-30 12:59:58 +02:00
Jonas Jenwald
adf07ea51c
Merge pull request #21200 from Snuffleupagus/Intersector-grid-push
Shorten how intersectors are added to the grid in the `Intersector` constructor
2026-04-30 12:56:38 +02:00
Tim van der Meij
232506f4e8
Optimize memory usage in the unit tests
This commit fixes a number of missing cleanup steps in the unit tests
that kept state alive for longer than necessary:

- the loading tasks were not all being destroyed;
- the find controllers were not being reset;
- the state set in `beforeAll`/`beforeEach` was not all being nulled in
  the correspoding `afterAll`/`afterEach` blocks.

Combined this resulted in a steady increase in memory usage of the test
process as the tests ran, climbing up to ~1.5 GB. After this patch the
memory usage remains stable at ~800 MB.
2026-04-30 12:35:59 +02:00
Tim van der Meij
b71be8a501
Merge pull request #21198 from Snuffleupagus/DecryptStream-nextChunk
Simplify the `nextChunk` handling in the `DecryptStream` class
2026-04-30 12:23:18 +02:00
Jonas Jenwald
4a5c455c0b Shorten how intersectors are added to the grid in the Intersector constructor
Thanks to modern JavaScript features this code can be simplified a tiny bit.
2026-04-30 12:06:08 +02:00
Jonas Jenwald
f26b98c7c4 Simplify the nextChunk handling in the DecryptStream class
This is old code, that can be simplified a tiny bit with modern JavaScript features.
2026-04-30 11:40:34 +02:00
calixteman
d92db130da
Merge pull request #21186 from timvandermeij/reorganize-pages-intermittents
Wait for the first page to be ready in the reorganize pages integration tests
2026-04-30 09:01:26 +02:00
calixteman
ac63d851b8
Merge pull request #21197 from Snuffleupagus/find-#extractText-more-await
Improve error handling in the `PDFFindController.prototype.#extractText` method
2026-04-30 08:57:29 +02:00
Jonas Jenwald
aa08b02a5b Avoid setting page-content for a previous document in the PDFFindController.prototype.#extractText method
Given that all of the relevant API methods are asynchronous it's possible, although quite unlikely, that the existing "is the document active" check won't catch all situations where the document was closed in the middle of searching.
2026-04-29 22:39:53 +02:00
Jonas Jenwald
a6e2a42df1 Improve error handling in the PDFFindController.prototype.#extractText method
This handles *all* errors correctly, if e.g. the document is closed in the middle of searching.
Also, replacing the "promise chains" with more `await` helps simplify the code a little bit.
2026-04-29 22:39:51 +02:00
Calixte Denizet
e7ec356be0
Fix free highlight on pages without images (bug 2035530) 2026-04-29 19:24:35 +02:00
Tim van der Meij
34c3ee16f8
Merge pull request #21194 from calixteman/improve_codecov
Slighty improve codecov stuff in gh actions
2026-04-29 17:04:14 +02:00
Calixte Denizet
c91fa7e2dd
Slighty improve codecov stuff in gh actions
disable_search == true, will avoid useless search especially because we already provide the path to the info file.
disable_telem == true, disable sending telemetry to codecov.
2026-04-29 16:48:46 +02:00
Tim van der Meij
2979253338
Merge pull request #21193 from calixteman/fix_intermittent_hangul
Fix the intermittent test failure 'performs a search in a text containing some Hangul syllables'
2026-04-29 15:50:49 +02:00
Calixte Denizet
9a247e51b4
Fix the intermittent test failure 'performs a search in a text containing some Hangul syllables'
The patch cb8055f0a changed the worker source so just set it as it was.
2026-04-29 15:36:22 +02:00
Tim van der Meij
eb97e6b2b1
Merge pull request #21191 from timvandermeij/unittestcli-merge
Move `unittestcli` coverage collection to `ci.yml`
2026-04-29 15:02:24 +02:00
Tim van der Meij
3d8a3f09c5
Move unittestcli coverage collection to ci.yml
Originally we introduced a separate `coverage.yml` workflow to
test-drive coverage collection without immediately introducing it inline
in the `ci.yml` workflow. However, now that coverage collection works
nicely and is performant enough we can simplify the workflow definitions
by removing `coverage.yml` entirely in favor of simply inlining coverage
collection into the existing `unittestcli` run in `ci.yml`. Doing so
also avoids having to a full extra `unittestcli` run just to collect
coverage information.

Moreover, this commit aligns coverage collection flags with the ones in
the other workflows to be more explicit and consistent.
2026-04-29 14:43:01 +02:00
Tim van der Meij
4021d57153
Wait for the first page to be ready in the reorganize pages integration tests
The thumbnails are only available if the first page is ready, and not
awaiting that causes the drag-and-drop action to be performed using
incorrect thumbnail viewer state (see the analysis in #21184 for more
details).

Fixes #21184.
Supersedes #20902.
Unblocks #21173.
2026-04-29 14:22:10 +02:00
Jonas Jenwald
e2591b3fbb
Merge pull request #21190 from Snuffleupagus/DecodeStream-abstract-readBlock
Add an abstract `readBlock` method in the `DecodeStream` class
2026-04-29 14:19:10 +02:00
calixteman
0c5eaeeac6
Merge pull request #21189 from calixteman/issue21185
Use Istanbul instrumentation for unittestcli code coverage
2026-04-29 13:48:04 +02:00
Jonas Jenwald
1f6bfa0890 Add an abstract readBlock method in the DecodeStream class
This avoids having to "duplicate" dummy `readBlock` methods in a couple of image-stream classes.
Also, move a few `DecodeStream` field definitions to (ever so slightly) shorten the code.
2026-04-29 13:02:15 +02:00
Calixte Denizet
47f0bdc6a5
Use Istanbul instrumentation for unittestcli code coverage 2026-04-29 11:02:51 +02:00
calixteman
08eca5213e
Merge pull request #21187 from calixteman/bug2035551
Fix HCM colors for the views-manager massive unselect button (bug 2035551)
2026-04-28 21:37:08 +02:00
Calixte Denizet
ecd154160d
Fix HCM colors for the views-manager massive unselect button (bug 2035551) 2026-04-28 19:52:53 +02:00
Tim van der Meij
a5382249db
Merge pull request #21178 from calixteman/unittest-coverage-lib
Collect worker-side coverage for browser unit tests
2026-04-28 15:25:14 +02:00
calixteman
30ea3216c9
Merge pull request #21175 from calixteman/bug1942304
Send 'Terminate' to the worker when destroy races the load-time handshake (bug 1942304)
2026-04-28 15:22:20 +02:00
Calixte Denizet
cb8055f0a9
Collect worker-side coverage for browser unit tests 2026-04-28 14:53:14 +02:00
Tim van der Meij
63e8c358df
Merge pull request #21183 from timvandermeij/github-actions-split
Split the unit/font tests into per-browser jobs
2026-04-28 14:38:09 +02:00
Tim van der Meij
c3c834f708
Merge pull request #21182 from mozilla/dependabot/github_actions/actions/setup-node-6.4.0
Bump actions/setup-node from 6.3.0 to 6.4.0
2026-04-28 14:31:54 +02:00
Tim van der Meij
485dcb7b2c
Split the unit/font tests into per-browser jobs
This commit mirrors the approach from e656b833 to the other workflows
that run multiple OS/browser combinations. This approach has multiple
advantages:

- it improves performance because each job is run in its own environment
  so we don't have two browsers competing for resources in the same
  environment anymore;
- it improves monitoring because each job is shown separately, with its
  own runtime, in e.g. the pull request checks and actions overviews,
  which makes it easier to spot bottlenecks that are specific to a
  certain OS/browser combination and enable follow-up optimizations.
2026-04-28 14:19:45 +02:00
dependabot[bot]
6ca196c69d
Bump actions/setup-node from 6.3.0 to 6.4.0
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.3.0 to 6.4.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](53b83947a5...48b55a011b)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 6.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 12:15:33 +00:00
Tim van der Meij
e66fdfb6db
Merge pull request #21179 from calixteman/split_unit_test-per_browser
Split integration tests into per-browser jobs
2026-04-28 13:15:00 +02:00
Tim van der Meij
f4e24f75ae
Merge pull request #21181 from Snuffleupagus/getPageIndex-async
Convert `Catalog.prototype.getPageIndex` to an asynchronous method
2026-04-28 12:55:38 +02:00
Jonas Jenwald
3475806311 Convert Catalog.prototype.getPageIndex to an asynchronous method
This simplifies/shortens a piece of old code, which shouldn't hurt.
2026-04-28 11:34:41 +02:00
Jonas Jenwald
339f755a52 Add more validation in the Catalog.prototype.getPageIndex method
- Ensure that the /Kids-entries are Arrays, before trying to iterate through them.
 - Ensure that the /Count-entries are (positive) integers.
2026-04-28 11:33:50 +02:00
calixteman
e656b8336f
Split integration tests into per-browser jobs 2026-04-27 22:24:22 +02:00
calixteman
a1b7d0feb5
Merge pull request #21169 from calixteman/speedup_lint
Improve the performances of "gulp lint"
2026-04-27 22:14:42 +02:00
Tim van der Meij
d68ef5bc36
Merge pull request #21177 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-04-27 21:31:34 +02:00
Tim van der Meij
12c96d5510
Bump the stable version in pdfjs.config 2026-04-27 21:26:50 +02:00
calixteman
7e5b36c2d5
Merge pull request #21171 from calixteman/bug2034980
Allow free-highlighting on top of image placeholders (bug 2034980)
2026-04-27 21:07:56 +02:00
Calixte Denizet
dc3c07b3e3 Allow free-highlighting on top of image placeholders (bug 2034980)
The `textLayerImagePlaceholder` canvas added in #20626 covers scanned
pages and was not recognized as a valid pointerdown target by
`#textLayerPointerDown`, so free highlights couldn't start.
2026-04-27 20:13:39 +02:00
calixteman
01b315a8f3
Merge pull request #21176 from calixteman/bug2035197
Fix merging PDFs with conflicting AcroForm /DR (bug 2035197)
2026-04-27 20:04:43 +02:00
Calixte Denizet
c9a7ff0506 Fix merging PDFs with conflicting AcroForm /DR (bug 2035197) 2026-04-27 18:54:52 +02:00
Calixte Denizet
cffb19e266 Send 'Terminate' to the worker when destroy races the load-time handshake (bug 1942304)
If `PDFDocumentLoadingTask.destroy` ran while `workerIdPromise` was
pending, the inner `.then` in `getDocument` threw "Loading aborted"
before `WorkerTransport` was constructed, so `_transport` was never set
and the "Terminate" message was never posted.
2026-04-27 17:14:45 +02:00
Tim van der Meij
d9f175d36d
Merge pull request #21174 from nicolo-ribaudo/fix-comment
Fix array type in CanvasBBoxTracker comment
2026-04-27 16:33:53 +02:00
Nicolò Ribaudo
81678f20ca
Fix array type in CanvasBBoxTracker comment
Remove the "Float32Array" mention in the comment, given that the
implementation usesa  Float64Array.

Actually using a Float32Array passes all the tests we currently have and
reduces memory usage (by 16 bytes per op), however to be sure that it
does not introduce rounding bugs we'd need to `Math.fround` all
operations we do on the clipBox and pendingBBox. It reduces the
readibilty of the code, but we can revisit if this memory usage becomes
a problem.
2026-04-27 15:52:12 +02:00
Tim van der Meij
8d3d370daa
Merge pull request #21170 from calixteman/speedup_typetest
Speed up 'gulp typestest' by removing the unused 'generic' dependency
2026-04-27 13:59:06 +02:00
calixteman
da0b99ce68
Merge pull request #20371 from timvandermeij/github-actions-integration-tests
Introduce a GitHub Actions workflow for running the integration tests
2026-04-27 09:51:22 +02:00
calixteman
3b8f55603d
Merge pull request #21154 from calixteman/bug2034804
Fix merging a PDF after a page deletion (bug 2034804)
2026-04-27 09:19:14 +02:00
calixteman
38beff5cef Speed up 'gulp typestest' by removing the unused 'generic' dependency 2026-04-27 09:14:34 +02:00
calixteman
a761dac3ea
Improve the performances of "gulp lint"
Don't format json files with Prettier: it's done by eslint.
Parallelize the linting tools and eslint.
2026-04-26 23:09:50 +02:00
Calixte Denizet
64b25a8f47
Fix merging a PDF after a page deletion (bug 2034804)
When pages carry explicit pageIndices (e.g. after a delete),
resolve insertAfter against that layout instead of the empty
base sequence. Also reject partial pageIndices combined with
insertAfter, which would race against the extraction's auto-fill.
2026-04-26 22:37:22 +02:00
calixteman
53931c5d2f
Merge pull request #21132 from calixteman/workflow_sync_pdfs
Add a gh workflow for triggering an event when some pdfs are added in test/pdfs
2026-04-26 22:15:03 +02:00
Jonas Jenwald
0ec70b0953
Merge pull request #21168 from Snuffleupagus/unittestcli-coverage-web
Include the `web/` folder in the coverage report for `gulp unittestcli`
2026-04-26 22:02:08 +02:00
Jonas Jenwald
40ea3e3acb Include the web/ folder in the coverage report for gulp unittestcli
Given that there's a few unit-tests for `web/` code that runs in Node.js, it seems reasonable to include that folder in the coverage report.
2026-04-26 21:55:09 +02:00
Calixte Denizet
65792863b9
Add a gh workflow for triggering an event when some pdfs are added in test/pdfs 2026-04-26 21:29:10 +02:00
Tim van der Meij
ce998f1d16
Introduce a GitHub Actions workflow for running the integration tests 2026-04-26 20:40:57 +02:00
Tim van der Meij
b178305a8b
Merge pull request #21167 from timvandermeij/fix-coverage-workflow
Fix the Codecov token not being usable in the unit tests GitHub Actions workflow
2026-04-26 20:40:20 +02:00
Tim van der Meij
142c581362
Fix the Codecov token not being usable in the unit tests GitHub Actions workflow
The job's environment must be `code-coverage` before it has access to
the `CODECOV_TOKEN` secret that's required for pushing coverage data to
Codecov. Without it we get an HTTP 400 response with a `Token required
because branch is protected` message if it's run from `master`.

Fixes f932a58d.
2026-04-26 20:25:57 +02:00
calixteman
f45d507302
Merge pull request #21165 from timvandermeij/github-actions-unit-tests-coverage
Include unit test coverage reporting in the GitHub Actions workflow
2026-04-26 19:55:53 +02:00
calixteman
88609becf8
Merge pull request #21166 from Snuffleupagus/internal-viewer-fixes
A couple of `internal-viewer` fixes
2026-04-26 19:54:36 +02:00
calixteman
c4afee385a
Merge pull request #21164 from timvandermeij/github-actions-font-tests-twice
Remove duplicated font tests execution in the GitHub Actions workflow
2026-04-26 19:53:47 +02:00
Jonas Jenwald
fae980a72d A couple of internal-viewer fixes
- Bundle the `web/text_layer_builder.css` file correctly, to ensure that textLayer debugging works when the code is *built*.
   Note how loading https://mozilla.github.io/pdf.js/internal-viewer/web/debugger.html currently logs the following error: `GET https://mozilla.github.io/pdf.js/internal-viewer/text_layer_builder.css [HTTP/2 404  7ms]`.

 - Import the `MathClamp` helper function from the *built* library, rather than "manually", since that's more correct.
2026-04-26 19:10:05 +02:00
Tim van der Meij
348942418c
Merge pull request #21163 from timvandermeij/updates
Update dependencies to the most recent versions
2026-04-26 17:01:06 +02:00
Tim van der Meij
f932a58d9c
Include unit test coverage reporting in the GitHub Actions workflow 2026-04-26 15:53:30 +02:00
Tim van der Meij
2d95e9964c
Remove duplicated font tests execution in the GitHub Actions workflow
The font tests have run with coverage reporting enabled for quite some
time now and the coverage information has proven to work and be stable,
so we don't have to also run the font tests without coverage reporting
anymore, thereby reducing the total runtime of the workflow.
2026-04-26 15:49:52 +02:00
Jonas Jenwald
60dcc64419
Merge pull request #21162 from Snuffleupagus/renderCommentButton-zIndex-parseInt
Get the `zIndex` correctly in `PopupElement.prototype.renderCommentButton`
2026-04-26 15:21:55 +02:00
Tim van der Meij
9afc31751a
Update dependencies to the most recent versions 2026-04-26 15:02:02 +02:00
Jonas Jenwald
72011c5088 Get the zIndex correctly in PopupElement.prototype.renderCommentButton
In practice this probably hasn't caused any bugs, however given that `DOMElement.style.zIndex` returns a string the existing code is subtly wrong.
This is also consistent with pre-existing `zIndex` code in the `PopupElement` class, see the `#show` and `#hide` methods.
2026-04-26 14:46:39 +02:00
Tim van der Meij
4aed8fd01b
Merge pull request #21161 from Snuffleupagus/getPageIndex-more-tests
Improve unit-testing for the `PDFDocumentProxy.prototype.getPageIndex` method
2026-04-26 14:46:24 +02:00
Jonas Jenwald
fc9d9e49de Improve unit-testing for the PDFDocumentProxy.prototype.getPageIndex method
Given the existing worker-thread caching it doesn't seem, based on the coverage report, that all of the `getPageIndex` code is being tested.
2026-04-26 13:38:08 +02:00
Jonas Jenwald
5c11bf15b0
Merge pull request #21160 from Snuffleupagus/more-hexNumbers
Move the `hexNumbers` Array into `Util`, to enable using it in the viewer
2026-04-26 13:08:42 +02:00
Tim van der Meij
0d7439e856
Merge pull request #21158 from Snuffleupagus/modifiedIds-proper-hash
Compute a "proper" hash in the `AnnotationStorage.prototype.modifiedIds` getter
2026-04-26 12:10:24 +02:00
Jonas Jenwald
9b238b9719 Move the hexNumbers Array into Util, to enable using it in the viewer
This reduces some code duplication, and the new `Util.hexNums` property is now computed lazily.
2026-04-26 12:05:12 +02:00
Tim van der Meij
2674a9f3e4
Merge pull request #21137 from calixteman/bug2022700
Don't decode name of the checkboxes exported values (bug 2022700)
2026-04-26 12:00:58 +02:00
Jonas Jenwald
1591ddfa8d
Merge pull request #21157 from Snuffleupagus/eslint-radix
Enable the `radix` ESLint rule
2026-04-25 22:27:21 +02:00
Jonas Jenwald
b72a229ee8 Compute a "proper" hash in the AnnotationStorage.prototype.modifiedIds getter
Currently the hash-property is just a stringified Array, which means that the hash-property can become arbitrarily long. That's not a good idea since it's used to compute a cache-key, in the API, which is then sent to the worker-thread. Hence the hash-property should be reasonably short, and its length should *not* depend on the number of modified editors, which can be achieved by using `MurmurHash3_64` here as well.
2026-04-25 12:52:29 +02:00
Jonas Jenwald
e6dba6ee34 Enable the radix ESLint rule
Many `parseInt` call-sites already provide the `radix` argument, and this rule helps improve consistency in the code-base; see https://eslint.org/docs/latest/rules/radix

*Please note:* The rule is disabled in `src/scripting_api/util.js` for now, since it's not obvious at a glance (at least to me) what the correct `radix` argument should be there.
2026-04-25 12:13:12 +02:00
calixteman
30d060c77a
Merge pull request #21151 from calixteman/bug2034568
Fix clicking on a thumbnail image not navigating to the correct page when using a screen reader (bug 2034568)
2026-04-25 08:20:25 +02:00
Tim van der Meij
f41c60ab7e
Merge pull request #21147 from Snuffleupagus/unittestcli-download-PDFs
Download linked PDFs when running `gulp unittestcli`
2026-04-24 20:29:14 +02:00
Tim van der Meij
7dc4812643
Merge pull request #21138 from calixteman/bug2034111
Fix status label mismatch after merging with a pre-existing selection (bug 2034111)
2026-04-24 20:07:50 +02:00
calixteman
2d896faa1e
Merge pull request #21142 from calixteman/input_color_alpha
[Ink] Replace the opacity slider with an alpha-enabled color input
2026-04-24 15:46:46 +02:00
Jonas Jenwald
476626eb49
Merge pull request #21153 from Snuffleupagus/rm-MIN_INT_32
Remove the unused `MIN_INT_32` constant (PR 21139 follow-up)
2026-04-24 15:01:16 +02:00
Calixte Denizet
39eb691252
Fix status label mismatch after merging with a pre-existing selection (bug 2034111) 2026-04-24 14:13:53 +02:00
calixteman
a6382ac97d
Merge pull request #21145 from calixteman/bug2034461
Prompt the user for saving a merged pdf (bug 2034461)
2026-04-24 14:11:36 +02:00
calixteman
c05d87a63f
Merge pull request #21149 from calixteman/switch_quickjs_wasm
Switch to a wasm file for the quickjs sandbox
2026-04-24 14:10:47 +02:00
Jonas Jenwald
aa7289d28b Remove the unused MIN_INT_32 constant (PR 21139 follow-up) 2026-04-24 13:29:22 +02:00
calixteman
4489c4106a
Merge pull request #21150 from mozilla/update-locales
l10n: Update locale files
2026-04-24 10:13:55 +02:00
Calixte Denizet
b669fdfc70
Fix clicking on a thumbnail image not navigating to the correct page when using a screen reader (bug 2034568)
Screen readers like NVDA fire synthetic click events on the <img> child of the button rather than on the
thumbnailImageContainer element itself, so the strict classList.contains check silently failed.
2026-04-24 10:10:59 +02:00
github-actions[bot]
e75259eff1 l10n: Update locale files 2026-04-24 00:42:13 +00:00
Calixte Denizet
987edbb646
Switch to a wasm file for the quickjs sandbox 2026-04-23 22:34:48 +02:00
calixteman
25204d359a
Merge pull request #21136 from calixteman/bug2033908
Avoid to add outlines having a deleted page which leads to clone a useless page (bug 2033908)
2026-04-23 22:24:58 +02:00
Jonas Jenwald
4e08d00466 Download linked PDFs when running gulp unittestcli
Currently a fair number of unit-tests are disabled in Node.js not because of missing functionality, but only because they use linked PDFs.
2026-04-23 21:52:08 +02:00
Calixte Denizet
f266c4d8b8
[Ink] Replace the opacity slider with an alpha-enabled color input
The alpha feature is available in Firefox nightly (with the pref `dom.forms.html_color_picker.enabled` set to `true`).
It's available in Safari but not in Chrome.
2026-04-23 21:37:37 +02:00
Tim van der Meij
865a59691b
Merge pull request #21121 from timvandermeij/github-actions-unit-tests
Introduce a GitHub Actions workflow for running the unit tests
2026-04-23 21:25:36 +02:00
Tim van der Meij
14743eef45
Introduce a GitHub Actions workflow for running the unit tests
Note that we no longer create an empty file if the download fails because
we don't want to leave traces of incorrect file contents on disk. This
has never been particularly useful because it'd require a manual user
action to remove the empty file to be able to retry in case of e.g. a
timed out connection, but especially in the context of GitHub Actions
where we cache the PDFs directory we don't want to cache invalid files
to make sure that a next run will automatically retry to fetch any
previously missed PDF files and update the cache.
2026-04-23 21:12:01 +02:00
Tim van der Meij
9f42555cfb
Merge pull request #21143 from calixteman/update_openjpeg_build
Update the openjpeg decoder compiled with the last version of emscripten
2026-04-23 20:38:09 +02:00
Tim van der Meij
654cc5df36
Merge pull request #21148 from calixteman/update_quickjs_build
Update quickjs bindings
2026-04-23 20:36:17 +02:00
Tim van der Meij
76420e5d91
Merge pull request #21140 from mozilla/dependabot/npm_and_yarn/fast-xml-parser-5.7.1
Bump fast-xml-parser from 5.5.7 to 5.7.1
2026-04-23 20:33:42 +02:00
calixteman
dae7695deb
Merge pull request #21144 from calixteman/update_qcms_build
Update qcms bindings
2026-04-23 19:25:43 +02:00
Calixte Denizet
35ef6fe67a
Update quickjs bindings 2026-04-23 19:22:38 +02:00
Calixte Denizet
302bc5f4d9
Prompt the user for saving a merged pdf (bug 2034461) 2026-04-23 18:37:56 +02:00
Calixte Denizet
56a78aca06
Update qcms bindings 2026-04-23 16:43:17 +02:00
Calixte Denizet
16ad718923
Update the openjpeg decoder compiled with the last version of emscripten 2026-04-23 15:49:43 +02:00
Jonas Jenwald
bede5e5bfa
Merge pull request #21139 from Snuffleupagus/jbig2_nowasm_fallback
[api-minor] Replace the CCITT and JBig2 fallback decoders with a JS version of the PDFium decoder
2026-04-23 15:08:17 +02:00
dependabot[bot]
ae1b4796bd
Bump fast-xml-parser from 5.5.7 to 5.7.1
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.5.7 to 5.7.1.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.5.7...v5.7.1)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.7.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-23 06:04:13 +00:00
Jonas Jenwald
a6988582d2 [api-minor] Replace the CCITT and JBig2 fallback decoders with a JS version of the PDFium decoder
*Note:* This is similar to PR 19525, which did the same thing for the OpenJPEG decoder.

The advantages of doing this are:
 - The same JBig2 decoder is used regardless of WASM being supported or not, which means consistent rendering.
 - The old `Jbig2Image` implementation has various bugs and missing features.
 - Less code that needs to be maintained in the PDF.js project, since both the CCITT and the JBig2 decoder is replaced.

The disadvantage of doing this is:
 - Slightly larger bundle size, however the effect is limited since a fair amount of PDF.js code can be removed. For the `gulp mozcentral` target the size increase is approximately 54 kilo-bytes (which is small compared to the 452 kilo-bytes for the JS version of the OpenJPEG decoder).
2026-04-22 23:24:26 +02:00
Calixte Denizet
42ccca7ee8
Don't decode name of the checkboxes exported values (bug 2022700) 2026-04-22 18:30:43 +02:00
Calixte Denizet
a52c8334f5 Avoid to add outlines having a deleted page which leads to clone a useless page (bug 2033908) 2026-04-21 22:23:28 +02:00
Tim van der Meij
fe48736846
Merge pull request #21135 from calixteman/bug2033603
[HCM] Set the correct color for the icon in the merge button when focused with the keyboard (bug 2033603)
2026-04-21 20:21:12 +02:00
Tim van der Meij
e070944ff0
Merge pull request #21131 from Snuffleupagus/fix-CopyLocalImage-unittests
Improve the "CopyLocalImage" unit-tests
2026-04-21 20:18:40 +02:00
Calixte Denizet
9bfad05173 [HCM] Set the correct color for the icon in the merge button when focused with the keyboard (bug 2033603) 2026-04-21 19:24:21 +02:00
calixteman
56d730e975
Merge pull request #21125 from calixteman/reftest_coverage
Add code coverage support for browser/ref tests
2026-04-21 15:00:48 +02:00
calixteman
bb0a50a744
Merge pull request #21134 from mozilla/update-locales
l10n: Update locale files
2026-04-21 14:59:38 +02:00
github-actions[bot]
9f4b7f8241 l10n: Update locale files 2026-04-21 12:47:21 +00:00
calixteman
f065a91aa1
Merge pull request #21133 from calixteman/sync_l10n_app
Use a gh app for making the PR to update l10n data
2026-04-21 14:46:17 +02:00
Calixte Denizet
9eb40abbae
Use a gh app for making the PR to update l10n data
It should help to avoid having the subsequent workflows being stuck.
2026-04-21 14:40:10 +02:00
Jonas Jenwald
676f7fe6b3
Merge pull request #21130 from nicolo-ribaudo/clenaup-test
Fix unit test for dependency tracking
2026-04-21 12:36:27 +02:00
Nicolò Ribaudo
f7725254f3
Fix unit test for dependency tracking
Follow up to PR #21102
2026-04-21 11:48:18 +02:00
Jonas Jenwald
b01eeaf8e1 Improve the "CopyLocalImage" unit-tests
Rather than relying on the time it takes to parse/render the pages, which leads to intermittent failures, add a test-only property and use it to check if the "CopyLocalImage" code-path was exercised.
2026-04-21 11:43:08 +02:00
calixteman
3aab546524 Add code coverage support for browser/ref tests
Instrument JS files on-the-fly via babel-plugin-istanbul when --coverage
or --coverage-per-test is passed, producing an aggregate lcov/HTML report
at the end of the run. A persistent PDFWorker accumulates worker-thread
coverage alongside the main-thread coverage, collected via a new
GetWorkerCoverage message handler.

With --coverage-per-test, an inverted index
(build/coverage/per-test-index.json) is also built as tests run, mapping
each hit source line and function name to the numeric IDs of the tests
that exercised it, keeping the output compact. The new
`gulp test_search --code=file::line_or_function` tool queries the index,
and passing --code to browsertest pre-filters the test run to only those
tests.

Coverage output formats are selectable via --coverage-formats (default:
info; also accepts html, json, text, cobertura, clover).
2026-04-20 21:46:18 +02:00
Tim van der Meij
ab85b7f0ff
Merge pull request #21128 from calixteman/bug2025109
Remove user and password from URLs (bug 2025109)
2026-04-20 21:21:29 +02:00
Calixte Denizet
8ddbeda4a0
Remove user and password from URLs (bug 2025109) 2026-04-20 20:53:24 +02:00
Tim van der Meij
badebcca00
Merge pull request #21127 from calixteman/issue21126
Correctly compute the bbox when simplifying the path construction
2026-04-20 20:48:24 +02:00
Calixte Denizet
db89d3a0e6 Correctly compute the bbox when simplifying the path construction
It fixes #21126.
2026-04-20 18:42:09 +02:00
Tim van der Meij
3ccb263857
Merge pull request #21123 from timvandermeij/fix-unit-test-commonobjs
Fix the `gets text content, with correct properties (issue 8276)` unit test
2026-04-19 20:19:05 +02:00
Tim van der Meij
801236f8c4
Fix the gets text content, with correct properties (issue 8276) unit test
This unit test failed consistently in Firefox both locally and on GitHub
Actions (but not in Chrome or on the bots), which suggests a timing issue.

Since all other unit tests that rely on `commonObjs` actually render the
page, most likely to make sure that `commonObjs` is fully populated at
the time of the check, this commit mirrors that approach to this test,
which indeed fixes the issue.
2026-04-19 19:09:43 +02:00
calixteman
92f862bae9
Merge pull request #21115 from calixteman/improve_reftest_perfs2
Improve reftest runner memory usage and load balancing
2026-04-18 23:07:57 +02:00
Calixte Denizet
7810cee005
Improve reftest runner memory usage and load balancing
Replace manifest slicing with a dynamic task queue: drivers request tasks
on demand via WebSocket so parallel sessions self-balance naturally.

Start reading reference PNGs from disk as soon as a task is dispatched
(prefetchRefPngs) to overlap I/O with rendering. Release snapshot
buffers and task entries immediately after comparison, and copy WS
frame slices via Buffer.from() so the original frame buffer can be
GC'd.

Bump --max-old-space-size to 8192 MB as a workaround for a
Puppeteer/BiDi memory leak where data: URL strings accumulate in
BrowsingContext.#requests indefinitely:
  https://github.com/puppeteer/puppeteer/issues/14876
2026-04-18 22:33:31 +02:00
Tim van der Meij
78ba424dcf
Merge pull request #21118 from timvandermeij/actions-versions
Update GitHub workflow actions to the most recent versions
2026-04-18 19:38:27 +02:00
Tim van der Meij
657eba4139
Update GitHub workflow actions to the most recent versions
Moreover, we indicate the exact version that belongs to each commit
hash. This not only makes it easier to compare the hash against the
release tags in the actions repositories, but hopefully also makes it
easier for e.g. Dependabot to keep the comments up-to-date since not all
of them were correct and varying comment styles were in use. This commit
aligns all of them to a single `v{major}.{minor}.{patch}` style.
2026-04-18 19:01:51 +02:00
Tim van der Meij
7c2ef03202
Merge pull request #21117 from timvandermeij/updates
Update dependencies to the most recent versions
2026-04-18 18:15:54 +02:00
Tim van der Meij
a058acb34d
Fix vulnerability in the basic-ftp dependency
This patch is generated with `npm audit fix` and fixes
GHSA-rp42-5vxx-qpwr.
2026-04-18 16:09:56 +02:00
Tim van der Meij
ba2cc9c1e2
Update dependencies to the most recent versions 2026-04-18 16:07:10 +02:00
Tim van der Meij
c2a050432d
Merge pull request #21116 from Snuffleupagus/extractFontProgram-privateData-Map
Store the Type1 program `privateData` in a Map, rather than an Object
2026-04-18 13:53:47 +02:00
Jonas Jenwald
c155a86733 Store the Type1 program privateData in a Map, rather than an Object
This is nicer when checking if fields exist in `Type1Font.prototype.wrap`, and a couple of loops in that method are also "modernized" slightly.
2026-04-18 12:32:22 +02:00
calixteman
df863ae9c4
Merge pull request #21111 from calixteman/improve_reftest_perfs
Improve reftest runner performance
2026-04-17 08:54:07 +02:00
calixteman
1108c6088b
Merge pull request #21114 from mozilla/update-locales
l10n: Update locale files
2026-04-17 08:52:18 +02:00
github-actions[bot]
eb50166333 l10n: Update locale files 2026-04-17 00:39:40 +00:00
Calixte Denizet
b6fac76429 Improve reftest runner performance
- Replace base64/JSON POST image submission with binary WebSocket frames,
  avoiding base64 overhead and per-request HTTP costs; quit is also sent
  over the same WS channel to guarantee ordering
- Prefetch the next task's PDF in the worker while the current task is
  still rendering
- Use `getImageData` instead of `toBlob` for partial-test baseline
  comparison (synchronous, no encoding); only encode to PNG in master mode
- Disable bounce tracking protection in Firefox to prevent EBUSY errors
  from Puppeteer's profile cleanup on Windows
2026-04-16 22:58:50 +02:00
Jonas Jenwald
302b4cb008
Merge pull request #21112 from Snuffleupagus/createNameTable-TypedArray
Use TypedArrays in the `createNameTable` function
2026-04-16 22:48:52 +02:00
calixteman
7c5f7876e9
Merge pull request #21108 from calixteman/parallelize_browser_tests
Add an option -j XX for browser tests in order to set the number of jobs
2026-04-16 21:30:45 +02:00
Tim van der Meij
5ec6ab1ab8
Merge pull request #21104 from calixteman/fix_focus
Fix integration tests failing because the focus isn't on the right element
2026-04-16 20:02:50 +02:00
Jonas Jenwald
92a0a91046 Pre-compute the length of more intermediate tables in createCmapTable (PR 21103 follow-up)
With the exception of `glyphsIds` the length of the other segments can be trivially determined upfront, which is obvious in hindsight. This way unnecessary allocations can be avoided when building the "cmap" table.
2026-04-16 11:46:59 +02:00
Jonas Jenwald
0a4e8d024d Use TypedArrays in the createNameTable function 2026-04-16 11:46:57 +02:00
Jonas Jenwald
445cb9abf9
Merge pull request #21103 from Snuffleupagus/TrueTypeTableBuilder-2
Use TypedArrays in the `createCmapTable` function
2026-04-16 11:44:14 +02:00
calixteman
9159afd633
Merge pull request #21107 from supermar1010/fix-savedocument-jsdoc
Fix saveDocument JSDoc return type
2026-04-15 22:14:39 +02:00
Jonas Jenwald
17a397ad63
Merge pull request #20958 from Snuffleupagus/rm-sumPrecise-polyfill
Remove the basic `Math.sumPrecise` polyfill
2026-04-15 19:57:06 +02:00
Jonas Jenwald
aced833344 Remove the basic Math.sumPrecise polyfill
This is already polyfilled properly via core-js in `legacy` builds, and the only reason that it wasn't already removed is that the tests (on the bots) use the "modern" builds and Chrome didn't support `Math.sumPrecise` until now; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sumPrecise#browser_compatibility
2026-04-15 16:32:13 +02:00
Calixte Denizet
863b5d346e Add an option -j XX for browser tests in order to set the number of jobs
One browser per job is opened and will run a subset of the tests.
The goal is to make the tests significantly faster on machines with a good number of cpus.
2026-04-15 15:01:55 +02:00
Mario
9dd30474c2 Fix saveDocument JSDoc return type
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:51:39 +02:00
Calixte Denizet
733a9b55a6
Fix integration tests failing because the focus isn't on the right element 2026-04-14 21:31:13 +02:00
calixteman
59908ccad3
Merge pull request #21101 from calixteman/improve_smask
Improve SMask compositing by pre-baking backdrop and filter
2026-04-14 20:57:08 +02:00
Jonas Jenwald
b2cc9ae6d5 Move the string32 helper to the src/display/font_loader.js file
After the previous patches the `string32` helper function is now only used in the `FontLoader.prototype._prepareFontLoadEvent` method, which is stubbed out in the Firefox PDF Viewer, hence move it there instead to avoid bundling dead code.
2026-04-14 20:36:34 +02:00
Jonas Jenwald
cb935c35d3 Use TypedArrays in the createCmapTable function 2026-04-14 20:36:34 +02:00
Jonas Jenwald
f9ecebe63c Add a helper class for building TrueType font tables
This helps reduce the amount of boilerplate code needed in multiple spots throughout the font code, and more importantly it'll help when building TrueType tables whose final size is non-trivial to compute upfront.
2026-04-14 20:36:34 +02:00
Jonas Jenwald
7f7ac949ff
Merge pull request #21100 from Snuffleupagus/createTables-TypedArray
Use TypedArrays when building even more TrueType tables
2026-04-14 20:35:22 +02:00
Calixte Denizet
22a4bd79af
Improve SMask compositing by pre-baking backdrop and filter
remove as much as possible some intermediate canvases and avoid to use SVG filter
at each composition.
Rendering all the pages of issue17784.pdf takes 2x less time now.
2026-04-14 20:18:03 +02:00
calixteman
ee72d8d460
Merge pull request #21102 from nicolo-ribaudo/fix-pattern-fill-deps-tracking
Fix dependency tracking in pattern fill
2026-04-14 18:04:45 +02:00
Nicolò Ribaudo
2ad6b88850
Fix dependency tracking in pattern fill
1. Record `fill` dependencies even if we early return due to `isPatternFill``
2. Isolate the `drawPattern` inner `executeOperationList` in a
   `CanvasNestedDependencyTracker` so that it does not consume pending
   dependencies from the outer list.
2026-04-14 14:16:26 +01:00
Jonas Jenwald
634ce3c163 Convert the return value in createCmapTable and createNameTable to a TypedArray
Compared to the other TrueType table building functions, see previous patches, these ones are not trivial to convert to use TypedArrays properly.
However, in order to simplify the `OpenTypeFileBuilder` implementation a little bit we can at least have these functions return TypedArray data.
2026-04-14 12:28:45 +02:00
Jonas Jenwald
e8ed6c6e24 Use a TypedArray in the createOS2Table function 2026-04-14 10:43:42 +02:00
Jonas Jenwald
aa0bc24e95 Use a TypedArray in the createPostTable function 2026-04-14 10:43:42 +02:00
calixteman
419c2652c3
Merge pull request #21094 from calixteman/issue17784
Correctly sync the transform on the scratch canvas
2026-04-13 23:58:20 +02:00
calixteman
1025af059f
Merge pull request #21099 from calixteman/no_gpu
Use the gpu for drawing meshes only when it has more than 16 triangles (bug 2030745)
2026-04-13 23:55:52 +02:00
calixteman
865b48893a
Correctly sync the transform on the scratch canvas
It fixes #17784.
2026-04-13 23:54:53 +02:00
calixteman
d1ef620541
Merge pull request #21096 from calixteman/issue13520
Fix blending issues while compositing
2026-04-13 22:40:12 +02:00
Calixte Denizet
a2c57ee69e
Use the gpu for drawing meshes only when it has more than 16 triangles (bug 2030745)
And in order to slightly improve performances, move the figure creation in the worker.
2026-04-13 22:23:03 +02:00
calixteman
22bcaf5a8a Fix blending issues while compositing
It fixes #13520.
And remove dead code.
2026-04-13 22:12:04 +02:00
calixteman
b82ceda22b
Merge pull request #21060 from calixteman/implement_merge
Add the UI for merging PDFs (bug 2028071)
2026-04-13 21:37:02 +02:00
calixteman
2417d9aecb
Merge pull request #21098 from calixteman/rm_workaround_1820511
Remove the workaround for bug 1820511
2026-04-13 21:28:49 +02:00
Tim van der Meij
7aca886f2b
Merge pull request #21097 from Snuffleupagus/convert-tables-TypedArray
Use TypedArrays when building more TrueType tables
2026-04-13 21:07:07 +02:00
Calixte Denizet
8c9b819b4e
Add the UI for merging PDFs (bug 2028071) 2026-04-13 19:38:56 +02:00
Calixte Denizet
ec35057b46
Remove the workaround for bug 1820511 2026-04-13 16:49:07 +02:00
calixteman
96debf0c81
Merge pull request #21095 from calixteman/issue19634
Take into account CharProcs keys when computing the type3 hash
2026-04-13 16:09:21 +02:00
calixteman
052e29cc56
Take into account CharProcs keys when computing the type3 hash
It fixes #19634.
2026-04-13 14:49:39 +02:00
Jonas Jenwald
2437f5f961 Use a TypedArray when building the "head" TrueType table 2026-04-13 12:41:41 +02:00
Jonas Jenwald
5096982cfc Use a TypedArray when building the "hhea" TrueType table 2026-04-13 12:41:41 +02:00
Jonas Jenwald
0c789ecc97 Use a TypedArray when building the "maxp" TrueType table 2026-04-13 12:41:41 +02:00
Jonas Jenwald
aaaf143156 Use a DataView when building the "hmtx" TrueType table (PR 21072 follow-up) 2026-04-13 12:41:38 +02:00
Jonas Jenwald
652700dac6
Merge pull request #21078 from Snuffleupagus/isTrueTypeFile-rm-readUint32
Remove `readUint32` usage from the `isTrueTypeFile` function
2026-04-12 21:34:20 +02:00
Jonas Jenwald
2e5ab9c9eb Remove unused helper functions in src/core/core_utils.js
After recent patches, that added more `DataView` usage, these helper functions are now unused.
2026-04-12 19:52:02 +02:00
Jonas Jenwald
c92d4be973 Remove readUint32 usage from the isTrueTypeFile function
This is the only `readUint32` usage in the `src/core/fonts.js` file, and it can be trivially replaced with a string comparison.
2026-04-12 19:50:53 +02:00
Jonas Jenwald
169d8c9616
Merge pull request #21077 from Snuffleupagus/FontRendererFactory-DataView
Re-factor the `FontRendererFactory` class, and related code, to use `DataView`s when reading data
2026-04-12 19:50:06 +02:00
Tim van der Meij
8cfb1f8456
Merge pull request #21093 from timvandermeij/updates
Update dependencies to the most recent versions
2026-04-12 19:39:05 +02:00
Jonas Jenwald
a24d86e1cf Re-factor the FontRendererFactory class, and related code, to use DataViews when reading data 2026-04-12 18:34:19 +02:00
Tim van der Meij
88abcefea0
Merge pull request #21080 from calixteman/recursive_glyf
Avoid infinite recursion while compiling a glyph
2026-04-12 18:32:03 +02:00
Tim van der Meij
89b195d35c
Merge pull request #21092 from Snuffleupagus/AnnotationEditorLayer-stopEvent
Use the `stopEvent` helper function in the `AnnotationEditorLayer` class
2026-04-12 18:31:31 +02:00
Tim van der Meij
0d61268875
Merge pull request #21091 from calixteman/debbuger_array_content_stream
[Debugger] Fix the content stream rendering when it's a ref to an array
2026-04-12 16:29:28 +02:00
Tim van der Meij
d3b00c3b32
Upgrade babel-plugin-istanbul to version 8.0.0
This is a major version bump, but the changelog at
https://github.com/istanbuljs/babel-plugin-istanbul/releases/tag/v8.0.0
doesn't indicate any breaking changes that should impact us (the
dependency update meant a bump of the minimal required Node.js version
to 18, but our minimal supported version is already higher than that).
2026-04-12 16:17:03 +02:00
Tim van der Meij
583c9d6b98
Update dependencies to the most recent versions
Note that the `globals` update rendered two ESLint ignore lines obsolete
because the `Sanitizer` global is now registered [1].

[1] 5d84602967
2026-04-12 16:16:21 +02:00
Calixte Denizet
b4d689ce06
Avoid infinite recursion while compiling a glyph 2026-04-12 14:55:22 +02:00
Tim van der Meij
006931f3d3
Merge pull request #21090 from calixteman/issue21089
Remove pattern fill when setting fill color before drawing a tile
2026-04-12 14:42:49 +02:00
Tim van der Meij
57acd97f6d
Merge pull request #21088 from Snuffleupagus/fonts-rm-int32-helper
Remove the `int32` helper, and replace it with `DataView` usage, in `src/core/fonts.js`
2026-04-12 14:25:14 +02:00
Jonas Jenwald
041f58f1e6 Use the stopEvent helper function in the AnnotationEditorLayer class 2026-04-12 14:23:52 +02:00
Tim van der Meij
01f5de36ad
Merge pull request #21087 from Snuffleupagus/Jbig2Image-DataView
Re-factor the `Jbig2Image` class, and related code, to use `DataView`s when reading data
2026-04-12 14:23:34 +02:00
Tim van der Meij
fbed36db00
Merge pull request #21082 from calixteman/fix_comb_ltr
Fix how the text is printed/saved in a comb field when it's a RTL one
2026-04-12 14:16:42 +02:00
Tim van der Meij
1a1e5dc296
Merge pull request #21083 from mozilla/dependabot/npm_and_yarn/basic-ftp-5.2.2
Bump basic-ftp from 5.2.1 to 5.2.2
2026-04-12 14:12:38 +02:00
calixteman
5cc5d9be45
[Debugger] Fix the content stream rendering when it's a ref to an array
It can be verified in opening stepped.pdf (see #21089).
2026-04-12 13:40:18 +02:00
calixteman
6d3034d4f9
Remove pattern fill when setting fill color before drawing a tile
It fixes #21089.
2026-04-12 13:08:45 +02:00
Jonas Jenwald
f924526f1a Remove the int32 helper, and replace it with DataView usage, in src/core/fonts.js
This helper function only had a single call-site, and it's easily replaced with a `DataView` method.
Additionally, to hopefully make future re-factoring easier, create a `DataView` for each TrueType table.
2026-04-12 10:01:14 +02:00
Jonas Jenwald
5089cceec7
Merge pull request #21086 from Snuffleupagus/JpegImage-DataView
Re-factor the `JpegImage` class, and related code, to use `DataView`s when reading data
2026-04-11 17:34:39 +02:00
Jonas Jenwald
afbded8da1 Re-factor the Jbig2Image class, and related code, to use DataViews when reading data 2026-04-11 16:44:15 +02:00
Jonas Jenwald
64e5a7021d Re-factor the JpegImage class, and related code, to use DataViews when reading data 2026-04-11 12:44:30 +02:00
dependabot[bot]
ec827e0766
Bump basic-ftp from 5.2.1 to 5.2.2
Bumps [basic-ftp](https://github.com/patrickjuchli/basic-ftp) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/patrickjuchli/basic-ftp/releases)
- [Changelog](https://github.com/patrickjuchli/basic-ftp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patrickjuchli/basic-ftp/compare/v5.2.1...v5.2.2)

---
updated-dependencies:
- dependency-name: basic-ftp
  dependency-version: 5.2.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-10 22:09:53 +00:00
Calixte Denizet
fa9b2ae32c Fix how the text is printed/saved in a comb field when it's a RTL one 2026-04-10 22:48:18 +02:00
Jonas Jenwald
81c9a34fd3
Merge pull request #21079 from Snuffleupagus/CFFParser-DataView
Re-factor the `CFFParser` class to use `DataView`s when reading data
2026-04-10 19:56:46 +02:00
calixteman
7cfcafbb4b
Merge pull request #21069 from calixteman/issue21068
Take into account the alignment when printing/saving a comb field
2026-04-10 19:29:20 +02:00
Jonas Jenwald
dd9ed2040e Re-factor the CFFParser class to use DataViews when reading data 2026-04-10 17:44:19 +02:00
Jonas Jenwald
545b512e74
Merge pull request #21076 from Snuffleupagus/OpenTypeFileBuilder-DataView
Re-factor the `OpenTypeFileBuilder` class to use a `DataView` when writing data
2026-04-10 16:22:19 +02:00
Jonas Jenwald
cb3f956a11
Merge pull request #21073 from Snuffleupagus/TrueType-table-comments
Move some TrueType header comments to the correct lines
2026-04-10 15:08:24 +02:00
Jonas Jenwald
e9eabf051d Re-factor the OpenTypeFileBuilder class to use a DataView when writing data
Also, changes the `tables` field to a private `Map`.
2026-04-10 14:59:52 +02:00
calixteman
ca13d0089b
Merge pull request #21074 from mozilla/update-locales
l10n: Update locale files
2026-04-10 09:55:22 +02:00
github-actions[bot]
142f42559e l10n: Update locale files 2026-04-10 00:35:52 +00:00
Jonas Jenwald
a69b9ad033 Ensure that the built "hmtx" font table has valid widths (PR 21072 follow-up)
With the changes in PR 21072 the `string16` helper is no longer being used when building the "hmtx" table, which accidentally removed the development mode assert.
2026-04-09 23:15:02 +02:00
Jonas Jenwald
94f8934d05 Move some TrueType header comments to the correct lines
This is most likely fallout from the introduction of Prettier.
2026-04-09 22:55:38 +02:00
Tim van der Meij
ab124db046
Merge pull request #21072 from Snuffleupagus/hmtx-TypedArray
Use a TypedArray when building the "hmtx" font table
2026-04-09 21:26:45 +02:00
Tim van der Meij
27e171ea38
Merge pull request #21067 from mozilla/dependabot/npm_and_yarn/basic-ftp-5.2.1
Bump basic-ftp from 5.2.0 to 5.2.1
2026-04-09 21:23:36 +02:00
Jonas Jenwald
8f56ee2ae9 Use a TypedArray when building the "hmtx" font table
In this case it's trivial to compute the size of the data upfront, hence we can use a TypedArray which should be more efficient than a string.
2026-04-09 18:58:58 +02:00
calixteman
9efd9fa2c7
Merge pull request #21071 from Snuffleupagus/BBOX_INIT
Add constants for defining the initial BBox and Float32 BBox
2026-04-09 14:51:56 +02:00
calixteman
b5f52c49d0
Merge pull request #21070 from Snuffleupagus/ChunkedStream-getBytes-non-length-update-pos
Update the position when calling `ChunkedStream.prototype.getBytes` without a length
2026-04-09 14:00:52 +02:00
calixteman
1d48f17b98
Merge pull request #21065 from calixteman/issue19988
Dont revoke blob URLs while printing but do it after
2026-04-09 13:50:34 +02:00
Calixte Denizet
3d544294af Take into account the alignment when printing/saving a comb field
It fixes #21068.
2026-04-09 13:48:20 +02:00
Jonas Jenwald
2d8b25cd6d Update the position when calling ChunkedStream.prototype.getBytes without a length
Currently the code only updates the position when the length is defined, and it seems that this has "always" been wrong. Originally I believe that the `ChunkedStream` class was essentially a copy of the `Stream` class, and that implementation had the same problem until PR 20593.

Hopefully there's no code that relies on the current incorrect behaviour[1], since testing every aspect of the `ChunkedStream` implementation can be tricky given that these things are timing dependant.

---

[1] If there are, fixing those call-sites may be as easy calling `ChunkedStream.prototype.reset`.
2026-04-09 12:15:19 +02:00
dependabot[bot]
81644a7ee9
Bump basic-ftp from 5.2.0 to 5.2.1
Bumps [basic-ftp](https://github.com/patrickjuchli/basic-ftp) from 5.2.0 to 5.2.1.
- [Release notes](https://github.com/patrickjuchli/basic-ftp/releases)
- [Changelog](https://github.com/patrickjuchli/basic-ftp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patrickjuchli/basic-ftp/compare/v5.2.0...v5.2.1)

---
updated-dependencies:
- dependency-name: basic-ftp
  dependency-version: 5.2.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-08 20:13:58 +00:00
Jonas Jenwald
0fd556f435 Take full advantage of the lookupRect helper in the FunctionBasedShading constructor 2026-04-08 20:30:20 +02:00
Jonas Jenwald
654985c621 Add constants for defining the initial BBox and Float32 BBox
Nowadays there's a lot of places in the code-base where we need to initialize or reset bounding boxes. Rather than spelling this out repeatedly, this patch adds new `Array`/`Float32Array` constants that can be copied or used as-is where appropriate.
2026-04-08 20:30:20 +02:00
Calixte Denizet
ea15ac31ef Dont revoke blob URLs while printing but do it after
It fixes #19988.

In Firefox, when printing, the document is cloned and use an image cache
which isn't available when there's a service worker.
2026-04-08 14:04:09 +02:00
Jonas Jenwald
a67b952118
Merge pull request #21062 from Snuffleupagus/compileIndex-TypedArray
Reduce allocations in `CFFCompiler.prototype.compileIndex` (PR 21053 follow-up)
2026-04-07 21:47:39 +02:00
calixteman
59c21e3110
Merge pull request #21061 from calixteman/pattern_perf
Avoid as much as possible to have intermediate canvases
2026-04-07 21:07:45 +02:00
Calixte Denizet
00ea8db6bf
Avoid as much as possible to have intermediate canvases
We try to detect in the worker if some patterns or groups need to be drawn or not in isolation.
When they don't, we just draw them on the main canvas instead of drawing on a new canvas.
A pattern or a group is considered as being in isolation if it has some compositing rules or some transparency.

It improves the rendering performance of the pdf in bug 1731514.
2026-04-07 21:03:43 +02:00
Tim van der Meij
70baf9cd5f
Merge pull request #21057 from mozilla/dependabot/github_actions/codecov/codecov-action-6.0.0
Bump codecov/codecov-action from 5.5.2 to 6.0.0
2026-04-07 20:41:50 +02:00
Tim van der Meij
36f63bebcc
Merge pull request #21058 from mozilla/dependabot/github_actions/actions/deploy-pages-5.0.0
Bump actions/deploy-pages from 4.0.5 to 5.0.0
2026-04-07 20:41:32 +02:00
Tim van der Meij
1f2e4adfc5
Merge pull request #21050 from Snuffleupagus/Ascii85Stream-fill
Replace a couple of loops with `TypedArray.prototype.fill()` in the `src/core/ascii_85_stream.js` file
2026-04-07 20:38:27 +02:00
Tim van der Meij
60668707fb
Merge pull request #21056 from mozilla/dependabot/github_actions/github/codeql-action-4.35.1
Bump github/codeql-action from 4.33.0 to 4.35.1
2026-04-07 20:34:12 +02:00
Jonas Jenwald
7b1b1a9153 Reduce allocations in CFFCompiler.prototype.compileIndex (PR 21053 follow-up)
It's possible to compute the final index-data size upfront, thus avoiding a bunch of intermediate allocations during index compilation.
This also means that a TypedArray can be used, rather than a plain Array, making it more efficient to insert the `objects` data.

This helps PDFs with large and complex CFF fonts the most, for example the PDFs in https://bugs.ghostscript.com/show_bug.cgi?id=706451 render ~40 percent faster (based on quick measurements in the viewer with `#pdfBug=Stats`).
2026-04-07 18:38:10 +02:00
calixteman
d6afffe8f6
Merge pull request #21059 from calixteman/bug2028193
Make sure the thumbnails positions are recomputed after a structural change but after a reflow has been done (bug 2028193)
2026-04-07 17:02:07 +02:00
calixteman
f61e00f2fa
Merge pull request #21054 from calixteman/fix_writing_numbers
Fix the way to write numbers when saving a pdf
2026-04-07 16:55:36 +02:00
calixteman
1bf1ef2939
Merge pull request #21053 from Snuffleupagus/CFFCompiler-TypedArray
Reduce allocations when compiling CFF fonts
2026-04-07 16:55:02 +02:00
Calixte Denizet
1b2e98f3ce
Make sure the thumbnails positions are recomputed after a structural change but after a reflow has been done (bug 2028193) 2026-04-07 15:48:23 +02:00
Jonas Jenwald
6f0431456c Reduce allocations when compiling CFF fonts
Currently the `CFFCompiler.prototype.compile` implementation seem a bit inefficient, since the data is stored in a plain Array that needs to grow (a lot) during compilation. Additionally, adding a lot of entries isn't very efficient either and requires special handling of the "too many elements" case.
Some of the "helper" methods that use TypedArrays internally currently need to convert their return data to plain Arrays, via the `compileTypedArray` method, which adds even more intermediate allocations.
Note also that the `OpenTypeFileBuilder` has a special-case for writing plain Array data, which is only needed because of how the CFF compilation is implemented.

To improve this situation the `CFFCompiler.prototype.compile` method is re-factored to store its data in a TypedArray, whose initial size is estimated from the "raw" file size.
This removes the need for most intermediate allocations, and it also handles adding of "many elements" more efficiently.
2026-04-07 14:27:55 +02:00
dependabot[bot]
147ce2b2d2
Bump actions/deploy-pages from 4.0.5 to 5.0.0
Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 4.0.5 to 5.0.0.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](d6db90164a...cd2ce8fcbc)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-07 12:13:42 +00:00
dependabot[bot]
d936f9775b
Bump codecov/codecov-action from 5.5.2 to 6.0.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.5.2 to 6.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](671740ac38...57e3a136b7)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-07 12:13:24 +00:00
dependabot[bot]
2ce0b5a528
Bump github/codeql-action from 4.33.0 to 4.35.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.33.0 to 4.35.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b1bff81932...c10b8064de)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-07 12:13:16 +00:00
calixteman
959701d8e7
Merge pull request #21055 from Snuffleupagus/toggleButton-fix-l10n
Fix the l10n-id for the sidebar toggleButton, in the `ViewsManager` class
2026-04-07 13:44:42 +02:00
Jonas Jenwald
8656b4acb3 Fix the l10n-id for the sidebar toggleButton, in the ViewsManager class
Steps to reproduce:
 1. Open http://localhost:8888/web/viewer.html
 2. Open the console, and run: `PDFViewerApplication.close();`
 3. Note the warning: `[fluent] Missing translations in en-us: pdfjs-toggle-views-manager-button`
2026-04-07 11:13:35 +02:00
Calixte Denizet
3d95aab8d7
Fix the way to write numbers when saving a pdf
It'll avoid to have numbers like 1e-23.
2026-04-07 10:52:06 +02:00
Jonas Jenwald
f8d7c20a1a
Merge pull request #21051 from Snuffleupagus/writePDF-stringToBytes
Use the `stringToBytes` helper in the `PDFEditor.prototype.writePDF` method
2026-04-06 15:55:49 +02:00
Jonas Jenwald
ea12a28e2f Use the stringToBytes helper in the PDFEditor.prototype.writePDF method
This avoids effectively re-implementing an existing helper function, and the code is also simplified a tiny bit by building the final TypedArray header directly.
2026-04-06 14:58:21 +02:00
calixteman
6ac79d05d1
Merge pull request #21049 from calixteman/load_gpu
Unconditionally create a gpu device
2026-04-06 14:14:22 +02:00
calixteman
a9f142c796
Unconditionally create a gpu device
One drawback of the current implementation is that the GPU device can be
unavailable at the time of the first pattern fill, which causes the
GPU-accelerated canvas to be move on the main thread because of putImageData.

Most of the shading patterns stuff will be moved to the GPU and in order
to avoid creating some useless data we've to know if the GPU is available or not.

So in this patch we create the GPU device during the worker initialization
and pass a flag to the evaluator to know if the GPU is available or not.
2026-04-06 13:23:29 +02:00
Jonas Jenwald
dc448b3ceb Replace a couple of loops with TypedArray.prototype.fill() in the src/core/ascii_85_stream.js file 2026-04-06 11:49:25 +02:00
Tim van der Meij
dd8f0a327f
Merge pull request #21048 from Snuffleupagus/buildPostScriptJsFunction-forceInterpreter
Shorten the `src/core/postscript/` code a tiny bit
2026-04-05 18:19:33 +02:00
Jonas Jenwald
9f9be2c619 Use this more in static methods in the src/core/postscript/ folder
Inside of static methods it's possible to reference static fields with `this`, rather than having to spell out the full class name.
2026-04-05 14:22:08 +02:00
Jonas Jenwald
ccab310a39 Add an optional parameter in buildPostScriptJsFunction to force use of the PSStackBasedInterpreter code
This way the test-only function `buildPostScriptProgramFunction` can be removed.
2026-04-05 13:52:09 +02:00
calixteman
853d5436c1
Merge pull request #21046 from timvandermeij/integration-test-ai-killswitch
Replace individual AI/ML disabling preferences with the single killswitch preference in the tests
2026-04-05 13:12:48 +02:00
Jonas Jenwald
cae075e8d0
Merge pull request #21047 from Snuffleupagus/AnnotationLayer-rm-floor-borderColor
Remove unnecessary "flooring" of the components when setting the Annotation `borderColor`
2026-04-05 12:41:04 +02:00
Jonas Jenwald
5aaf30a071
Merge pull request #21018 from Snuffleupagus/Node-22
[api-minor] Update the minimum supported Node.js version to 22
2026-04-05 12:39:36 +02:00
Jonas Jenwald
d155506005 Remove unnecessary "flooring" of the components when setting the Annotation borderColor
This looks like a leftover from much older code, since all colors are now parsed with the [`getRgbColor` helper](ca85d73335/src/core/annotation.js (L558-L583)) which returns `Uint8ClampedArray` data when the color is valid.

Also, use spread syntax when calling `Util.makeHexColor` in a few more spots.
2026-04-05 11:23:32 +02:00
Tim van der Meij
de9f139963
Replace individual AI/ML disabling preferences with the single killswitch preference in the tests
Firefox 148 shipped with a single killswitch to disable current and
future AI/ML functionality. This can be controlled in the GUI via
`Settings -> AI Controls -> Block AI enhancements`, but can also be
controlled programmatically via the `browser.ai.control.default`
preference.

This commit uses this single preference to replace the multiple
preferences we had to use for this purpose before.

Extends 844681a.
2026-04-04 20:23:35 +02:00
calixteman
ca85d73335
Merge pull request #21043 from timvandermeij/integration-test-intermittents-find-count
Fix intermittent integration test failures related to checking the find count results text
2026-04-04 20:21:52 +02:00
calixteman
da83ca69ca
Merge pull request #21045 from timvandermeij/integration-test-comment-trip
Fix intermittent failure in the "must check that the comment sidebar is resizable with the keyboard" comment integration test
2026-04-04 20:19:14 +02:00
calixteman
b5dd450041
Merge pull request #21040 from Snuffleupagus/constructSampled-flat-arrays
Use the original array-data when parsing Type 0 (Sampled) Functions
2026-04-04 19:56:54 +02:00
calixteman
345329e490
Merge pull request #21041 from timvandermeij/function-type-enumeration
Introduce a function type enumeration
2026-04-04 19:55:46 +02:00
Tim van der Meij
24e5377240
Fix intermittent failure in the "must check that the comment sidebar is resizable with the keyboard" comment integration test
In PR #20887 the issue got fixed partly, but two issues remained that
unintendedly left room for intermittent failres:

- in the "Ctrl+ArrowLeft/Right" loop the `waitForBrowserTrip` call was
  placed _before_ the actual keypresses, which means that for the final
  iteration of the loop the last key presses were not properly awaited;

- in the "ArrowLeft/ArrowRight" loop the `waitForBrowserTrip` call was
  absent, which means that we didn't wait for key presses at all.

This commit fixes the issues by consistently waiting to a browser trip
_after_ each key press to make sure the sidebar got a chance to render.
2026-04-04 19:17:54 +02:00
Tim van der Meij
6dccf85a0b
Fix intermittent integration test failures related to checking the find count results text
There is generally a small amount of time between the find call being
reported as finished and the find count results text being updated with
the correct number in the DOM, so the integration tests will fail if we
check the find results count text too soon.

This commit fixes the issue by using the `waitForTextToBe` helper
function to wait until the find count results text is what we expect it
to be. Note that we already use this helper function for this exact
purpose in other integration tests (related to reorganizing pages), and
it's also a little bit shorter/easier to read which cannot hurt.
2026-04-04 16:55:12 +02:00
Tim van der Meij
68da778329
Introduce a function type enumeration
This improves readability by removing "magic" numbers, and matches what
we already have for e.g. annotation and shading types.

Note that function type 1 does not exist in the specification, but that
also applies to everything higher than 4, so we can also remove the
specific handling of function type 1 and instead just let it fall
through to throwing an exception for unknown function types, in which we
now also log the provided function type to aid debugging.
2026-04-04 14:57:59 +02:00
Jonas Jenwald
fa344c1852 Use the original array-data when parsing Type 0 (Sampled) Functions
It seems just as easy to lookup the needed data in the original arrays, rather than having to first create (and allocate) nested arrays for that purpose.
2026-04-04 14:07:21 +02:00
Tim van der Meij
e10f11bd3a
Merge pull request #21038 from Snuffleupagus/add_test-calculateMD5
Use the `calculateMD5` helper, from `test/downloadutils.mjs`, in `test/add_test.mjs`
2026-04-04 14:01:55 +02:00
Jonas Jenwald
6207116e9b Use the calculateMD5 helper, from test/downloadutils.mjs, in test/add_test.mjs
Avoid essentially duplicating that function, and make `test/add_test.mjs` async to simplify the code a little bit.
2026-04-04 12:31:14 +02:00
Tim van der Meij
bc38b633ee
Merge pull request #21035 from timvandermeij/updates
Update dependencies to the most recent versions
2026-04-04 11:33:08 +02:00
Tim van der Meij
0b9f8fa950
Merge pull request #21036 from calixteman/fix_comment
Fix comments for (is/has)Singlefile in pdf_editor
2026-04-04 11:30:12 +02:00
Jonas Jenwald
fe35a87c85
Merge pull request #21005 from Snuffleupagus/rm-PostScriptCompiler
[api-minor] Remove `PostScriptCompiler` and `PostScriptEvaluator`, since it's now dead code (PR 21023 follow-up)
2026-04-04 11:02:34 +02:00
Jonas Jenwald
c7b17ecc26
Merge pull request #21037 from Snuffleupagus/rm-compilePostScriptToIR
Remove the unused `compilePostScriptToIR` function (PR 21023 follow-up)
2026-04-04 10:59:29 +02:00
Jonas Jenwald
4cf0bf410b Remove the unused compilePostScriptToIR function (PR 21023 follow-up)
This function was added in PR 21010, and it became unused in PR 21023.
2026-04-03 22:47:12 +02:00
Jonas Jenwald
0e6903d11e Bump library version to 5.7
See commit a40b91f0bba70c65fe6ac7baba775f7e4b362a4d
2026-04-03 22:29:55 +02:00
Jonas Jenwald
58fc6026fc Add a linked test-case for PR 5134
This test-case is an especially "bad" one performance wise given its PostScript function use, when falling back to the (now removed) `PostScriptEvaluator` code.
2026-04-03 22:29:38 +02:00
calixteman
b3e4932cca
Fix comments for (is/has)Singlefile in pdf_editor 2026-04-03 22:15:34 +02:00
Jonas Jenwald
f6bac014ea [api-minor] Remove PostScriptCompiler and PostScriptEvaluator, since it's now dead code (PR 21023 follow-up)
These classes, and various related code, became unused after PR 21023 with only unit-tests actually running that code now.

Also removes the `isEvalSupported` API option, since the `PostScriptCompiler` was the only remaining code where `eval` was used.
2026-04-03 22:14:14 +02:00
calixteman
5347c22703
Merge pull request #21020 from calixteman/issue7821
Fix the annotation base transform before drawing it
2026-04-03 21:26:48 +02:00
calixteman
f8f21c0eca
Merge pull request #21030 from calixteman/eslint_math_clamp
Add an eslint plugin for using MathClamp when it's possible
2026-04-03 21:19:35 +02:00
Calixte Denizet
1e3d688a32
Add an eslint plugin for using MathClamp when it's possible 2026-04-03 21:12:52 +02:00
Calixte Denizet
9ed5eef6d7
Fix the annotation base transform before drawing it
It fixes #7821.

We do something similar for before drawing XObjects.
2026-04-03 20:59:37 +02:00
calixteman
f05bad9872
Merge pull request #21019 from calixteman/issue16091
Get the right transform for a pattern before filling some text
2026-04-03 20:57:29 +02:00
Calixte Denizet
a1b64c52a1
Get the right transform for a pattern before filling some text
It fixes #16091.
2026-04-03 20:54:22 +02:00
Tim van der Meij
a6a66c077e
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`, and brings
the number of reported vulnerabilities to zero.
2026-04-03 20:37:53 +02:00
Tim van der Meij
b6d5f122e3
Upgrade eslint-plugin-unicorn to version 64.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v64.0.0
doesn't indicate any breaking changes that should impact us.
2026-04-03 20:34:53 +02:00
Tim van der Meij
e97c847e93
Update dependencies to the most recent versions 2026-04-03 20:34:10 +02:00
Tim van der Meij
d1a711bca3
Merge pull request #21023 from calixteman/wasm_stack_js
Add a js fallback for interpreting ps code
2026-04-03 20:09:29 +02:00
Tim van der Meij
a96fb4dbb8
Merge pull request #21014 from calixteman/issue257
Fix radial gradient when the two circles have an intersection
2026-04-03 20:00:37 +02:00
Tim van der Meij
255c3e7c14
Merge pull request #21028 from Snuffleupagus/PDFDataRangeTransport-listener
[api-minor] Change `PDFDataRangeTransport` to use a single (internal)  listener
2026-04-03 19:53:39 +02:00
Tim van der Meij
bb1033053c
Merge pull request #21029 from Snuffleupagus/Object-hasOwn
Replace all `Object.prototype.hasOwnProperty` usage with `Object.hasOwn`
2026-04-03 19:51:09 +02:00
Jonas Jenwald
477f756a76
Merge pull request #21027 from Snuffleupagus/move-MathClamp
Move the `MathClamp` helper function to its own file
2026-04-03 19:08:12 +02:00
Tim van der Meij
38981ce638
Merge pull request #21034 from Snuffleupagus/collectAnnotationsByType-fixes
A couple of small `collectAnnotationsByType` improvements
2026-04-03 18:02:32 +02:00
Tim van der Meij
264c2bf6f9
Merge pull request #21031 from calixteman/fix_font_int16
Fix wrong values when sanitizing fonts
2026-04-03 17:58:31 +02:00
Tim van der Meij
cc5e30b99c
Merge pull request #21021 from Snuffleupagus/PDFThumbnailView-unconditional-OffscreenCanvas
Use `OffscreenCanvas` unconditionally in the `web/pdf_thumbnail_view.js` file
2026-04-03 17:57:04 +02:00
Jonas Jenwald
5b6640eab3 A couple of small collectAnnotationsByType improvements
- Use the same `PartialEvaluator` instance for all annotations on the page, to reduce unnecessary object creation.

 - Use `Object.hasOwn` to check if the annotations were already parsed, to avoid having to keep a separate boolean variable in-sync with the actual code.
2026-04-03 13:20:06 +02:00
calixteman
2414f54675
Merge pull request #21033 from mozilla/update-locales
l10n: Update locale files
2026-04-03 09:18:17 +02:00
github-actions[bot]
b1cedd9daa l10n: Update locale files 2026-04-03 00:34:35 +00:00
Calixte Denizet
535c8d13c2 Fix wrong values when sanitizing fonts
NPUSHW: push signed 16-bits integer: https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#push-n-words
indexToLocFormat: field in the 'head' table: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6head.html#:~:text=indexToLocFormat,-0
2026-04-02 18:13:17 +02:00
Jonas Jenwald
cbfe2abc53 Replace all Object.prototype.hasOwnProperty usage with Object.hasOwn
The newer `Object.hasOwn` method is intended as a replacement for `Object.prototype.hasOwnProperty`, since that one may be problematical; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn#problematic_cases_for_hasownproperty

To ensure that `Object.hasOwn` is used in the future, the ESLint "no-restricted-syntax" rule is extended to catch the old method.
2026-04-02 13:40:10 +02:00
Jonas Jenwald
f09b03c062 Enable the prefer-object-has-own ESLint rule
Please see https://eslint.org/docs/latest/rules/prefer-object-has-own
2026-04-02 13:24:31 +02:00
Jonas Jenwald
f3a2ca08d0 [api-minor] Change PDFDataRangeTransport to use a single (internal) listener
The `PDFDataTransportStream` constructor has always registered exactly one listener for each type of data that an `PDFDataRangeTransport` instance can receive.
Given that an end-user of the `PDFDataRangeTransport` class will supply data through its `onData...` methods, it's also somewhat difficult to understand why additional end-user registered listeners would be needed (since the data is already, by definition, available to the user).
Furthermore, since TypedArray data is being transferred nowadays it's not even clear that multiple listeners (of the same kind) would generally work.

All in all, let's simplify this old code a little bit by using *a single* (internal) listener in the `PDFDataRangeTransport` class.
2026-04-02 12:38:58 +02:00
Jonas Jenwald
68366e31e4 Move the MathClamp helper function to its own file
This allows using it in the `src/scripting_api/` folder, without increasing the size of the scripting-bundle by also importing a bunch of unused code.
2026-04-02 11:22:28 +02:00
Jonas Jenwald
1bd4c4fbde
Merge pull request #21026 from Snuffleupagus/more-MathClamp
Use the `MathClamp` helper function more
2026-04-02 11:21:46 +02:00
Jonas Jenwald
c012ff6e10 Use the MathClamp helper function more
The idea with this helper function is that once https://github.com/tc39/proposal-math-clamp/ becomes stable, all its call-sites should then be replaced by the native functionality.
2026-04-02 10:10:39 +02:00
calixteman
e37709ea76
Merge pull request #21022 from calixteman/bug2028369
Encrypt pdf data when merging the same pdf (bug 2028369)
2026-04-01 22:28:59 +02:00
calixteman
8c7a5f3500
Add a js fallback for interpreting ps code
It's a basic stack based interpreter.
A wasm version will come soon.
2026-04-01 21:40:45 +02:00
Calixte Denizet
f373923170 Encrypt pdf data when merging the same pdf (bug 2028369) 2026-04-01 19:01:11 +02:00
Jonas Jenwald
579589a38a Use OffscreenCanvas unconditionally in the web/pdf_thumbnail_view.js file
Given that `OffscreenCanvas` is available in all supported browsers and that the code in the `web/` folder is only intended to run in browsers, the fallback should no longer be necessary.

Please note:
 - https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
 - https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas#browser_compatibility
2026-04-01 16:32:07 +02:00
Jonas Jenwald
e0423ebbe4 [api-minor] Update the minimum supported Node.js version to 22
This patch updates the minimum supported environments as follows:
 - Node.js 22, which was initially released on 2024-04-24 and has now entered the "Maintenance"-phase; see https://github.com/nodejs/release#release-schedule

Furthermore, note also that Node.js 20 will reach end-of-life on 2026-04-30 which coincides (approximately) with the next PDF.js release.
2026-04-01 12:06:32 +02:00
Calixte Denizet
b42dd39aae
Fix radial gradient when the two circles have an intersection
Fix #257.
2026-04-01 09:43:08 +02:00
calixteman
399fce6471
Merge pull request #21010 from calixteman/ps_js
Add an interpreter for optimized ps code
2026-03-31 22:21:00 +02:00
calixteman
f33f816991
Merge pull request #21012 from calixteman/shading_function
Add support for function-based shadings (bug 1254066)
2026-03-31 22:08:17 +02:00
Calixte Denizet
9f3de1edf6
Add an interpreter for optimized ps code
It'll be used as a fallback when wasm is disabled.
And add in the debugger a view for the generated js code and one for the ps code.
2026-03-31 21:00:22 +02:00
Calixte Denizet
3727b7095a Add support for function-based shadings (bug 1254066)
It fixes #5046.
We just generate a mesh for the pattern rectangle where the color of each vertex is computed from the function.
Since the mesh is generated in the worker we don't really take into account the current transform when it's drawn.
That being said, there are maybe some possible improvements in using directly the gpu for the shading creation
which could then take into account the current transform, but it could only work with ps function we can convert
ino wgsl language and simple enough color spaces (gray and rgb).
2026-03-31 20:46:01 +02:00
Tim van der Meij
58b807d8e8
Merge pull request #21008 from calixteman/ast_cse
Avoid expressions duplication in the ps AST and use a local instead when compiling to WASM
2026-03-31 20:21:59 +02:00
Tim van der Meij
b0c0680bea
Merge pull request #18815 from calixteman/dont_always_use_pattern
Don't use an intermediate canvas when rendering a tiling pattern bigger than the rectangle to fill
2026-03-31 20:18:08 +02:00
Tim van der Meij
48228e2756
Merge pull request #21013 from calixteman/bug2026956
Add attachments when merging/reorganizing a pdf (bug 2026956)
2026-03-31 20:17:54 +02:00
Tim van der Meij
d1c3d3938e
Merge pull request #21007 from Snuffleupagus/Node-getReadableStream-simplify
[Node.js] Remove the `node-readable-to-web-readable-stream` polyfill
2026-03-31 20:03:40 +02:00
Calixte Denizet
5b8c04f383 Add attachments when merging/reorganizing a pdf (bug 2026956) 2026-03-31 14:48:06 +02:00
Calixte Denizet
4c019e7712
Don't use an intermediate canvas when rendering a tiling pattern bigger than the rectangle to fill 2026-03-30 18:38:56 +02:00
Calixte Denizet
63cf35b47f Avoid expressions duplication in the ps AST and use a local instead when compiling to WASM 2026-03-30 16:30:33 +02:00
Jonas Jenwald
bfffb6c0f0 Import fs/promises directly in a few spots in the unit-tests
Also, use the existing PDF.js helper function to fetch text-data when running the "bidi" tests in browsers.
2026-03-30 14:34:53 +02:00
Jonas Jenwald
90fe6c70ff [Node.js] Remove the node-readable-to-web-readable-stream polyfill
While `Readable.toWeb` wasn't marked as stable until more recently, the functionality itself has existed since Node.js version `17.0.0`; note https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options

Hence the polyfill shouldn't actually be necessary, which is confirmed by the unit-tests passing in Node.js version `20` in GitHub Actions.
2026-03-30 13:45:13 +02:00
calixteman
a40b91f0bb
Merge pull request #21002 from calixteman/ps_eval
[api-minor] Rewrite the ps lexer & parser and add a small Wasm compiler
2026-03-30 09:23:13 +02:00
calixteman
952952c905
[api-minor] Rewrite the ps lexer & parser and add a small Wasm compiler
The main goal is to remove the eval-based interpreter.
In order to have some good performances, the new parser performs some optimizations
on the AST (similar to the ones in the previous implementation),
and the Wasm compiler generates code for the optimized AST.
For now, in case of errors or unsupported features, the Wasm compiler returns null
and the old interpreter is used as a fallback.
Few things are still missing:
 - a wasm-based interpreter using a stack (in case the ps code isn't stack-free);
 - a better js implementation in case of disabled wasm.

 but they will be added in follow-up patches.
2026-03-30 09:22:33 +02:00
Tim van der Meij
cb2640dc33
Merge pull request #21004 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-03-29 20:48:47 +02:00
Tim van der Meij
806d071ea8
Bump the stable version in pdfjs.config 2026-03-29 20:45:34 +02:00
Tim van der Meij
ada3438039
Merge pull request #21001 from Snuffleupagus/getDestFromStructElement-unit-test
Add a unit-test for the `Catalog.#getDestFromStructElement` method
2026-03-29 16:08:21 +02:00
Tim van der Meij
9026329d3d
Merge pull request #21003 from Snuffleupagus/applyOpacity-map
Simplify the `applyOpacity` helper function
2026-03-29 16:06:28 +02:00
Tim van der Meij
80d0d7349c
Merge pull request #20997 from Snuffleupagus/StatTimer-Map
Re-factor the `StatTimer` class a little bit
2026-03-29 16:05:15 +02:00
Tim van der Meij
37f5902c3c
Merge pull request #20996 from Snuffleupagus/more-logical-assignment
Use more logical assignment in the code-base
2026-03-29 16:03:40 +02:00
Tim van der Meij
8941695fe8
Merge pull request #20998 from Snuffleupagus/statcmp-import
Use a standard import for the `ttest` package in `test/stats/statcmp.js`
2026-03-29 16:01:34 +02:00
Tim van der Meij
cdae7a9b36
Merge pull request #20993 from mozilla/update-locales
l10n: Update locale files
2026-03-29 15:59:53 +02:00
Jonas Jenwald
498daadf3c Simplify the applyOpacity helper function
This function only has a single call-site (if we ignore the unit-tests), where the colors are split into separate parameters.
Given that all the color components are modified in the exact same way, it seems easier (and shorter) to pass the colors as-is to `applyOpacity` and have it use `Array.prototype.map()` instead.
2026-03-29 14:52:06 +02:00
Jonas Jenwald
5d2c4ed211
Merge pull request #20999 from Snuffleupagus/getRGB-rgba-split-limit
Remove a tiny bit of unnecessary "rgba" parsing in the `getRGB` function
2026-03-29 14:04:52 +02:00
Jonas Jenwald
d1f15fe352 Add a unit-test for the Catalog.#getDestFromStructElement method
This code already has an integration-test, however also having a unit-test shouldn't hurt since those are often easier to run and debug (and it nicely complements the existing `outline` unit-tests).

The patch also makes the following smaller changes to the method itself:
 - Avoid creating and parsing an empty Array, when doing the `pageRef` search.
 - Use `XRef.prototype.fetch` directly, when walking the parent chain, since the check just above ensures that the value is a Reference.
 - Use the `lookupRect` helper when parsing the /BBox entry.
2026-03-29 14:01:43 +02:00
Jonas Jenwald
8121bc0dd2 Remove a tiny bit of unnecessary "rgba" parsing in the getRGB function
This obviously won't matter in practice, however it seems more "correct" to only extract the necessary number of color components rather than slicing off excess ones at the end.
2026-03-29 12:13:59 +02:00
Jonas Jenwald
545656007b Use a standard import for the ttest package in test/stats/statcmp.js
Since this code is quite old parts of it can also be simplified a little bit by using modern string methods, which removes the need for the `pad` helper function.
2026-03-29 11:53:44 +02:00
Jonas Jenwald
256be7f3a6 Remove manual loops in the StatTimer.prototype.toString method
We can use Array methods instead, which is a tiny bit shorter.
2026-03-27 15:35:25 +01:00
Jonas Jenwald
522f5f85b9 Re-factor the StatTimer class to track started times in a private Map 2026-03-27 15:35:23 +01:00
Jonas Jenwald
0060eeb726 Use more logical assignment in the code-base 2026-03-27 12:18:04 +01:00
github-actions[bot]
5836d3fc8f l10n: Update locale files 2026-03-27 00:34:30 +00:00
calixteman
a9e439bce1
Merge pull request #20977 from calixteman/bug2026037
Use non-breakable spaces in options for the choice widget (bug 2026037)
2026-03-26 23:55:49 +01:00
Calixte Denizet
013a209e77
Use non-breakable spaces in options for the choice widget (bug 2026037)
Usual white spaces are collapsed.
2026-03-26 23:52:46 +01:00
calixteman
0128ead18a
Merge pull request #20985 from calixteman/bug2023150_2
Avoid to be blocked when searching after a page move (bug 2023150)
2026-03-26 23:28:33 +01:00
calixteman
47513119e8
Merge pull request #20991 from calixteman/bug2026639
Avoid to have multiple selected pages after copy/cut operations (bug 2026639)
2026-03-26 22:26:00 +01:00
calixteman
018c1539dd
Merge pull request #20957 from calixteman/issue20956
Break text chunks only if the base font is different
2026-03-26 22:24:23 +01:00
calixteman
27e619f00d
Merge pull request #20992 from calixteman/organize_avoid_exception
Avoid exception when cloning a page with some modified annotations
2026-03-26 22:15:06 +01:00
Calixte Denizet
2e3d79e616
Break text chunks only if the base font is different
It fixes #20956.
2026-03-26 21:39:32 +01:00
calixteman
484518614d
Merge pull request #20976 from calixteman/bidi_tests
Add the bidi tests coming from BidiTest.txt and BidiCharacterTest.txt
2026-03-26 21:36:18 +01:00
Calixte Denizet
f98ce9ca85
Avoid to have multiple selected pages after copy/cut operations (bug 2026639) 2026-03-26 21:35:10 +01:00
calixteman
466c6263ad
Merge pull request #20974 from calixteman/bug2025674
Don't walk the children of a node having some attached MathML (bug 2025674)
2026-03-26 21:33:13 +01:00
Calixte Denizet
2b20e012bb
Avoid exception when cloning a page with some modified annotations
Some tests will come later.
2026-03-26 20:53:09 +01:00
Tim van der Meij
377f6d8b73
Merge pull request #20984 from calixteman/debugger_dont_update_canvas_view
Update the canvas detail view only when drawing is done
2026-03-26 20:41:22 +01:00
Tim van der Meij
a924af2e0b
Merge pull request #20990 from calixteman/bug2026564
Hide the new badge while a page is selected (bug 2026564)
2026-03-26 20:35:56 +01:00
Tim van der Meij
bf7d25b35c
Merge pull request #20975 from Snuffleupagus/AnnotationStorage-rm-typeof-function
Use optional chaining rather than `typeof` checks when invoking the `AnnotationStorage` callbacks
2026-03-26 20:35:24 +01:00
Tim van der Meij
f52a50ba09
Merge pull request #20986 from Snuffleupagus/FontInfo-readString-simplify
Reduce allocations in the `FontInfo.prototype.#readString` method (PR 20197 follow-up)
2026-03-26 20:34:03 +01:00
Tim van der Meij
8531947112
Merge pull request #20978 from calixteman/debugger_tree_whitespace
Debugger: in the tree view, display the white spaces as they're
2026-03-26 20:30:32 +01:00
Tim van der Meij
d3fd72e7e8
Merge pull request #20982 from calixteman/debugger_images_preview
Display mask in the tree view in the debugger
2026-03-26 20:29:42 +01:00
Tim van der Meij
5716b6e8b5
Merge pull request #20972 from Snuffleupagus/downloadFile-skip-duplicates
Avoid downloading test PDFs multiple times
2026-03-26 20:26:52 +01:00
Tim van der Meij
c41403cc5e
Merge pull request #20979 from mozilla/dependabot/npm_and_yarn/multi-bf05dc1ecf
Bump picomatch
2026-03-26 20:25:17 +01:00
Calixte Denizet
b1d93d0e51 Hide the new badge while a page is selected (bug 2026564) 2026-03-26 19:23:04 +01:00
Calixte Denizet
2d43ba2b67 Avoid to be blocked when searching after a page move (bug 2023150) 2026-03-26 16:49:44 +01:00
Jonas Jenwald
42566f40fb Reduce allocations in the FontInfo.prototype.#readString method (PR 20197 follow-up)
Looking at the very similar `CssFontInfo.prototype.#readString` and `SystemFontInfo.prototype.#readString` methods they decode using the data as-is, but the `FontInfo.prototype.#readString` method for some reason copies the data into a new `Uint8Array` first; fixes yet another bug/inefficiency in PR 20197.
2026-03-26 16:49:41 +01:00
calixteman
601d961fc3
Merge pull request #20900 from wooorm/wooorm/image-mask-perf
Refactor to improve performance around image masks (bug 1941562)
2026-03-26 16:10:30 +01:00
Calixte Denizet
c2ba6b0e33 Update the canvas detail view only when drawing is done
And remove the canvas from the view once it's destroyed.
2026-03-26 15:51:46 +01:00
Titus Wormer
e914326346
Refactor to improve performance around image masks (bug 1941562)
* add support for directly writing masks into `rgbaBuf` if their size matches
* add support for writing into `rgbaBuf` to `resizeImageMask` to avoid extra
  allocs/copies
* respect `actualHeight` to avoid unnecessary work on non-emitted rows
* mark more operations as `internal`

This changes the path for what I believe is the common case for masks:
a mask to add transparency to the accompanying opaque image, both being
equal in size.
The other paths are not meaninfully unchanged.
That increases my confidence as these new paths can be easily tested
with a PNG with transparency.
2026-03-26 14:39:50 +01:00
Calixte Denizet
867af5c1e5
Display mask in the tree view in the debugger 2026-03-26 14:35:31 +01:00
Jonas Jenwald
9be671dbbd
Merge pull request #20980 from Snuffleupagus/CanvasExtraState-rm-preInit
Remove unused `preInit` parameter from the `CanvasExtraState` constructor (PR 19043 follow-up)
2026-03-26 14:27:39 +01:00
Jonas Jenwald
39dd02cf32 Remove unused preInit parameter from the CanvasExtraState constructor (PR 19043 follow-up)
This parameter was added in PR 19043, however it never actually appears to have been used.
2026-03-26 11:07:47 +01:00
dependabot[bot]
5e4ca58785
Bump picomatch
Bumps  and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together.

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-25 22:14:25 +00:00
Calixte Denizet
265de5d453
Debugger: in the tree view, display the white spaces as they're
And in the debug view, display the ltr chars in the same order as they are in showText argument.
2026-03-25 19:46:16 +01:00
Calixte Denizet
42c229c267
Add the bidi tests coming from BidiTest.txt and BidiCharacterTest.txt
Some tests were failing and has been fixed:
 - "Hello" + Alef + "(" + Bet: the "(" (neutral) was not considered as a part of the group Alef(Bet and the group wasn't reverted;
 - some intermediate neutrals were considered as strong.
2026-03-25 15:18:50 +01:00
Jonas Jenwald
fc3407cabd Use optional chaining rather than typeof checks when invoking the AnnotationStorage callbacks
This is a little bit shorter, and it should be fine considering that in the API there are no `typeof` checks when invoking user-provided callbacks (see e.g. `onPassword` and `onProgress`).
2026-03-25 13:57:00 +01:00
calixteman
eff11e88bb
Don't walk the children of a node having some attached MathML (bug 2025674)
And now Chrome has a MathML Sanitizer implementation (146), the tests related to MathML are updated to reflect that.
2026-03-25 10:21:34 +01:00
Jonas Jenwald
777251da85
Merge pull request #20968 from Snuffleupagus/getNetworkStream
Move the `NetworkStream` choice from `src/display/api.js` and into a separate file
2026-03-25 08:33:08 +01:00
Jonas Jenwald
9c857166cc Avoid downloading test PDFs multiple times
It's somewhat common for multiple test-cases to use the same PDF, for example tests for both `eq` and `text` with one PDF.
Currently the logic in `downloadManifestFiles` doesn't handle duplicate test PDFs, which leads to wasted time/resources by downloading the same PDF more than once. Naturally the effect of this is especially bad when downloading all linked PDFs.

Total number of test PDFs downloaded:
 - 507, with `master`.
 - 447, with this patch.
2026-03-25 08:18:05 +01:00
calixteman
ae84c662b8
Merge pull request #20966 from calixteman/rm_canvas_cache
Remove the canvases cache
2026-03-25 07:50:55 +01:00
calixteman
7b2901bd21
Merge pull request #20965 from calixteman/enable_hwa_default
Enable hardware acceleration by default
2026-03-25 07:49:36 +01:00
Calixte Denizet
f608d5682c Enable hardware acceleration by default 2026-03-24 23:41:05 +01:00
Calixte Denizet
c0e3977321 Remove the canvases cache
The cache has been added in #3312 in 2013 and a lot of things changed since.
Having too many cached accelerated canvases can lead to have to move their data from the GPU to the RAM
which is costly.
So this patch:
 - removes all the cached canvases;
 - destroys the useless canvases in order to free their associated memory asap;
 - slightly rewrite canvas.js::_scaleImage to avoid too much canvas creation.
2026-03-24 23:39:44 +01:00
calixteman
ae70a5d123
Merge pull request #20969 from calixteman/fix_test_comparaison
Strip private ancillary PNG chunks before comparing images in ref tests
2026-03-24 22:59:12 +01:00
Calixte Denizet
385028005b
Strip private ancillary PNG chunks before comparing images in ref tests
This regression is because of:
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1980264 which added the random ID;
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1990514 which re-enabled EfficientCanvasRandomization
2026-03-24 22:48:20 +01:00
Tim van der Meij
2bcf2bb911
Merge pull request #20955 from calixteman/bug2025247
Remove the selection after the pages have been extracted (bug 2025247)
2026-03-24 21:24:51 +01:00
Tim van der Meij
7035459c05
Merge pull request #20960 from Snuffleupagus/rm-PDFWorker-fromPort
Remove the deprecated `PDFWorker.fromPort` method (PR 19943 follow-up)
2026-03-24 21:23:00 +01:00
Tim van der Meij
b792f229d7
Merge pull request #20857 from mschoettle/build-add-legacy
Copy webpack.mjs to legacy in dist task
2026-03-24 21:21:44 +01:00
Tim van der Meij
1120b3d345
Merge pull request #20952 from timvandermeij/github-actions-caching
Implement Node.js caching, and fix Python caching, in the GitHub Actions workflows
2026-03-24 21:15:09 +01:00
Tim van der Meij
3e651dd690
Merge pull request #20971 from Snuffleupagus/downloadFile-fetch
Download test PDFs with the Fetch API
2026-03-24 21:13:47 +01:00
Jonas Jenwald
3e0571cd9c Download test PDFs with the Fetch API
Using the Fetch API simplifies and shortens the `downloadFile` function considerably, since among other things it handles redirects[1] by default.

Also, the regular expression in `downloadManifestFiles` can be replaced with a simple string function now.

---

[1] Implementations of the Fetch API should already prevent e.g. redirect loops and limit the total number of redirects allowed.
2026-03-24 21:01:42 +01:00
Jonas Jenwald
a0102abe76 Move the NetworkStream choice from src/display/api.js and into a separate file
This code already isn't used (or even bundled) in the Firefox PDF Viewer, and it also slightly reduces the number of import maps that need to be maintained.
2026-03-24 17:08:04 +01:00
Calixte Denizet
f578c7e299 Use the ImageDecoder by default on Chrome
The two mentioned bugs have been fixed a while back. So it should be fine to use this feature now.
2026-03-23 18:02:12 +01:00
Jonas Jenwald
ca8f8074a2 Remove the deprecated PDFWorker.fromPort method (PR 19943 follow-up)
This has been deprecated in ten releases, so let's just remove it now.
2026-03-23 17:24:54 +01:00
Matthias Schoettle
5c3878be25 Copy webpack.mjs to legacy in dist task 2026-03-23 14:40:34 +00:00
Calixte Denizet
12a4fc6893
Remove the selection after the pages have been extracted (bug 2025247) 2026-03-23 10:27:44 +01:00
calixteman
2643125a12
Merge pull request #20951 from calixteman/bug2021392
Correctly scroll the search result in the viewport with rotated pdfs (bug 2021392)
2026-03-22 21:36:46 +01:00
Tim van der Meij
1756b48417
Merge pull request #20949 from Snuffleupagus/BinaryDataFactory-2
[api-minor] Replace the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` API options with a single factory/option
2026-03-22 21:20:49 +01:00
calixteman
243659380a
Correctly scroll the search result in the viewport with rotated pdfs (bug 2021392) 2026-03-22 21:08:49 +01:00
Tim van der Meij
8d4151cfbb
Fix Python caching in the GitHub Actions workflows
For the Python-based workflows we were already using `pip` caching [1],
but sadly this isn't fully functional at the moment because the caching
functionality uses `requirements.txt` to determine when to create or
invalidate the cache. However, we have two different `pip` install
commands but only a `requirements.txt` for one of them (the Fluent
linter), which means that the other job (the font tests) will not
populate the cache with its dependencies.

This can be seen by opening any font tests or Fluent linting build and
noticing that they report the exact same cache key even though their
dependencies are different. In the installation step the dependencies
are reported as "Downloading [package].whl" instead of the expected
"Using cached [package].whl".

This commit fixes the issue by explicitly defining a `requirements.txt`
file for both jobs and pointing the caching functionality to the
specific file paths to make sure that unique caches with the correct
package data are used. While we're here we also align the syntax and
step titles in the files for consistency.

[1] https://github.com/actions/setup-python?tab=readme-ov-file#caching-packages-dependencies
2026-03-22 20:01:32 +01:00
Tim van der Meij
a3b19875ec
Implement Node.js caching in the GitHub Actions workflows
The `setup-node` action contains built-in support for caching [1], so
this commit makes sure we use it for all Node.js-based workflows to
reduce workflow execution time.

Note that, contrary what one might expect [2], the `node_modules`
directory is deliberately not cached because it can conflict with
differing Node.js versions and because it's not useful in combination
with `npm ci` usage which wipes the `node_modules` folder
unconditionally. Therefore, the action instead caches the global `npm`
cache directory instead which does not suffer from these problems and
still provides a speed-up at installation time.

[1] https://github.com/actions/setup-node?tab=readme-ov-file#caching-global-packages-data
[2] https://github.com/actions/setup-node/issues/416
[3] https://github.com/actions/cache/issues/67
2026-03-22 19:40:10 +01:00
Tim van der Meij
0a6894d28b
Merge pull request #20948 from calixteman/issue20914
Interpret empty annotation border as [0, 0, 0]
2026-03-22 19:08:19 +01:00
Jonas Jenwald
3a372fde94 [api-minor] Replace the CMapReaderFactory, StandardFontDataFactory, and WasmFactory API options with a single factory/option
Currently we have no less than three different, but very similar, factories for reading built-in CMap files, standard font files, and wasm files on the main-thread.[1]
These factories were added at different points in time, since I cannot imagine that we'd add essentially three copies of the same code otherwise.

Nowadays these factories are often not even used[2], since worker-thread fetching is used whenever possible to improve performance. In particular, they will *only* be used when either:
 - The PDF.js library runs in Node.js environments.
 - The user manually sets `useWorkerFetch = false` when calling `getDocument`.
 - The user provides custom `CMapReaderFactory`, `StandardFontDataFactory`, and/or `WasmFactory` instances when calling `getDocument`.

By replacing these factories with *a single* new `BinaryDataFactory` factory/option the number of `getDocument` options are thus reduced, which cannot hurt.
This also reduces the total bundle-size of the Firefox PDF Viewer a little bit, and it slightly reduces the number of import maps that need to be maintained.

*Please note:* For users that provide custom `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` instances when calling `getDocument` this will be a breaking change, however it's unlikely that (many) such users exist.
(The *internal* format data-format of `CMapReaderFactory` was changed in PR 18951, and there hasn't been a single question/complaint about it in well over a year.)

---

[1] Any new functionality could easily lead to more such factories being added in the future, which wouldn't be great.

[2] Note that the Firefox PDF Viewer no longer use these factories, since it "forcibly" sets `useWorkerFetch = true` during building.
2026-03-22 15:49:06 +01:00
calixteman
de48af76d4
Interpret empty annotation border as [0, 0, 0]
It fixes #20914.
2026-03-22 15:49:04 +01:00
Tim van der Meij
56fe5fb622
Merge pull request #20950 from timvandermeij/revert-locale-stuck-actions
Revert "Avoid to have stuck actions when running update_locales task"
2026-03-22 15:42:30 +01:00
Tim van der Meij
921e258d35
Revert "Avoid to have stuck actions when running update_locales task"
This reverts commit d618a2bc7ebe550cfcef31df8ddd0c8a12cf6bf1.
Unfortunately it did not fix the hanging actions for the locale update
job; fixing the issue is tracked in #20813.
2026-03-22 15:38:25 +01:00
Tim van der Meij
9fa5cb9b30
Merge pull request #20947 from calixteman/fix_superscript
Don't add an EOL after a superscript
2026-03-22 15:30:30 +01:00
Tim van der Meij
6c197529e8
Merge pull request #20941 from calixteman/simple_viewer_test
Add an integration test for the simple viewer
2026-03-22 15:18:51 +01:00
calixteman
ec24053ddf
Don't add an EOL after a superscript 2026-03-22 14:20:18 +01:00
calixteman
741649c31d
Add an integration test for the simple viewer 2026-03-22 12:44:15 +01:00
Tim van der Meij
869f25a489
Merge pull request #20940 from calixteman/issue20872
Fix the group bbox when the numbers are too big
2026-03-22 12:27:43 +01:00
Tim van der Meij
1aa95d28d0
Merge pull request #20944 from Snuffleupagus/PDFObjects-resolve-once
Avoid resolving an `objId` more than once in the `PDFObjects` class
2026-03-22 12:25:08 +01:00
Tim van der Meij
4900bd80f0
Merge pull request #20939 from Snuffleupagus/BaseCMapReaderFactory-filename
[api-minor] Simplify `BaseCMapReaderFactory` by having the worker-thread create the `filename`
2026-03-22 12:14:27 +01:00
calixteman
c0f3627973
Merge pull request #20945 from mozilla/update-locales
l10n: Update locale files
2026-03-22 12:13:17 +01:00
github-actions[bot]
523d87259f l10n: Update locale files 2026-03-22 11:12:19 +00:00
Tim van der Meij
68663bba7f
Merge pull request #20942 from calixteman/fix_update_local
Make persist-credentials: true in the update_locale action
2026-03-22 12:00:50 +01:00
Jonas Jenwald
e3564deefa Remove the internal #ensureObj method in the PDFObjects class
With the introduction of `Map.prototype.getOrInsertComputed()` usage this method is no longer necessary, and the code can just be inlined instead.
2026-03-22 11:34:30 +01:00
Jonas Jenwald
cb2ae021ca Avoid resolving an objId more than once in the PDFObjects class
Trying to resolve the same `objId` more than once would be a bug elsewhere in the code-base, since that should never happen, hence update the `resolve` method to prevent that.
2026-03-22 11:34:20 +01:00
calixteman
60de323514
Make persist-credentials: true in the update_locale action 2026-03-21 22:08:02 +01:00
calixteman
5992d0f097
Fix the group bbox when the numbers are too big
It fixes #20872.
2026-03-21 19:37:42 +01:00
Jonas Jenwald
262aeef3fa [api-minor] Simplify BaseCMapReaderFactory by having the worker-thread create the filename
The `BaseCMapReaderFactory`, `BaseStandardFontDataFactory`, and `BaseWasmFactory` classes are all very similar, and the only difference is really in their respective `fetch` methods.
By have the worker-thread "compute" the complete `filename` it's possible to simplify the `BaseCMapReaderFactory.prototype.fetch` method, which will allow future improvements to all of these classes.

A couple of things to note:
 - This code is unused, and it's not even bundled, in the Firefox PDF Viewer.
 - In browsers it's unused by default, and worker-thread fetching will always be used when possible since that's more efficient.

*Please note:* For users that provide a custom `CMapReaderFactory` instance when calling `getDocument` this could be a breaking change, however it's unlikely that any such users exist.
(The *internal* format of this data was changed previously in PR 18951, and there hasn't been a single question/complaint about it in well over a year.)
2026-03-21 15:54:40 +01:00
calixteman
918a319de6
Merge pull request #20885 from calixteman/gouraud_gpu
Implement Gouraud-based shading using WebGPU.
2026-03-21 15:18:56 +01:00
calixteman
86441e9eb8
Implement Gouraud-based shading using WebGPU.
The WebGPU feature hasn't been released yet but it's interesting to see how
we can use it in order to speed up the rendering of some objects.
This patch allows to render mesh patterns using WebGPU.

I didn't see any significant performance improvement on my machine (mac M2)
but it may be different on other platforms.
2026-03-21 14:34:32 +01:00
Tim van der Meij
5cb8f222d8
Merge pull request #20882 from timvandermeij/remove-xfatest
Remove the `xfatest` command
2026-03-21 14:07:32 +01:00
Tim van der Meij
a90215da48
Merge pull request #20933 from calixteman/issue20930
Fix charSpacing in vertical mode
2026-03-21 13:56:05 +01:00
Tim van der Meij
d66629376e
Merge pull request #20934 from Snuffleupagus/fix-TextLayerBuilder-abortSignal
Ensure that `TextLayerBuilder` works correctly without the `abortSignal` parameter (PR 20928 follow-up)
2026-03-21 13:48:02 +01:00
calixteman
b6c9b12de0
Merge pull request #20936 from Snuffleupagus/debugger-getPageIndex
[Debugger] Allow debugging page-rendering from the /Ref, in addition to the page number
2026-03-21 13:45:39 +01:00
Jonas Jenwald
4c0504460f [Debugger] Allow debugging page-rendering from the /Ref, in addition to the pageNumber
Currently it's only possible to trigger page-render debugging through the page number, but when looking at the /Pages tree it's often not immediately obvious what the page number actually is.
However, the /Ref of the page is directly available and it's thus handy to be able to use that one instead to enable page-render debugging.
2026-03-21 12:06:30 +01:00
Jonas Jenwald
ba796a3441 Ensure that TextLayerBuilder works correctly without the abortSignal parameter (PR 20928 follow-up)
After the changes in PR 20928 the code no longer works correctly unless the `abortSignal` parameter is provided, which completely breaks text-selection in e.g. the standalone viewer-components with errors such as:
```
 #renderTextLayer: TypeError: EventTarget.addEventListener: 'signal' member of AddEventListenerOptions is not an object.
    #bindMouse http://localhost:8888/web/text_layer_builder.js:173
    render http://localhost:8888/web/text_layer_builder.js:128
    #renderTextLayer http://localhost:8888/web/pdf_page_view.js:532
    resultPromise http://localhost:8888/web/pdf_page_view.js:1184
    promise callback*draw http://localhost:8888/web/pdf_page_view.js:1174
    renderView http://localhost:8888/web/pdf_rendering_queue.js:219
    forceRendering http://localhost:8888/web/pdf_viewer.js:2081
    promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:2080
    renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:84
    update http://localhost:8888/web/pdf_viewer.js:1895
    onScaleChanging http://localhost:8888/web/app.js:2755
    dispatch http://localhost:8888/web/event_utils.js:115
    #setScaleUpdatePages http://localhost:8888/web/pdf_viewer.js:1555
    #setScale http://localhost:8888/web/pdf_viewer.js:1640
    set currentScaleValue http://localhost:8888/web/pdf_viewer.js:592
    setInitialView http://localhost:8888/web/app.js:1969
    load http://localhost:8888/web/app.js:1570
    promise callback*load/< http://localhost:8888/web/app.js:1518
    promise callback*load http://localhost:8888/web/app.js:1507
    open http://localhost:8888/web/app.js:1255
    promise callback*open http://localhost:8888/web/app.js:1253
    run http://localhost:8888/web/app.js:895
    webViewerLoad http://localhost:8888/web/viewer.js:366
    <anonymous> http://localhost:8888/web/viewer.js:377
pdf_page_view.js:547:15
```
2026-03-20 23:22:11 +01:00
Calixte Denizet
eaa5eca73d Fix charSpacing in vertical mode
It fixes #20930.
And use the defaultVMetrics (coming from DW2 property) in the font.
2026-03-20 23:09:03 +01:00
calixteman
e577141154
Merge pull request #20906 from calixteman/debugger_text
Add the possibility to debug only text rendering by filtering the op list.
2026-03-20 22:39:18 +01:00
calixteman
cf3b3fa900 Add the possibility to debug only text rendering by filtering the op list.
And a specific view for inspecting font information and the text layer on top of the canvas.
2026-03-20 22:28:34 +01:00
Tim van der Meij
f51419854f
Remove the xfatest command
The XFA development work has been completed, with mostly regular
maintance/bugfixing remaining, so while this special-casing for the
tests made sense at the time we should now be able to remove it (see also
https://github.com/mozilla/pdf.js/issues/11851#issuecomment-2419790237).
2026-03-20 20:17:13 +01:00
Tim van der Meij
ab228da9ce
Merge pull request #20931 from Snuffleupagus/rm-factory-name-validation
Remove explicit `name`/`filename` validation in the `BaseCMapReaderFactory`, `BaseStandardFontDataFactory`, and `BaseWasmFactory` classes
2026-03-20 20:15:23 +01:00
Tim van der Meij
0dd1556f47
Merge pull request #20880 from timvandermeij/disable-reorder-test
Skip the "should reorder thumbnails after dropping two adjacent pages" integration test
2026-03-20 20:13:36 +01:00
calixteman
977e4f2c4a
Merge pull request #20928 from calixteman/pass_global_signal_text_layer
Pass the global signal the text layer builder in order to remove all the listeners defined here
2026-03-20 18:36:25 +01:00
calixteman
5a240f7802
Merge pull request #20932 from calixteman/bug2023150
Trigger the current find after a page has been moved (bug 2023150)
2026-03-20 18:07:24 +01:00
Calixte Denizet
e1f02be670
Pass the global signal the text layer builder in order to remove all the listeners defined here
The goal of this patch is to remove the noice we've in the logs:
```
 0:09.36 INFO Console message: [JavaScript Warning: "Script terminated by timeout at:
reset@resource://pdf.js/web/viewer.mjs:11773:7
EventListener.handleEvent*#enableGlobalSelectionListener@resource://pdf.js/web/viewer.mjs:11787:12
render@resource://pdf.js/web/viewer.mjs:11716:20
async*#renderTextLayer@resource://pdf.js/web/viewer.mjs:12108:28
draw/resultPromise<@resource://pdf.js/web/viewer.mjs:12575:53
promise callback*draw@resource://pdf.js/web/viewer.mjs:12570:8
renderView@resource://pdf.js/web/viewer.mjs:7872:14
forceRendering/<@resource://pdf.js/web/viewer.mjs:13963:29
" {file: "resource://pdf.js/web/viewer.mjs" line: 11773}]
```
2026-03-20 18:06:39 +01:00
calixteman
5bdeb79b09
Merge pull request #20926 from calixteman/bug2022516
Correctly focus the pasted page (bug 2022516)
2026-03-20 17:47:02 +01:00
calixteman
dabb2b960d
Merge pull request #20927 from Snuffleupagus/Firefox-enforce-worker-binary-fetch
[Firefox] Ensure that worker-thread fetching is used for built-in CMap, standard font, and wasm data
2026-03-20 17:45:43 +01:00
calixteman
2c5812006a
Merge pull request #20929 from calixteman/bug2022481
Add the basic telemetry for Organize feature (bug 2022481)
2026-03-20 17:44:19 +01:00
Jonas Jenwald
652822bef0 [Firefox] Ensure that worker-thread fetching is used for built-in CMap, standard font, and wasm data
Given that we "forcibly" set `useWorkerFetch = true` for the MOZCENTRAL build-target there's a small amount of dead code as a result, which we can thus remove during building.
2026-03-20 16:58:57 +01:00
calixteman
16aee06aac
Merge pull request #20925 from calixteman/reorganize_save_annotations
Add the possibility to save added annotations when reorganizing a pdf (bug 2023086)
2026-03-20 16:32:10 +01:00
calixteman
504505b8c3
Merge pull request #20924 from calixteman/fix_null_ref
Avoid getting null value in RefSet when cloning
2026-03-20 16:31:01 +01:00
calixteman
0617e3e95f
Merge pull request #20923 from calixteman/bug2023138
Make sure the menuitems are readable when hovering them (bug 2023138)
2026-03-20 16:30:34 +01:00
Calixte Denizet
118228480b Trigger the current find after a page has been moved (bug 2023150) 2026-03-20 16:22:53 +01:00
Jonas Jenwald
5299eb2b83 Remove explicit name/filename validation in the BaseCMapReaderFactory, BaseStandardFontDataFactory, and BaseWasmFactory classes
Given that these classes are only used from the "FetchBinaryData" message handler, the `name`/`filename` parameters should never actually be missing and if they are that's a bug elsewhere in the code-base.
Furthermore a missing `name`/`filename` parameter would result in a "nonsense" URL and the actual data fetching would then fail instead, hence keeping this old validation code just doesn't seem necessary.
2026-03-20 15:50:26 +01:00
Calixte Denizet
008181a43e
Add the basic telemetry for Organize feature (bug 2022481) 2026-03-20 14:33:55 +01:00
Calixte Denizet
4aee2e8f2c Correctly focus the pasted page (bug 2022516) 2026-03-20 11:39:57 +01:00
Calixte Denizet
04272de41d
Add the possibility to save added annotations when reorganizing a pdf (bug 2023086) 2026-03-20 10:55:47 +01:00
Calixte Denizet
c17801b77e Avoid getting null value in RefSet when cloning 2026-03-20 10:41:58 +01:00
Calixte Denizet
1db3774540 Make sure the menuitems are readable when hovering them (bug 2023138)
Simplify a bit the html for the menu: remove the li elements.
Make sure the the menuitems are exposed when disabled.
2026-03-20 10:01:45 +01:00
Tim van der Meij
da1f42c03c
Skip the "should reorder thumbnails after dropping two adjacent pages" integration test
This is a temporary measure to reduce noise until #20814 is fixed.
2026-03-19 21:48:33 +01:00
Tim van der Meij
ff1af5a058
Merge pull request #20916 from calixteman/fix_co
When merging pdfs, fix the CO after the fields have been cloned
2026-03-19 21:22:43 +01:00
Tim van der Meij
6245bb201c
Merge pull request #20915 from calixteman/fix_pageindice
Avoid to use a used slot when looking for a new page position
2026-03-19 21:22:32 +01:00
Tim van der Meij
8cae5d17f2
Merge pull request #20917 from calixteman/fix_dup_name_dest
Fix the destination names when they're duplicated
2026-03-19 21:22:19 +01:00
Tim van der Meij
746e6b419d
Merge pull request #20901 from Snuffleupagus/Dict-private-map
Convert the internal `Map` to a properly private field in the `Dict` class
2026-03-19 20:57:13 +01:00
Tim van der Meij
083735b40f
Merge pull request #20920 from Snuffleupagus/Jasmine-toBeInstanceOf
Use `toBeInstanceOf` consistently in the unit-tests
2026-03-19 20:54:36 +01:00
Tim van der Meij
9151b69665
Merge pull request #20922 from mozilla/dependabot/npm_and_yarn/fast-xml-parser-5.5.7
Bump fast-xml-parser from 5.5.6 to 5.5.7
2026-03-19 20:53:30 +01:00
Tim van der Meij
ed02b7313c
Merge pull request #20921 from mozilla/dependabot/npm_and_yarn/flatted-3.4.2
Bump flatted from 3.4.1 to 3.4.2
2026-03-19 20:52:57 +01:00
dependabot[bot]
281761d07d
Bump fast-xml-parser from 5.5.6 to 5.5.7
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.5.6 to 5.5.7.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.5.6...v5.5.7)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.5.7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-19 19:47:38 +00:00
dependabot[bot]
9cf2718a69
Bump flatted from 3.4.1 to 3.4.2
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.4.1 to 3.4.2.
- [Commits](https://github.com/WebReflection/flatted/compare/v3.4.1...v3.4.2)

---
updated-dependencies:
- dependency-name: flatted
  dependency-version: 3.4.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-19 19:44:37 +00:00
Tim van der Meij
cdb476b3ab
Merge pull request #20908 from mozilla/dependabot/npm_and_yarn/fast-xml-parser-5.5.6
Bump fast-xml-parser from 5.5.5 to 5.5.6
2026-03-19 20:43:23 +01:00
Jonas Jenwald
7609a42209 Use toBeInstanceOf consistently in the unit-tests
There's currently a lot of unit-tests that manually check `instanceof`, let's replace that with the built-in Jasmine matcher function; see https://jasmine.github.io/api/edge/matchers.html#toBeInstanceOf
2026-03-19 17:18:25 +01:00
Calixte Denizet
cf67c1ef1e
Fix the destination names when they're duplicated 2026-03-19 10:52:39 +01:00
Calixte Denizet
b7da4b80a9
When merging pdfs, fix the CO after the fields have been cloned 2026-03-19 10:09:40 +01:00
Calixte Denizet
0bee641fed
Avoid to use a used slot when looking for a new page position 2026-03-19 09:40:16 +01:00
Jonas Jenwald
e52f2d1d67 Convert the internal Map to a properly private field in the Dict class 2026-03-19 09:36:29 +01:00
Jonas Jenwald
6c6bb19324 Use proper access methods in Dict.merge, rather than modifying the _map field manually 2026-03-19 09:36:29 +01:00
calixteman
bda7456724
Merge pull request #20892 from Snuffleupagus/Dict-get-helper
Reduce duplication in the `Dict.prototype.{get, getAsync, getArray}` methods
2026-03-18 21:40:30 +01:00
calixteman
a98449510c
Merge pull request #20913 from calixteman/new_badge
Add a new badge close to the Manage button in the sidebar.
2026-03-18 21:38:47 +01:00
calixteman
e65d643af5
Merge pull request #20907 from calixteman/fix_bad_bugs
Fix various bug around copy/paste/delete/undo (bug 2022586, bug 2022824, bug 2022884, bug 2023171, bug 2023176)
2026-03-18 21:38:15 +01:00
Calixte Denizet
85d88e59f3
Add a new badge close to the Manage button in the sidebar. 2026-03-18 21:05:00 +01:00
Jonas Jenwald
8f8bd6a0bc
Merge pull request #20909 from Snuffleupagus/getDocument-check-data
Ensure that `getDocument` is called with one of the `data`, `range`, or `url` parameters provided
2026-03-18 18:29:56 +01:00
calixteman
c545df4215
Merge pull request #20912 from calixteman/fix_zizmor_failures
Fix the error in gh actions found by zizmor
2026-03-18 17:56:11 +01:00
Calixte Denizet
b6634dddd8 Fix the error in gh actions found by zizmor
To install zizmor: https://docs.zizmor.sh/installation/
and just run `zizmor .`
2026-03-18 17:42:12 +01:00
Jonas Jenwald
b1172bbede
Merge pull request #20911 from Snuffleupagus/CompiledFont-fix-NOOP
Change the `NOOP` fallback, in `CompiledFont`, to return a TypedArray
2026-03-18 15:28:33 +01:00
Jonas Jenwald
4b1f64f914 Change the NOOP fallback, in CompiledFont, to return a TypedArray
In PR 20367 the `CompiledFont.prototype.getPathJs` method was changed to return TypedArray data, however the `NOOP` fallback was (likely accidentally) left an empty string.
The compilation of font-paths in PR 20346 was then implemented such that an empty string just happened to be ignored silently, however the assert added in PR 20894 allowed me to spot this return value inconsistency.

*Please note:* Since this only applies to missing or broken glyphs, that wouldn't be rendered anyway, this doesn't show up in reference tests.
2026-03-18 14:01:51 +01:00
calixteman
a398a55ac0
Merge pull request #20910 from calixteman/bug2024156
Fix the outline of the deselect button in the sidebar (bug 2024156)
2026-03-18 13:58:58 +01:00
Calixte Denizet
75cb69eef2
Fix various bug around copy/paste/delete/undo (bug 2022586, bug 2022824, bug 2022884, bug 2023171, bug 2023176)
Those bugs are more or less related so it's why they're all fixed together in the same patch.
2026-03-18 13:57:20 +01:00
Calixte Denizet
bab17136ed Fix the outline of the deselect button in the sidebar (bug 2024156)
I noticed a typo in class name (hiddden for hidden) and I found few others I fixed.
2026-03-18 12:53:48 +01:00
calixteman
979d9c3091
Merge pull request #20895 from calixteman/issue20893
Fix the position of 'Attachments' in the sidebar
2026-03-18 11:24:22 +01:00
calixteman
d224bec9e2
Merge pull request #20852 from calixteman/bug2019550
Allow to collapse/expand all the outlines in double clicking somewhere on the header bar (bug 2019550)
2026-03-18 11:20:42 +01:00
Jonas Jenwald
f4aadea001 Reduce duplication in the Dict.prototype.{get, getAsync, getArray} methods
These methods are all very similar, so let's introduce a private helper method to reduce unnecessary code duplication.
2026-03-18 11:15:23 +01:00
Jonas Jenwald
bdc16f8999
Merge pull request #20868 from Snuffleupagus/exportData-compileFontInfo
Move the `compileFontInfo` call into the `Font.prototype.exportData` method (PR 20197 follow-up)
2026-03-18 11:14:46 +01:00
Jonas Jenwald
1cd7e481ce Ensure that getDocument is called with one of the data, range, or url parameters provided
Providing one of these parameters is necessary when calling `getDocument`, since otherwise there's nothing to actually load. However, we currently don't enforce that properly and if there's more than one of these parameters provided the behaviour isn't well defined.[1]

The new behaviour is thus, in order:
 1. Use the `data` parameter, since the PDF is already available and no additional loading is necessary.
 2. Use the `range` parameter, for custom PDF loading (e.g. the Firefox PDF Viewer).
 3. Use the `url` parameter, and have the PDF.js library load the PDF with a suitable `networkStream`.
 4. Throw an error, since there's no way to load the PDF.

---

[1] E.g. if both `data` and `range` is provided, we'd load the document directly (since it's available) and also initialize a pointless `PDFDataTransportStream` instance.
2026-03-18 11:09:46 +01:00
Calixte Denizet
96d1465aab Allow to collapse/expand all the outlines in double clicking somewhere on the header bar (bug 2019550) 2026-03-18 10:26:04 +01:00
Calixte Denizet
44f4627600 Fix the position of 'Attachments' in the sidebar
It fixes #20893.
2026-03-18 10:09:23 +01:00
dependabot[bot]
15bb5fcebb
Bump fast-xml-parser from 5.5.5 to 5.5.6
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.5.5 to 5.5.6.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.5.5...v5.5.6)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.5.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-18 02:53:38 +00:00
calixteman
0ee557cd60
Merge pull request #20905 from calixteman/reorganize_outlines
Add support for saving outlines after reorganize/merge (bug 2009574)
2026-03-17 22:33:49 +01:00
Calixte Denizet
e67892d035
Add support for saving outlines after reorganize/merge (bug 2009574) 2026-03-17 22:22:13 +01:00
Tim van der Meij
76bd6dc0dd
Merge pull request #20903 from calixteman/fix_intermittent_setCaret
Wait to have all the spans in the text layer before trying to set the caret in integration tests
2026-03-17 21:58:10 +01:00
Tim van der Meij
83f06b4cf3
Merge pull request #20897 from calixteman/empty_shading
Don't throw when a mesh shading is degenerated
2026-03-17 21:18:24 +01:00
Tim van der Meij
feea0e2f00
Merge pull request #20904 from calixteman/rm_useless_op_gettextcontent
Remove some useless operations when getting the text content
2026-03-17 20:34:51 +01:00
Tim van der Meij
18a2f60469
Merge pull request #20864 from calixteman/fix_intermittent_reorg
Try to fix few intermittents bug in reorganize_pages_spec integration tests
2026-03-17 20:16:56 +01:00
Calixte Denizet
fd1fea5f6a
Remove some useless operations when getting the text content
The removed code has been added in #20624 and it's useless since these
operations (i.e. save/restore) are already handled in preprocessor.read.
2026-03-17 16:00:29 +01:00
Calixte Denizet
32dc2a5894 Wait to have all the spans in the text layer before trying to set the caret in integration tests 2026-03-17 15:30:57 +01:00
calixteman
1f94023d42
Merge pull request #20898 from calixteman/issue20847
Don't throw when printing with pdfBug enabled
2026-03-17 12:39:48 +01:00
calixteman
b7d71eb7f8 Don't throw when printing with pdfBug enabled
It fixes #20847.
2026-03-17 10:54:32 +01:00
calixteman
085ab36680
Don't throw when a mesh shading is degenerated
The problem of throwing an error is that it removes an operation
from drawing list which can cause a rendering issue.
2026-03-16 23:23:14 +01:00
Calixte Denizet
5493585b54
Try to fix few intermittents bug in reorganize_pages_spec integration tests 2026-03-16 22:00:42 +01:00
Tim van der Meij
394727a28c
Merge pull request #20887 from calixteman/fix_intermittent_comment_sidebar
Wait a little between each key press in the test 'must check that the comment sidebar is resizable with the keyboard'
2026-03-16 21:12:25 +01:00
Tim van der Meij
0a2c030c8b
Merge pull request #20888 from calixteman/debugger_skip_ops
Add the possibility to skip some ops in the debug view
2026-03-16 20:36:48 +01:00
Tim van der Meij
481a0cbe62
Merge pull request #20889 from calixteman/debugger_search_btns
(Debugger) Replace checkboxes in the search bar by toggle buttons
2026-03-16 20:35:17 +01:00
Tim van der Meij
109f6a9b49
Merge pull request #20890 from calixteman/debugger_mv_checkerboard
(Debugger) Don't draw the checkerboard on the canvas but add it behind
2026-03-16 20:34:15 +01:00
Tim van der Meij
0e964c248a
Merge pull request #20894 from Snuffleupagus/compileFontPathInfo-slice
Simplify compilation of font paths (PR 20346 follow-up)
2026-03-16 20:32:05 +01:00
Tim van der Meij
87c1231669
Merge pull request #20896 from Snuffleupagus/CachedCanvases-Map
Re-factor the `CachedCanvases` class to use a `Map` internally
2026-03-16 20:30:36 +01:00
Jonas Jenwald
2cc53270f3 Re-factor the CachedCanvases class to use a Map internally 2026-03-16 18:59:46 +01:00
Jonas Jenwald
fa7ddbb9bc Simplify compilation of font paths (PR 20346 follow-up)
Given that `CompiledFont.prototype.getPathJs` already returns data in the desired TypedArray format, we should be able to directly copy the font-path data which helps shorten the code a little bit (rather than the "manual" handling in PR 20346).

To ensure that this keeps working as expected, a non-production `assert` is added to prevent any future surprises.
2026-03-16 14:51:36 +01:00
Jonas Jenwald
7d963ddc7c Move the compileFontInfo call into the Font.prototype.exportData method (PR 20197 follow-up)
After the changes in PR 20197 the code in the `TranslatedFont.prototype.send` method is not all that readable[1] given how it handles e.g. the `charProcOperatorList` data used with Type3 fonts.
Since this is the only spot where `Font.prototype.exportData` is used, it seems much simpler to move the `compileFontInfo` call there and *directly* return the intended data rather than messing with it after the fact.

Finally, while it doesn't really matter, the patch flips the order of the `charProcOperatorList` and `extra` properties throughout the code-base since the former is used with Type3 fonts while the latter (effectively) requires that debugging is enabled.

---

[1] I had to re-read it twice, also looking at all the involved methods, in order to convince myself that it's actually correct.
2026-03-16 09:29:17 +01:00
calixteman
fc286aac4e
(Debugger) Don't draw the checkerboard on the canvas but add it behind 2026-03-15 23:20:18 +01:00
calixteman
c7837580b9
(Debugger) Replace checkboxes in the search bar by toggle buttons 2026-03-15 22:46:13 +01:00
Jonas Jenwald
d38cddf2b6
Merge pull request #20869 from Snuffleupagus/FontFaceObject-rm-bbox-setter
Remove the unused `bbox` setter in the `FontFaceObject` class (PR 20427 follow-up)
2026-03-15 22:46:12 +01:00
calixteman
e85c30e08a
Add the possibility to skip some ops in the debug view
The user has to click in the space before an op to add a breakpoint
and click again in order to skip it.
2026-03-15 22:25:45 +01:00
calixteman
3ff52e415f
Merge pull request #20862 from calixteman/bug2023106
Check for having Ref before adding them in a RefSet (bug 2023106)
2026-03-15 22:15:58 +01:00
Calixte Denizet
0fca64f01e
Check for having Ref before adding them in a RefSet (bug 2023106) 2026-03-15 22:03:39 +01:00
Calixte Denizet
2ac42392f0 Wait a little between each key press in the test 'must check that the comment sidebar is resizable with the keyboard' 2026-03-15 21:55:38 +01:00
Jonas Jenwald
f1e1973e6f Remove the unused bbox setter in the FontFaceObject class (PR 20427 follow-up)
The commit message for the patch in PR 20427 is pretty non-descriptive, being only a single line, however there's a bit more context in https://github.com/mozilla/pdf.js/pull/20427#issue-3597370951 but unfortunately the details there don't really make sense.
Note that the PR only changed main-thread code, but all the links are to worker-thread code!?

The `FontFaceObject` class is only used on the main-thread, and when encountering a broken font we fallback to the built-in font renderer; see 820b70eb25/src/display/font_loader.js (L135-L143)
Hence the `FontFaceObject` class *only* needs a way to set the `disableFontFace` property, however nowhere on the main-thread do we ever update the `bbox` of a font.
2026-03-15 21:16:18 +01:00
Tim van der Meij
1192e5e921
Merge pull request #20884 from calixteman/fix_extract_text
Fix the issue in the ref test tracemonkey-extract_0_2_12
2026-03-15 20:41:00 +01:00
Tim van der Meij
c2acab55d9
Merge pull request #20765 from calixteman/update_eslint
Update eslint to version 10
2026-03-15 20:26:09 +01:00
Tim van der Meij
1b88960ead
Merge pull request #20883 from Snuffleupagus/PatternInfo-pointBoundingBox
Use the `Util.pointBoundingBox` helper in the `PatternInfo` class (PR 20340 follow-up)
2026-03-15 19:46:58 +01:00
Tim van der Meij
665a631bdc
Merge pull request #20879 from Snuffleupagus/increase-MAX_SCALE
Increase the maximum viewer scale to 2500 percent
2026-03-15 19:46:36 +01:00
Tim van der Meij
6ca9389d25
Merge pull request #20878 from timvandermeij/exit-code
Use a non-zero exit code if the tests failed
2026-03-15 19:44:18 +01:00
calixteman
d5ac981d62
Update eslint to version 10
Unfortunately, eslint-plugin-import depends on eslint 9. This plugin doesn't seem to be
actively maintained (lot of open issues and PRs).
Fortunately there's a fork of the plugin that doesn't support eslint 10 yet but is actively maintained.
So this PR changes the eslint version to 10 and replaces eslint-plugin-import with eslint-plugin-import-x.
2026-03-15 19:36:54 +01:00
Calixte Denizet
dde0beafc6
Fix the issue in the ref test tracemonkey-extract_0_2_12
When getting the extracted document, the url for the wasms wasn't passed
and consequently the icc-based color wasn't rendered as expected because of the wasm for qcms.
2026-03-15 19:26:24 +01:00
Tim van der Meij
f49877ae95
Merge pull request #20877 from timvandermeij/updates
Update dependencies to the most recent versions
2026-03-15 19:07:04 +01:00
Jonas Jenwald
d0ee35470b Use the Util.pointBoundingBox helper in the PatternInfo class (PR 20340 follow-up)
Rather than computing the `bounds` manually, as done in PR 20340, we can shorten/simplify the code by using an existing helper instead.
2026-03-15 18:26:15 +01:00
Jonas Jenwald
e05df11e98 Increase the maximum viewer scale to 2500 percent
After PR 19128 huge zoom levels should no longer be an issue, so let's increase the maximum viewer scale a bit.
2026-03-15 15:45:34 +01:00
Tim van der Meij
c798f88bdb
Use a non-zero exit code if the tests failed
The bots currently detect if the tests failed or not by checking the
output text, but this is error-prone as it would break if the text gets
changed (which is rather unexpected) and it's non-standard as usually
processes report success/failure via their exit code.

This commit makes sure that the test process fails with a non-zero exit
code if the tests failed, and a zero exit code otherwise. Note that we
keep the same output text as before, so this change should not impact
the bots, but it does form another step to unlock usage in GitHub
Actions (which uses the exit code of commands to determine the status of
the workflow run).
2026-03-15 15:13:56 +01:00
Tim van der Meij
534a199d18
Fix vulnerability in the flatted dependency
This patch is generated with `npm audit fix` and fixes CVE-2026-32141.
2026-03-15 14:54:11 +01:00
Tim van der Meij
b7ebd80db8
Update dependencies to the most recent versions 2026-03-15 14:53:11 +01:00
Tim van der Meij
3127492a38
Merge pull request #20875 from Snuffleupagus/version-5.6
Bump library version to `5.6`
2026-03-15 14:36:01 +01:00
calixteman
a3a205d69b
Merge pull request #20871 from calixteman/refactor_debugger
Split the new debugger into multiple files
2026-03-15 14:29:13 +01:00
Jonas Jenwald
f54c0b1619 Bump library version to 5.6 2026-03-15 14:03:10 +01:00
calixteman
7bac644731
Split the new debugger into multiple files
Instead of having all the code for the new debugger in a single file,
split it into multiple files.
This makes it easier to navigate and maintain the codebase.
It'll be make hacking and fixing bugs in the debugger easier.
2026-03-15 13:21:26 +01:00
Tim van der Meij
315491dd32
Merge pull request #20840 from Snuffleupagus/getDocument-rm-length
[api-minor] Remove the `length` parameter from `getDocument`
2026-03-15 11:48:02 +01:00
Tim van der Meij
b5c55002ef
Merge pull request #20870 from mozilla/dependabot/npm_and_yarn/undici-7.24.2
Bump undici from 7.21.0 to 7.24.2
2026-03-15 11:44:42 +01:00
calixteman
8f7a615455
Merge pull request #20860 from calixteman/radial_gradients
Fix the rendering of the radial gradient when a center is outside of the other circle and there's no extend
2026-03-14 16:07:39 +01:00
dependabot[bot]
85fe14ac94
Bump undici from 7.21.0 to 7.24.2
Bumps [undici](https://github.com/nodejs/undici) from 7.21.0 to 7.24.2.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v7.21.0...v7.24.2)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 7.24.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-14 10:34:32 +00:00
Jonas Jenwald
09a9a7bd0b [api-minor] Remove the length parameter from getDocument
This is an old API-parameter that is now unused within the PDF.js project itself, and its description says that it's (partly) being used for "range requests operations".
Note that the `length` API-parameter is used to set the *initial* `contentLength` in various `BasePDFStreamReader` implementations, however it's always overridden by the "Content-Length" header (sent by the server) when that one exists *and* is a valid number. While we currently fallback to the keep the initial `contentLength` otherwise, note however how in that case range requests will always be *disabled* and thus the only spot in the code-base [where `fullReader.contentLength` is necessary](873378b718/src/core/worker.js (L230-L236)) cannot actually be reached.

Hence the only possible reason to use the `length` API-parameter would be for improved progress reporting[1] during streaming of PDF data in rare cases where the "Content-Length" header is missing/invalid, but the user *somehow* has information from another source about the correct `length` of the PDF document.
That situation feels very much like an edge-case, but it's obviously impossible to know if someone is depending on it. However, please note that there's a work-around available for users affected by this removal:
 - Implement a `PDFDataRangeTransport` instance together with custom data-fetching[2], since in that case its `length`-parameter will always be used as-is.

Finally, updates various `BasePDFStreamReader` implementations to only set the `_isRangeSupported` field once the headers are available (since previously we'd just overwrite the "initial" value anyway).

---

[1] I.e. to avoid the "indeterminate" loadingBar being displayed in the viewer.

[2] This is what e.g. the Firefox PDF Viewer uses.
2026-03-13 23:42:45 +01:00
Tim van der Meij
820b70eb25
Merge pull request #20858 from calixteman/move_save_as_to_export_selected
Move 'Save as...' menu to 'Export selected...'
2026-03-13 22:04:12 +01:00
Tim van der Meij
94b7f8f998
Merge pull request #20863 from calixteman/fix_intermittent_undo_bar
Only focus the undo bar when the focus isn't inside
2026-03-13 22:03:45 +01:00
Tim van der Meij
23926ee948
Merge pull request #20861 from Snuffleupagus/split-obj-bin-transform
Split the `src/shared/obj-bin-transform.js` file into separate files for the main/worker threads (PR 20197 follow-up)
2026-03-13 21:07:50 +01:00
Tim van der Meij
f4c6fff759
Merge pull request #20865 from Snuffleupagus/internal-viewer-urls
Bundle the necessary files and set the correct `cMapUrl`, `iccUrl`, and `standardFontDataUrl` when building `gulp internal-viewer`
2026-03-13 21:02:30 +01:00
Jonas Jenwald
75739a173b Bundle the necessary files and set the correct cMapUrl, iccUrl, and standardFontDataUrl when building gulp internal-viewer
Without these changes none of the relevant functionality would work in the *built* internal-viewer.
2026-03-13 18:16:10 +01:00
calixteman
1d25607b9c
Move 'Save as...' menu to 'Export selected...' 2026-03-13 17:29:12 +01:00
calixteman
a7083d08ff
Merge pull request #20854 from calixteman/bug2022769
Add a button for unchecking all the checked thumbnails (bug 2022769)
2026-03-13 15:58:24 +01:00
Calixte Denizet
df4a5638d0
Add a button for unchecking all the checked thumbnails (bug 2022769) 2026-03-13 14:18:51 +01:00
calixteman
fbfccebb81
Merge pull request #20850 from calixteman/bug2021828
Don't let the user delete/cut all the pages (bug 2021828)
2026-03-13 14:06:01 +01:00
Calixte Denizet
bbf178c5ee Only focus the undo bar when the focus isn't inside
It should fix the test "must work properly when selecting undo by keyboard"
which calls focus() but it can be steal by fixed callback in setTimeout.
2026-03-13 13:53:51 +01:00
Jonas Jenwald
67f3972bf0 Add a private FontInfo helper method for reading array-data (PR 20197 follow-up)
Currently the `bbox`, `fontMatrix`, and `defaultVMetrics` getters duplicate almost the same code, which we can avoid by adding a new helper method (similar to existing ones for reading numbers and strings).

The added `assert` in the new helper method also caught a bug in how the `defaultVMetrics` length was compiled.
2026-03-13 11:21:37 +01:00
Jonas Jenwald
3842936edf Split the src/shared/obj-bin-transform.js file into separate files for the main/worker threads (PR 20197 follow-up)
On the worker-thread only the static `write` methods are actually used, and on the main-thread only class instances are being created.
Hence this, after PR 20197, leads to a bunch of dead code in both of the *built* `pdf.mjs` and `pdf.worker.js` files.

This patch reduces the size of the `gulp mozcentral` output by `21 419` bytes, i.e. `21` kilo-bytes, which I believe is way too large of a saving to not do this.
(I can't even remember the last time we managed to reduce build-size this much with a single patch.)
2026-03-13 11:21:24 +01:00
Calixte Denizet
c610f44952 Fix the rendering of the radial gradient when a center is outside of the other circle and there's no extend
It fixes #20851.
2026-03-13 10:23:58 +01:00
calixteman
b7698d617d
Merge pull request #20859 from mozilla/update-locales
l10n: Update locale files
2026-03-13 09:42:50 +01:00
github-actions[bot]
8b86f7bb16 l10n: Update locale files 2026-03-13 00:30:37 +00:00
calixteman
ea949b9a0a
Merge pull request #20845 from calixteman/new_debugger
Update the internal viewer to use a new debugger.
2026-03-12 22:41:47 +01:00
calixteman
2381ac6b16
Update the internal viewer to use a new debugger.
It has few cool features:
 - all the canvas used during the rendering can be viewed;
 - the different properties in the graphics state can be viewed;
 - the different paths can be viewed.
2026-03-12 22:38:08 +01:00
Tim van der Meij
d8a40d9372
Merge pull request #20849 from Snuffleupagus/viewer-rm-enableHWA-opts
Remove the `enableHWA` option from viewer components (PR 20016 follow-up)
2026-03-12 20:40:38 +01:00
Tim van der Meij
decbce7b9b
Merge pull request #20856 from Snuffleupagus/fix-font-clearData
Fix the `FontInfo.prototype.clearData` method to actually remove the data as intended (PR 20197 follow-up)
2026-03-12 20:39:02 +01:00
calixteman
2177c4bc00
Merge pull request #20848 from Snuffleupagus/mv-PagesMapper
Move the `PagesMapper` class into its own file
2026-03-12 18:26:33 +01:00
Jonas Jenwald
e88a5652de Fix the FontInfo.prototype.clearData method to actually remove the data as intended (PR 20197 follow-up)
The purpose of PR 11844 was to reduce memory usage once fonts have been attached to the DOM, since the font-data can be quite large in many cases.

Unfortunately the new `clearData` method added in PR 20197 doesn't actually remove *anything*, it just replaces the font-data with zeros which doesn't help when the underlying `ArrayBuffer` itself isn't modified.
The method does include a commented-out `resize` call[1], but uncommenting that just breaks rendering completely.

To address this regression, without having to make large or possibly complex changes, this patch simply changes the `clearData` method to replace the internal buffer/view with its contents *before* the font-data.
While this does lead to a data copy, the size of this data is usually orders of magnitude smaller than the font-data that we're removing.

---

[1] Slightly off-topic, but I don't think that patches should include commented-out code since there's a very real risk that those things never get found/fixed.
At the very least such cases should be clearly marked with `// TODO: ...` comments, and should possibly also have an issue filed about fixing the TODO.
2026-03-12 18:15:42 +01:00
Calixte Denizet
1291f5a32b
Don't let the user delete/cut all the pages (bug 2021828)
And dispatch an event only when the context menu is displayed.
2026-03-11 17:23:56 +01:00
Jonas Jenwald
63b4874b39 Remove the enableHWA option from viewer components (PR 20016 follow-up)
In PR 20016 the actual uses of the `enableHWA` option was removed from the viewer, but for some reason it's still being provided when initializing `PDFViewer` and `PDFThumbnailViewer` despite the fact that it's now dead code.
2026-03-11 15:28:43 +01:00
Jonas Jenwald
9aa1ce8f14 Move the PagesMapper class into its own file
The `PagesMapper` class currently makes up one third of the `src/display/display_utils.js` file size, and since its introduction it's grown (a fair bit) in size.
Note that the intention with files such as `src/display/display_utils.js` was to have somewhere to place functionality too small/simple to deserve its own file.
2026-03-11 12:28:13 +01:00
Jonas Jenwald
79df166e06
Merge pull request #20846 from Snuffleupagus/internal-viewer-followup
A couple of small improvements of the new internal viewer
2026-03-11 12:01:11 +01:00
calixteman
9d093d9607
Merge pull request #20626 from nicolo-ribaudo/images-right-click
Add support for right-clicking on images (bug 1012805)
2026-03-11 11:45:51 +01:00
calixteman
98f7e859ac
Merge pull request #20837 from calixteman/bug2021934
Disable dragging a thumbnail when the user has to paste what they copied (bug 2021934)
2026-03-11 09:13:25 +01:00
Jonas Jenwald
60d6abdf4f A couple of small improvements of the new internal viewer
- Mention the internal viewer in the README, such that it's easier to find.

 - Implement a new `INTERNAL_VIEWER` define, such that it's easier to limit code to only the "internal-viewer" gulp target.

 - Only include the "GetRawData" message-handler when needed. Note that the `MessageHandler` [already throws](eb159abd6a/src/shared/message_handler.js (L121-L123)) for any missing handler.

 - Move the various new helper functions from `src/core/document.js` and into their own file. The reasons for doing this are:
    - That file is already quite large and complex as-is, and these helper functions are slightly orthogonal to its main functionality.
    - Babel isn't able to remove all of the new code, and by moving this into a separate file we can guarantee that no extra code ends up in e.g. Firefox.
2026-03-10 23:41:35 +01:00
Tim van der Meij
eb159abd6a
Merge pull request #20822 from mozilla/update-locales
l10n: Update locale files
2026-03-10 21:39:05 +01:00
Tim van der Meij
654190366f
Merge pull request #20828 from timvandermeij/refactor-reporter
Refactor the custom reporters for testing
2026-03-10 21:31:00 +01:00
Tim van der Meij
5fb9f12d3e
Ignore pending tests in the custom reporters
Similar to excluded tests pending tests should not count towards runs or
result in console logging because they are effectively not (fully) run.
This reduces visual noise and helps to get the tests running on GitHub
Actions where non-passed tests will count towards a non-zero exit code.
2026-03-10 20:51:08 +01:00
Tim van der Meij
8a5f6f5157
Use the status property of Jasmine's result object in the custom reporters
This improves readability of the code and makes it consistent with the
recently added check for excluded tests.
2026-03-10 20:51:08 +01:00
Tim van der Meij
9c21d7016b
Check for passed tests first in test/integration/jasmine-boot.js
This makes the order of checks consistent with the one in
`test/reporter.js` and improves safety because now any status other
than passed will be treated as a failure (also if Jasmine adds more
statuses later on).
2026-03-10 20:51:02 +01:00
Tim van der Meij
44a63549b0
Merge pull request #20831 from calixteman/internal_viewer
Add a new internal viewer to explore the structure of PDF files.
2026-03-10 20:48:40 +01:00
Tim van der Meij
15e58f3912
Merge pull request #20830 from Snuffleupagus/validateRangeRequestCapabilities-fix-tests
Improve the `validateRangeRequestCapabilities` unit-tests
2026-03-10 20:23:14 +01:00
Tim van der Meij
bf20d3c7e8
Merge pull request #20838 from calixteman/bug2021886
Avoid to have a thumbnail with two paste buttons (bug 2021886)
2026-03-10 20:21:34 +01:00
Tim van der Meij
99dcb88dac
Merge pull request #20834 from calixteman/update_context_menu
Update the context menu after copying thumbnails
2026-03-10 20:15:51 +01:00
Tim van der Meij
3f75c4e511
Merge pull request #20829 from Snuffleupagus/Blob-bytes
Start using `Blob.prototype.bytes()` in the code-base
2026-03-10 20:14:49 +01:00
Tim van der Meij
0dce6f40d2
Merge pull request #20839 from calixteman/bug2020698
Fix the border & background colors of the placeholder for a dragged thumbnail (bug 2020698)
2026-03-10 20:14:05 +01:00
Tim van der Meij
27db42d6bc
Merge pull request #20841 from Snuffleupagus/misc-improvements
A couple of small improvements
2026-03-10 20:06:35 +01:00
Jonas Jenwald
51cde824ec
Merge pull request #20844 from nicolo-ribaudo/fix-lint-licenses-windows
Fix `lint-licenses` task on windows
2026-03-10 18:05:58 +01:00
Nicolò Ribaudo
f11d12dcc2
Fix lint-licenses task on windows 2026-03-10 17:49:52 +01:00
Jonas Jenwald
e6f32f2d3b Remove the "check_l10n.mjs" entry from the ESLint config
Linting works fine with this removed, since there's apparently no top-level file with that name.
2026-03-10 16:02:27 +01:00
Jonas Jenwald
bfa2753f3c Remove the "abort" listener, on the globalAbortSignal, in the web/sidebar.js file
This is consistent with a bunch of other viewer code, since an `AbortSignal` can only be aborted once any "abort" listeners can thus be removed when invoked.
2026-03-10 15:51:10 +01:00
Jonas Jenwald
5ef582fb20 Use optional chaining a little bit more in the src/display/api.js file
That format is preferred where possible, since it leads to ever so slightly shorter code overall.
2026-03-10 15:51:05 +01:00
Nicolò Ribaudo
4f7a025e21
Separate bbox tracking from dependencies tracking
When recording bboxes for images, it's enough to record their
clip box / bounding box without needing to run the full bbox
tracking of the image's dependencies.
2026-03-10 14:51:03 +01:00
Nicolò Ribaudo
886c90d1a5
Add support for right-clicking on images
This patch adds right-click support for images in the PDF, allowing
users to download them. To minimize memory consumption, we:
- Do not store the images separately, and instead crop them out of the
  PDF page canvas
- Only extract the images when needed (i.e. when the user right-clicks
  on them), rather than eagery having all of them available.

To do so, we layer one empty 0x0 canvas per image, stretched to cover
the whole image, and only populate its contents on right click.
These images need to be inside the text layer: they cannot be _behind_
it, otherwise they would be covered by the text layer's container and
not be clickable, and they cannot be in front of it, otherwise they
would make the text spans unselectable.

This feature is managed by a new preference, `imagesRightClickMinSize`:
- when it's set to `-1`, right-click support is disabled
- when set to `0`, all images are available for right click
- when set to a positive integer, only images whose width and height are
  greater than or equal to that value (in the PDF page frame of
  reference) are available for right click.

This features is disabled by default outside of MOZCENTRAL, as it
significantly degrades the text selection experience in non-Firefox
browsers.
2026-03-10 14:51:03 +01:00
Calixte Denizet
ad7a415220
Fix the border & background colors of the placeholder for a dragged thumbnail (bug 2020698) 2026-03-09 20:47:39 +01:00
Jonas Jenwald
873378b718
Merge pull request #20836 from Snuffleupagus/FontFaceObject-fix-asserts
Fix the `disableFontFace` and `fontExtraProperties` asserts in the `FontFaceObject` constructor (PR 20197 follow-up)
2026-03-09 20:08:58 +01:00
Jonas Jenwald
4bae676af1
Merge pull request #20835 from Snuffleupagus/return-iterators
Use iterators a little bit more, to avoid creating temporary Arrays
2026-03-09 20:07:19 +01:00
Calixte Denizet
645ef08764
Avoid to have a thumbnail with two paste buttons (bug 2021886) 2026-03-09 19:10:12 +01:00
Calixte Denizet
7010086cd5
Disable dragging a thumbnail when the user has to paste what they copied (bug 2021934) 2026-03-09 18:10:33 +01:00
Jonas Jenwald
9f69617109 Fix the disableFontFace and fontExtraProperties asserts in the FontFaceObject constructor (PR 20197 follow-up)
In PR 19548 these checks were added to ensure that the font-data sent from the worker-thread *always* include correct `disableFontFace` and `fontExtraProperties` data.

For some reason PR 20197 then changed the code such that these checks became effectively pointless, since these properties are now checked after the fact *and* the new getters provide fallback values.
2026-03-09 18:00:11 +01:00
Jonas Jenwald
dbb6ffb8d5 Change the Font.prototype.glyphCacheValues method to return an iterator
This method is only used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through the underlying data to create a temporary `Array` that we finally iterate through at the call-site.

*Please note:* As port of these changes the chars/glyph caches, on the `Font` instances, are changed to use `Map`s rather than Objects.
2026-03-09 16:18:48 +01:00
Jonas Jenwald
8bbb7c88d3 Change the AnnotationLayer.prototype.getEditableAnnotations method to return an iterator
This method is only used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through the underlying `Map` to create a temporary `Array` that we finally iterate through at the call-site.
2026-03-09 16:11:21 +01:00
Calixte Denizet
210b859a54
Update the context menu after copying thumbnails 2026-03-09 15:36:22 +01:00
calixteman
cc680f68c3
Merge pull request #20832 from calixteman/fix_labels
Fix the label and tooltip on the paste buttons
2026-03-09 15:20:59 +01:00
calixteman
c7d1a48f5e
Merge pull request #20833 from nicolo-ribaudo/claude-ignore-eslint
Do not lint folders for project-level AI coding agents
2026-03-09 15:02:44 +01:00
Nicolò Ribaudo
e69432cd89
Do not lint folders for project-level AI coding agents 2026-03-09 14:57:54 +01:00
Calixte Denizet
18a05354fb
Fix the label and tooltip on the paste buttons 2026-03-09 14:21:15 +01:00
calixteman
9d81fafa8c
Add a new internal viewer to explore the structure of PDF files.
The one from pdf.js.utils is a bit too old: a lot of bugs have been fixed
in the code that parses PDF files since then.
It's just an internal development tool, so it doesn't need to be perfect,
but it should be good enough to be useful.
2026-03-09 14:16:12 +01:00
calixteman
d5653a1f7c
Merge pull request #20646 from nicolo-ribaudo/allow-any-host
Add option allow external connections to `npx gulp server`
2026-03-09 11:37:22 +01:00
calixteman
4ef5ea9681
Merge pull request #20810 from calixteman/bug2010832
Add a UI to undo cut/delete and cancel a copy (bug 2021352, bug 2010832)
2026-03-09 11:36:37 +01:00
Nicolò Ribaudo
384f1af067
Add --host option npx gulp server
Using `0.0.0.0` instead of `localhost` allows connecting from other
devices, significantly simplifying testing on mobile devices.

This is controlled by the `--host` CLI flag and not enabled by
default, since allowing external connections comes with security
implications (e.g. when on a public network without a properly
configured firewall).

There might be reasons to want to listen on custom hostnames, but as
the most common usage will probably be `--host 0.0.0.0`, there is a
shorter alias `--host 0` for it.
2026-03-09 11:03:20 +01:00
Calixte Denizet
0e48c16c3c
Add a UI to undo cut/delete and cancel a copy (bug 2021352, bug 2010832)
This happens in a bar on top of the thumbnails sidebar.
The label depending on the selected thumbnails is fixed.
2026-03-09 10:44:11 +01:00
Jonas Jenwald
a1b769caea Improve the validateRangeRequestCapabilities unit-tests
A number of these unit-tests didn't actually cover the intended code-paths, since many of them *accidentally* matched the "file size is smaller than two range requests"-check.

The patch also updates `validateRangeRequestCapabilities` to use return-value names that are consistent with the class fields used in the various stream implementations.
2026-03-08 18:28:50 +01:00
Jonas Jenwald
2598b0dcdd Start using Blob.prototype.bytes() in the code-base
Note that this isn't motivated by the miniscule reduction in code-size, but rather by wanting to unblock using this newer feature; see https://developer.mozilla.org/en-US/docs/Web/API/Blob/bytes
2026-03-08 14:06:03 +01:00
Tim van der Meij
46f4bc805e
Merge pull request #20826 from calixteman/outline_se
Handle outline with Structure Element (SE) destination
2026-03-08 13:16:11 +01:00
calixteman
253ce6e323
Handle outline with Structure Element (SE) destination 2026-03-08 12:28:24 +01:00
Tim van der Meij
2ffd2e65dd
Merge pull request #20827 from Snuffleupagus/worker-DocProgress-contentLength
Ensure that `percent === NaN` is consistently reported by the `onProgress` callback
2026-03-08 10:58:29 +01:00
Tim van der Meij
43fd680f6a
Merge pull request #20825 from timvandermeij/updates
Update dependencies to the most recent versions
2026-03-08 10:56:33 +01:00
Jonas Jenwald
ddd69ce4e0 Remove the "DocProgress" loaded fallback from the getPdfManager function
Falling back to use the `loaded` byteLength if the server `contentLength` is unknown doesn't make a lot of sense, since it'd lead to the `onProgress` callback reporting `percent === 100` repeatedly while the document is loading despite that being obviously wrong.
Instead we'll now report `percent === NaN` in that case, thus showing the indeterminate progressBar, which seems more correct if the `contentLength` is unknown.

Please note that this code-path is normally not even reached, since streaming is enabled by default (applies e.g. to the Firefox PDF Viewer).
2026-03-08 10:22:01 +01:00
Jonas Jenwald
1f69cf964c Ensure that percent === NaN is consistently reported by the onProgress callback
With these changes `0`, `NaN`, `null`, and `undefined` in the `total`-property all result in `percent === NaN` being reported by the callback, since previously e.g. `0` would result in `percent === 100` being reported unconditionally which doesn't make a lot of sense.

Also, remove the "indeterminate" loadingBar (in the viewer) if the `PDFDocumentLoadingTask` fails since there won't be any more data arriving and displaying the animation thus seems wrong.
2026-03-08 10:21:55 +01:00
Tim van der Meij
98dc351cfa
Merge pull request #20824 from calixteman/bug2015853
Add the possibility to merge/update acroforms when merging/extracting (bug 2015853)
2026-03-07 20:12:02 +01:00
calixteman
baf8647b1f
Add the possibility to merge/update acroforms when merging/extracting (bug 2015853) 2026-03-07 19:03:02 +01:00
Tim van der Meij
c7d345db76
Fix vulnerability in the underscore dependency
This patch is generated with `npm audit fix` and fixes CVE-2026-27601.
2026-03-07 19:02:23 +01:00
Tim van der Meij
57a8028ee2
Update dependencies to the most recent versions 2026-03-07 19:00:26 +01:00
Tim van der Meij
897e53838d
Merge pull request #20823 from Snuffleupagus/Response-bytes-more
Use `Response.prototype.bytes()` more in the code-base (PR 20651 follow-up)
2026-03-07 18:40:00 +01:00
Jonas Jenwald
0c514b008b Use Response.prototype.bytes() more in the code-base (PR 20651 follow-up) 2026-03-07 15:50:36 +01:00
Jonas Jenwald
aaf9b3bad0
Merge pull request #20821 from Snuffleupagus/scripting-sumPrecise-upsert
Use `Math.sumPrecise` and `Map.prototype.getOrInsertComputed` in the scripting implementation
2026-03-07 14:09:23 +01:00
github-actions[bot]
1b8878d2d8 l10n: Update locale files 2026-03-07 12:46:58 +00:00
Jonas Jenwald
49e8240c19 Use Map.prototype.getOrInsertComputed in the scripting implementation
This adds a basic non-MOZCENTRAL polyfill for now, which we should be able to remove once the next QuickJS version is released; note the pending changelog at f1139494d1/Changelog (L7)
2026-03-07 13:19:40 +01:00
Jonas Jenwald
ca428aadae Use Math.sumPrecise in the scripting implementation
This adds a *very basic* non-MOZCENTRAL polyfill for now, which we should be able to remove once the next QuickJS version is released; note the pending changelog at f1139494d1/Changelog (L8)
2026-03-07 13:19:40 +01:00
Tim van der Meij
d34a15e03f
Merge pull request #20662 from Snuffleupagus/getPdfManager-async-read
Convert the data reading in `getPdfManager` to be asynchronous
2026-03-07 13:16:22 +01:00
Tim van der Meij
d08e90b051
Merge pull request #20819 from calixteman/avoid_stuck_actions
Avoid to have stuck actions when running update_locales task
2026-03-07 13:11:08 +01:00
Tim van der Meij
a3a13f6041
Merge pull request #20820 from Snuffleupagus/createActionsMap-shorten
Shorten the `createActionsMap` helper in the `src/scripting_api/common.js` file
2026-03-07 13:09:16 +01:00
Jonas Jenwald
d236b517fe Shorten the createActionsMap helper in the src/scripting_api/common.js file 2026-03-07 11:22:21 +01:00
Jonas Jenwald
d9b81b5199
Merge pull request #20818 from Snuffleupagus/JBig2-fixes
A couple of small JBig2 fixes
2026-03-06 16:04:03 +01:00
calixteman
99f1109d67
Merge pull request #20815 from mozilla/update-locales
l10n: Update locale files
2026-03-06 15:04:43 +01:00
calixteman
d618a2bc7e
Avoid to have stuck actions when running update_locales task
The task update_locales is using the GITHUB_TOKEN to push the changes to
the update-locales branch, but this token doesn't trigger other workflows (see [1]),
so we need to explicitly dispatch the required ones.

[1] https://github.com/orgs/community/discussions/26970#discussioncomment-3254152
2026-03-06 14:51:45 +01:00
Jonas Jenwald
efa13c5e2a Don't duplicate the Jbig2Error exception
Let `src/core/jbig2_ccittFax_wasm.js` import the existing exception, rather than duplicate its code.
2026-03-06 12:04:08 +01:00
Jonas Jenwald
29362e6afb Remove the JBig2CCITTFaxWasmImage instance when running clean-up
This follows the same pattern as the existing handling for the `JpxImage` instance.
2026-03-06 12:04:03 +01:00
Jonas Jenwald
7f4e29ed22 Change the "Terminate" worker-thread handler to an asynchronous function
This is a tiny bit shorter, which cannot hurt.
2026-03-06 11:24:12 +01:00
github-actions[bot]
182a2c7bad l10n: Update locale files 2026-03-06 00:35:13 +00:00
Jonas Jenwald
e8ab3cb335 Convert the data reading in getPdfManager to be asynchronous
This is not only shorter, but (in my opinion) it also simplifies the code.

*Note:* In order to keep the *five* different `BasePDFStreamReader` implementations consistent, we purposely don't re-factor the `PDFWorkerStreamReader` class to support `for await...of` iteration.
2026-03-05 22:50:26 +01:00
calixteman
a4fcd830cc
Merge pull request #20774 from calixteman/rm_gulp_sourcemaps
Remove gulp-sourcemaps dependency which is unmaintained
2026-03-05 22:49:16 +01:00
calixteman
3a80ae47f9
Merge pull request #20800 from calixteman/bug2020731
Once a page has been deleted or pasted, make sure the focus stays in the sidebar (bug 2020731)
2026-03-05 22:47:27 +01:00
Calixte Denizet
064e6a8b1c
Remove gulp-sourcemaps dependency which is unmaintained 2026-03-05 22:28:44 +01:00
Tim van der Meij
688ae9b3e5
Merge pull request #20811 from calixteman/fix_xref
Add fetch** functions in the XRefWrapper
2026-03-05 22:02:08 +01:00
Calixte Denizet
d489ad0b5b
Once a page has been deleted or pasted, make sure the focus stays in the sidebar (bug 2020731) 2026-03-05 21:52:12 +01:00
Tim van der Meij
55fe04657b
Merge pull request #20812 from calixteman/context_menu_follow_up
Fix the event name in some integration tests (follow-up of #20788)
2026-03-05 21:20:15 +01:00
Tim van der Meij
d3e04d29ac
Merge pull request #20798 from calixteman/bug2016437
Fix the position of the thumbnails on the last line (bug 2016437)
2026-03-05 21:19:39 +01:00
Tim van der Meij
01bc76e681
Merge pull request #20806 from Snuffleupagus/BinaryCMapStream-extends-Stream
Let `BinaryCMapStream` extend the `Stream` class
2026-03-05 20:43:37 +01:00
Tim van der Meij
7e48938009
Merge pull request #20799 from Snuffleupagus/readPostScriptTable-getString
Use `BaseStream.prototype.getString` in the `readPostScriptTable` function
2026-03-05 20:40:59 +01:00
Tim van der Meij
874ba23afc
Merge pull request #20802 from calixteman/rm_sidebar_resize_observer
Remove the sidebar resize observer when killing the UI
2026-03-05 20:39:28 +01:00
Tim van der Meij
f18f1ca119
Merge pull request #20778 from mozilla/dependabot/github_actions/actions/upload-artifact-7
Bump actions/upload-artifact from 6 to 7
2026-03-05 20:34:52 +01:00
Tim van der Meij
60a0e24605
Merge pull request #20792 from calixteman/bug2020758
Add some aria-labels to the paste button in order to know where the buttons are (bug 2020758)
2026-03-05 20:32:20 +01:00
Tim van der Meij
a8d1aa9db8
Merge pull request #20797 from calixteman/bug2020774
Fix few colors in the Manage menu in HCM (bug 2020774)
2026-03-05 20:29:44 +01:00
Tim van der Meij
2463f4dc73
Merge pull request #20794 from calixteman/bug2020737
Move the heading role on the sidebar label (bug 2020737)
2026-03-05 20:29:07 +01:00
Calixte Denizet
8540897e54
Fix the event name in some integration tests (follow-up of #20788) 2026-03-05 20:24:35 +01:00
Tim van der Meij
cbc0362357
Merge pull request #20787 from Snuffleupagus/improve-PdfTextExtractor
Improve and simplify the `PdfTextExtractor` implementation
2026-03-05 20:23:23 +01:00
Calixte Denizet
150c1e80c2
Add fetch** functions in the XRefWrapper
It could fail to not have them if they're used during writing.
2026-03-05 19:21:12 +01:00
calixteman
9f8f303b1f
Merge pull request #20803 from calixteman/fix_saving
Fix downloading the current pdf
2026-03-05 15:01:08 +01:00
Calixte Denizet
dd52343d58
Fix downloading the current pdf 2026-03-05 13:05:03 +01:00
Jonas Jenwald
fccee4bffd Let BinaryCMapStream extend the Stream class
Looking at the `BinaryCMapStream` implementation, it's basically a "regular" `Stream` but with added functionality for reading compressed CMap data.
Hence, by letting `BinaryCMapStream` extend `Stream`, we can remove an effectively duplicate method and simplify/shorten the code a tiny bit.
2026-03-05 11:45:29 +01:00
Calixte Denizet
1ac5dfeba8 Remove the sidebar resize observer when killing the UI 2026-03-05 09:51:35 +01:00
Jonas Jenwald
aa445877a9 Use BaseStream.prototype.getString in the readPostScriptTable function
Currently the `customNames` are read one byte at a time, in a loop, and at every iteration converted to a string.
This can be replaced with the `BaseStream.prototype.getString` method, which didn't exist back when this function was written.
2026-03-04 18:34:07 +01:00
Jonas Jenwald
4d0709c174
Merge pull request #20795 from Snuffleupagus/Dict-more-iterators
Change the `Dict.prototype.{getKeys, getRawValues}` methods to return iterators
2026-03-04 18:26:42 +01:00
Calixte Denizet
7f76a111c4
Fix the position of the thumbnails on the last line (bug 2016437)
The original issue can only be reproduce when the thumbnails are on two lines.
The fix is just a matter of computing the number of elements on the last line once we've
finished the first line.
2026-03-04 17:30:10 +01:00
calixteman
7384359a41
Merge pull request #20781 from pengkunbin/fix/chinese-font-names-gbk
Fix missing Chinese font name variants (SimFang and XiaoBiaoSong) in GBK encoding detection
2026-03-04 16:49:44 +01:00
Calixte Denizet
f9c50bb7ce
Fix few colors in the Manage menu in HCM (bug 2020774) 2026-03-04 16:47:48 +01:00
calixteman
c41be4fd88
Merge pull request #20796 from nicolo-ribaudo/fix-license-lint
Ignore directories in lint-licenses task
2026-03-04 16:29:10 +01:00
Nicolò Ribaudo
ad91f3abc8
Ignore directories in lint-licenses task
The glob pattern will include directories that have a name ending,
for example, with `.js`.
2026-03-04 16:24:28 +01:00
Jonas Jenwald
229e3642be Change the Dict.prototype.getRawValues method to return an iterator
This method is usually used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through ` Map`-values to create a temporary `Array` that we finally iterate through at the call-site.

Note that the `getRawValues` method is old code, and originally the `Dict` class stored its data in a regular `Object`, hence why the old code was written that way.
2026-03-04 16:07:49 +01:00
Jonas Jenwald
58996f21b2 Change the Dict.prototype.getKeys method to return an iterator
This method is usually used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through ` Map`-keys to create a temporary `Array` that we finally iterate through at the call-site.

Note that the `getKeys` method is old code, and originally the `Dict` class stored its data in a regular `Object`, hence why the old code was written that way.
2026-03-04 16:07:49 +01:00
Jonas Jenwald
40bd73551c
Merge pull request #20793 from Snuffleupagus/more-getRawEntries
Use the `Dict.prototype.getRawEntries` method more
2026-03-04 16:05:57 +01:00
Jonas Jenwald
2c78b745af
Merge pull request #20791 from Snuffleupagus/l10n-README
Update l10n related information in various READMEs
2026-03-04 16:04:33 +01:00
Calixte Denizet
f6401e4344
Move the heading role on the sidebar label (bug 2020737) 2026-03-04 15:25:11 +01:00
calixteman
ce5f34ba13
Merge pull request #20780 from wooorm/wooorm/dismiss-popups
Add support for dismissing comment popups with click outside
2026-03-04 15:24:29 +01:00
calixteman
72f98d4e00
Merge pull request #20788 from calixteman/organize_context_menu
Add the pages organization actions in the Firefox context menu (bug 2018138)
2026-03-04 15:20:00 +01:00
Jonas Jenwald
ece03f9960
Merge pull request #20782 from nicolo-ribaudo/license-header-lint
Add script to check license headers
2026-03-04 13:01:24 +01:00
Jonas Jenwald
50d66d7d34 Use the Dict.prototype.getRawEntries method more
This changes a number of loops currently using `Dict.prototype.{getKeys, getRaw}`, since it should be a tiny bit more efficient to use an iterator directly rather than first iterating through `Map`-keys to create a temporary `Array` that we finally iterate through at the call-site.

Note that the `getKeys` method is much older than `getRawEntries`, and originally the `Dict` class stored its data in a regular `Object`, hence why the old code was written that way.
2026-03-04 12:46:25 +01:00
Nicolò Ribaudo
2f2d5c9e27
Add script to check license headers 2026-03-04 10:40:39 +01:00
Calixte Denizet
18bafeb1c6
Add some aria-labels to the paste button in order to know where the buttons are (bug 2020758) 2026-03-04 10:32:57 +01:00
Jonas Jenwald
4ea89f49e7 Update l10n related information in various READMEs
In practice we've not accepted PRs with "manual" changes of any non `en-US` locales for many years, however some (older) README/FAQ entries can perhaps be seen as actually inviting such PRs.

Now that l10n updates are running automatically via GitHub Actions, see PR 20749, we're definitely not going to accept any "manual" translation patches so it cannot hurt to de-emphasize localization in various README files.

(Also, since all relevant Fluent files have license headers it doesn't seem meaningful to mention that in the l10n README.)
2026-03-04 09:55:09 +01:00
Calixte Denizet
d90530b86c
Add the pages organization actions in the Firefox context menu (bug 2018138) 2026-03-04 09:02:39 +01:00
calixteman
68cca32e20
Merge pull request #20785 from calixteman/extract_pages
Add a way to extract some pages from a pdf (bug 2019682)
2026-03-04 08:44:13 +01:00
calixteman
286b0cc536
Merge pull request #20789 from calixteman/fix_paste_button_layout
Fix the paste button position and add a button before the first thumbnail
2026-03-04 08:43:00 +01:00
Calixte Denizet
27aea732a2
Fix the paste button position and add a button before the first thumbnail 2026-03-03 21:46:51 +01:00
Calixte Denizet
a474e81b8a
Add a way to extract some pages from a pdf (bug 2019682)
The user has to select some pages and then click on the "Save As" menu item in the Manage menu.
If they modify the structure of the pdf (deleted, moved, copied pages), they have to use the usual
save button.
2026-03-03 21:39:13 +01:00
calixteman
ecb0f578ae
Merge pull request #20773 from calixteman/try_to_fix_intermittent
Fix intermittent issue with a unit test
2026-03-03 19:39:37 +01:00
calixteman
973add845f
Merge pull request #20779 from calixteman/fix_sidebar_css
Fix layout of thumbnails when split/merge is disabled
2026-03-03 16:19:03 +01:00
Jonas Jenwald
c70ff5a7c0 Improve and simplify the PdfTextExtractor implementation
Working on PR 20784, I couldn't help noticing that this code can be improved a little bit.

 - Only initialize `PdfTextExtractor` in development mode and MOZCENTRAL builds, since it's unused elsewhere.

 - Re-factor how `PdfTextExtractor` waits for the viewer to be available/ready, by using existing (internal) events.
   This simplifies the `PdfTextExtractor` class and removes its `setViewer` method, which improves general consistency since normally the viewer-components don't use such a method in that way (here it was effectively used as a stand-in for a `setDocument` method).

 - Finally, while slightly unrelated, rename the `#getAllTextInProgress` field in the `PDFViewer` class to `#copyAllInProgress` to clearly indicate what it's for since the `getAllText` method is used more generally now.
2026-03-03 15:51:08 +01:00
pengkunbin
ead2a6e675 Add reference tests for SimFang variant and XiaoBiaoSong fonts
Add eq tests for the two newly supported Chinese font name variants
(仿宋体 and 小标宋) to verify correct GBK encoding detection.
2026-03-03 22:46:11 +08:00
Jonas Jenwald
ae507c49b3
Merge pull request #20784 from Snuffleupagus/PdfTextExtractor-fix-intermittent
Prevent `PdfTextExtractor.prototype.extractTextContent` from failing intermittently
2026-03-03 15:10:26 +01:00
Jonas Jenwald
54a8c049fd Prevent PdfTextExtractor.prototype.extractTextContent from failing intermittently
Given that extracting all text can take a while to complete, especially in long PDF documents[1], it's technically possible for the user to "select all", copy, and finally abort copying (with the `Esc` key) while `PdfTextExtractor.prototype.extractTextContent` is still running.
If that happens the `PDFViewer.prototype.getAllText` code would be interrupted, and text-extraction would thus fail in an intermittent and (likely) hard to debug way. To avoid this we replace the current "global" interrupt handling with an optional `AbortSignal` instead.

---

[1] See e.g. `pdf.pdf` in the test-suite.
2026-03-03 11:55:33 +01:00
Titus Wormer
8b4f9048cf
Add support for dismissing comment popups with click outside
This solves [bug 1989406](https://bugzilla.mozilla.org/show_bug.cgi?id=1989406).
(“The user should be able to dismiss the in-content message displayed by clicking somewhere else in the PDF”)
There’s a good gif there that shows the problematic behavior.

In the thread, there are also mentions of 2 similar but slightly separate problems:

* clicking on another highlight should also dismiss
* the mention that hitting the escape key does not dismiss

I found the last point, the escape key, to work already (first test case here).
But this PR solves the main bug (second test case) and the adjacent one
(third test case).
It works by using the existing `unselectAll` handling.
2026-03-03 11:14:22 +01:00
jizou
0e1b5cd7bb Fix missing Chinese font name variants (SimFang and XiaoBiaoSong) in GBK encoding detection 2026-03-03 17:04:59 +08:00
Calixte Denizet
cdc1c8af40
Fix layout of thumbnails when split/merge is disabled 2026-03-02 15:16:16 +01:00
calixteman
d859d78bb5
Merge pull request #20775 from Snuffleupagus/hide-select-pages
Hide the "Select pages" label, in the thumbnails sidebar, when split-merge is disabled
2026-03-02 14:53:15 +01:00
calixteman
0c29cc5887
Merge pull request #20776 from Snuffleupagus/commentManager-l10n-getDirection
Use `L10n.prototype.getDirection` rather than querying the DOM, when initializing the `CommentManager` instance
2026-03-02 14:45:36 +01:00
calixteman
3cb32b6ab2
Merge pull request #20772 from calixteman/babel_plugin_strip_src_path
Use a babel plugin in order to strip /src/ from the import paths
2026-03-02 14:44:49 +01:00
dependabot[bot]
d939a3dedc
Bump actions/upload-artifact from 6 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-02 12:59:39 +00:00
Jonas Jenwald
0d131f0957 Use L10n.prototype.getDirection rather than querying the DOM, when initializing the CommentManager instance
Hopefully I'm not misunderstanding why it was written like that, however using an existing method should be a tiny bit more efficient than querying the DOM.
2026-03-02 11:33:34 +01:00
Jonas Jenwald
a0e70eb6aa Hide the "Select pages" label, in the thumbnails sidebar, when split-merge is disabled
Currently there's a "pointless" label displayed, thus taking up vertical space, when `enableSplitMerge = false` is set.
2026-03-02 11:19:02 +01:00
calixteman
afa8a07a2b
Merge pull request #20760 from calixteman/avoid_noise
Just output in the console the results for the integrations which ran
2026-03-02 10:15:12 +01:00
calixteman
ed390c06a1
Fix intermittent issue with a unit test
Avoid to rely on timing in the test, which can cause intermittent failures.
Instead, we check that the image is cached at the document/page level.
2026-03-01 22:59:04 +01:00
calixteman
2eb145f3f1
Use a babel plugin in order to strip /src/ from the import paths 2026-03-01 22:17:30 +01:00
Calixte Denizet
6b3331f47b
Just output in the console the results for the integrations which ran 2026-03-01 21:55:23 +01:00
Tim van der Meij
55c371d97c
Merge pull request #20771 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-03-01 21:28:56 +01:00
Tim van der Meij
4230ba19df
Bump the stable version in pdfjs.config 2026-03-01 21:25:24 +01:00
Tim van der Meij
5279646985
Merge pull request #20751 from calixteman/bug2016693
Avoid to scroll too much when the thumbnail is at the bottom of the sidebar (bug 2016693)
2026-03-01 21:14:44 +01:00
calixteman
98d0332a9f
Merge pull request #20767 from calixteman/followup_20742
Add an integration test for the issue fixed in #20742
2026-03-01 21:11:50 +01:00
calixteman
c1fe547a05
Add an integration test for the issue fixed in #20742 2026-03-01 20:55:59 +01:00
Tim van der Meij
62ceac6e97
Merge pull request #20769 from timvandermeij/updates
Update dependencies to the most recent versions
2026-03-01 20:55:40 +01:00
Tim van der Meij
3d2d145329
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`.
2026-03-01 20:44:42 +01:00
Tim van der Meij
ced9b4717f
Upgrade c8 to version 11.0.0
This is a major version bump, but the changelog at
https://github.com/bcoe/c8/releases/v11.0.0 doesn't indicate any
breaking changes that should impact us.
2026-03-01 20:43:20 +01:00
Tim van der Meij
4cb0d504b0
Update dependencies to the most recent versions 2026-03-01 20:42:19 +01:00
Tim van der Meij
5cbb8413cb
Merge pull request #20768 from calixteman/rm_yargs
Remove dependency to yargs and use node:utils parseArgs
2026-03-01 20:19:11 +01:00
Tim van der Meij
1861a4c4ad
Merge pull request #20756 from Snuffleupagus/PDFDataRangeTransport-tests
Improve the `PDFDataRangeTransport` unit-tests
2026-03-01 20:10:34 +01:00
Tim van der Meij
f32b9d2677
Merge pull request #20738 from Snuffleupagus/function-shorten
Slightly shorten some code in the `src/core/function.js` file
2026-03-01 20:06:29 +01:00
Tim van der Meij
e0ea84fdac
Merge pull request #20761 from calixteman/tweak_dims
Tweak few elements: dimensions and the checkbox color in the new sidebar
2026-03-01 20:01:07 +01:00
Tim van der Meij
9dfcc62bb9
Merge pull request #20758 from calixteman/fix_sidebar_height
Fix the page sidebar height
2026-03-01 19:58:18 +01:00
Tim van der Meij
6299bf7fd6
Merge pull request #20762 from mozilla/dependabot/npm_and_yarn/multi-f5f34deeac
Bump minimatch
2026-03-01 19:56:30 +01:00
Tim van der Meij
2bc9a59acc
Merge pull request #20766 from mozilla/dependabot/npm_and_yarn/fast-xml-parser-5.4.1
Bump fast-xml-parser from 5.3.5 to 5.4.1
2026-03-01 19:56:03 +01:00
calixteman
f57b73d881
Remove dependency to yargs and use node:utils parseArgs 2026-03-01 15:01:31 +01:00
calixteman
00d9d3a6ea
Merge pull request #20742 from Snuffleupagus/tree-viewer-scrollIntoView
Fix scrolling of outline item into view (PR 20495 follow-up)
2026-03-01 13:01:21 +01:00
dependabot[bot]
73bd5c35da
Bump fast-xml-parser from 5.3.5 to 5.4.1
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.3.5 to 5.4.1.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.3.5...v5.4.1)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.4.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 00:12:36 +00:00
dependabot[bot]
7a8571459a
Bump minimatch
Bumps  and [minimatch](https://github.com/isaacs/minimatch). These dependencies needed to be updated together.

Updates `minimatch` from 3.1.2 to 3.1.5
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.1.2...v3.1.5)

Updates `minimatch` from 9.0.5 to 9.0.9
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.1.2...v3.1.5)

Updates `minimatch` from 10.1.1 to 10.2.4
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.1.2...v3.1.5)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
- dependency-name: minimatch
  dependency-version: 9.0.9
  dependency-type: indirect
- dependency-name: minimatch
  dependency-version: 10.2.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 03:47:33 +00:00
Jonas Jenwald
86573cc995
Merge pull request #20757 from Snuffleupagus/getPdfFilenameFromUrl-fix-decode-regex
Fix the broken regular expression in the `decode` helper in the `getPdfFilenameFromUrl` function (issue 20664)
2026-02-27 23:14:18 +01:00
calixteman
b4f98e8a9b
Merge pull request #20747 from calixteman/check__l10n
Add a script for searching the unused fluent ids
2026-02-27 22:19:50 +01:00
Calixte Denizet
82fdeaaac0 Add a script for searching the unused fluent ids 2026-02-27 19:16:15 +01:00
calixteman
4dd51a20a5
Merge pull request #20736 from jrmuizel/scientific
Remove scientific notation parsing.
2026-02-27 18:51:15 +01:00
calixteman
9c3a752388
Merge branch 'master' into scientific 2026-02-27 18:39:44 +01:00
Calixte Denizet
c272cbdf5a
Tweak few elements: dimensions and the checkbox color in the new sidebar 2026-02-27 18:36:38 +01:00
calixteman
bd260b2d15
Merge pull request #20746 from calixteman/bug2019714
Fix tooltips on thumbnails and checkbox (bug 2019714)
2026-02-27 18:20:37 +01:00
Calixte Denizet
aa928105b4
Fix tooltips on thumbnails and checkbox (bug 2019714)
And fix an issue with some integration tests where the manage button was disabled (hence not in the tab cycle).
2026-02-27 17:43:27 +01:00
calixteman
45b0f8b05e
Merge pull request #20748 from calixteman/add_file_button
Make the 'add file' button not hidden but just not visible in order to fix the layout
2026-02-27 17:34:53 +01:00
calixteman
123ed241e6
Merge pull request #20750 from calixteman/pr20740_followup
Add an integration test for PR 20740
2026-02-27 17:34:20 +01:00
Calixte Denizet
2572285827 Add an integration test for PR 20740 2026-02-27 17:07:44 +01:00
Calixte Denizet
a251b99e2b
Make the 'add file' button not hidden but just not visible in order to fix the layout
The feature will be plugged later.
2026-02-27 16:53:30 +01:00
Calixte Denizet
79942b7720
Fix the page sidebar height
It has to be the viewer height but with a padding of 8px.
2026-02-27 16:13:14 +01:00
Jonas Jenwald
e3a7c0779d Fix the broken regular expression in the decode helper in the getPdfFilenameFromUrl function (issue 20664)
This will ignore filenames that become effectively empty, i.e. ones that are only ".pdf" and nothing more.

*Please note:* While this passes all existing unit-tests, I don't know if this is necessarily the "correct" solution here.
2026-02-27 15:19:43 +01:00
Jonas Jenwald
fecb0aab1d Improve the PDFDataRangeTransport unit-tests
- Add a new test using only streaming, since that was missing and the lack of which most likely contributed to previous bugs in the `PDFDataRangeTransport` implementation (see PR 10675 and 20634).

 - Improve the "ranges and streaming" test, to utilize both ranges *and* streaming properly, since the way it was written seemed somewhat unrealistic given how data will normally arrive when `PDFDataRangeTransport` is being used.

 - Provide more `initialData`, in relevant tests, since a length smaller than `rangeChunkSize` seem pretty pointless.

 - Test the `contentDispositionFilename`, and `contentLength`, handling in the `PDFDataRangeTransport` implementation.
2026-02-27 14:55:39 +01:00
Jonas Jenwald
218a687a3b
Merge pull request #20755 from Snuffleupagus/rm-unmaintained-locales
Automatically remove unmaintained locales when running `gulp importl10n`
2026-02-27 14:52:01 +01:00
Jonas Jenwald
24fe94206a Automatically remove unmaintained locales when running gulp importl10n
It's not particularly common for locales to be removed from Firefox, but it has happened occasionally in the past.
Currently the `downloadL10n` function logs a message about any unmaintained locales, but after PR 20749 that code is running in GitHub Actions (rather than locally by a contributor) which makes it much less likely for the message to be seen.
2026-02-27 10:46:57 +01:00
calixteman
e5656e4303
Merge pull request #20752 from mozilla/update-locales
l10n: Update locale files
2026-02-27 09:07:59 +01:00
Jeff Muizelaar
8fa6ef36e4 Remove scientific notation parsing.
This behaviour comes from the initial pdf.js commit but is wrong and
doesn't match other PDF readers like muPDF or pdfium.

From PDF Spec 7.3.3:

A PDF writer shall not use the PostScript language syntax for numbers with non-decimal radices (such
as 16#FFFE) or in exponential format (such as 6.02E23).
2026-02-26 20:22:34 -05:00
github-actions[bot]
a541428363 l10n: Update locale files 2026-02-27 00:31:45 +00:00
Calixte Denizet
4b7fa1c003 Avoid to scroll too much when the thumbnail is at the bottom of the sidebar (bug 2016693) 2026-02-26 22:30:13 +01:00
calixteman
e37fbcbe00
Merge pull request #20749 from calixteman/gh_action_locale
Add a gh action in order to create a PR containing a m-c l10n update
2026-02-26 22:28:15 +01:00
calixteman
aa5abda419 Add a gh action in order to create a PR containing a m-c l10n update 2026-02-26 22:13:00 +01:00
Tim van der Meij
f626a368a5
Merge pull request #20743 from calixteman/bug2010822
Tweak the background color of the sidebar (bug 2010822)
2026-02-26 22:01:50 +01:00
Tim van der Meij
52efe65f12
Merge pull request #20741 from calixteman/fix_resizer_position
Slightly move the resizer on the sidebar (bug 2019585)
2026-02-26 22:00:32 +01:00
Tim van der Meij
f05caaf5e9
Merge pull request #20731 from calixteman/remove_page_id
Remove useless page-id attribute in thumbnails
2026-02-26 21:58:36 +01:00
Tim van der Meij
dc2b4c8e9a
Merge pull request #20737 from mozilla/dependabot/npm_and_yarn/basic-ftp-5.2.0
Bump basic-ftp from 5.1.0 to 5.2.0
2026-02-26 21:51:59 +01:00
Jonas Jenwald
2bab2a87a4
Merge pull request #20745 from calixteman/issue20744
Don't check for surrogates when verifying the chars to normalize
2026-02-26 19:08:02 +01:00
calixteman
881f9779e6
Don't check for surrogates when verifying the chars to normalize 2026-02-26 16:46:34 +01:00
Calixte Denizet
b263841584
Tweak the background color of the sidebar (bug 2010822)
And tweak its position as required by UX/UI.
2026-02-26 15:39:08 +01:00
Jonas Jenwald
e89335e776 Fix scrolling of outline item into view (PR 20495 follow-up)
Clicking on the "Find Current Outline Item" button is (obviously) supposed to scroll that outline item into view, however that seems to have broken accidentally in PR 20495.
2026-02-26 14:52:20 +01:00
Jonas Jenwald
3ae6cdc7c2
Merge pull request #20740 from Snuffleupagus/tree-viewer-shift-toggle
Don't expand/collapse the entire outline when shift-clicking on the triangles (PR 20508 follow-up)
2026-02-26 14:51:08 +01:00
Calixte Denizet
241e8c18b9
Slightly move the resizer on the sidebar (bug 2019585)
And add a white border to the resizer in order to make it visible whatever the background is.
2026-02-26 14:35:13 +01:00
Jonas Jenwald
b07d14c88c Don't expand/collapse the entire outline when shift-clicking on the triangles (PR 20508 follow-up) 2026-02-26 13:00:06 +01:00
Jonas Jenwald
8ced999803 Slightly shorten some code in the src/core/function.js file 2026-02-26 10:42:56 +01:00
Jonas Jenwald
17a4d2e123
Merge pull request #20734 from Snuffleupagus/GetOperatorList-fix-transfers
Include transfers correctly in the "GetOperatorList" message (PR 16588 follow-up)
2026-02-26 09:44:16 +01:00
dependabot[bot]
77702fc916
Bump basic-ftp from 5.1.0 to 5.2.0
Bumps [basic-ftp](https://github.com/patrickjuchli/basic-ftp) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/patrickjuchli/basic-ftp/releases)
- [Changelog](https://github.com/patrickjuchli/basic-ftp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patrickjuchli/basic-ftp/compare/v5.1.0...v5.2.0)

---
updated-dependencies:
- dependency-name: basic-ftp
  dependency-version: 5.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-25 23:30:41 +00:00
Jonas Jenwald
82fc2c94f0 Include transfers correctly in the "GetOperatorList" message (PR 16588 follow-up)
Currently the transfers aren't actually being used with the "GetOperatorList" message, since the placement of the parameter is wrong; note the method signature: 909a700afa/src/shared/message_handler.js (L219-L229)
This goes back to PR 16588, which added the transfers parameter, and unfortunately we all missed that :-(

Simply fixing the parameter isn't enough however, since that broke printing of Stamp-editors (and possibly others). The solution here is to *not* transfer data during printing, given that a single `PrintAnnotationStorage` instance is being used for all pages.
2026-02-25 15:55:43 +01:00
Jonas Jenwald
3c434140ea
Merge pull request #20733 from Snuffleupagus/LZWStream-rm-lastCode
Remove unused `lastCode` property from the `LZWStream` class (PR 324 follow-up)
2026-02-25 15:20:36 +01:00
Calixte Denizet
a48118db41 Remove useless page-id attribute in thumbnails
And make sure that the sidebar is fully open before starting the tests in
order to have an intermittent exception when finishing the test.
2026-02-25 15:15:41 +01:00
Jonas Jenwald
80db3609f4 Remove unused lastCode property from the LZWStream class (PR 324 follow-up)
This appear to have been unused already in PR 324 all the way back in 2011.
2026-02-25 13:31:44 +01:00
calixteman
bc8efa190c
Merge pull request #20719 from calixteman/update_jasmine
Update Jasmine to version 6.0.0
2026-02-25 09:56:54 +01:00
Tim van der Meij
4ecbd0cbe2
Merge pull request #20726 from Snuffleupagus/getOrInsertComputed-fewer-functions
Reduce allocations and function creation when using `getOrInsert` and `getOrInsertComputed`
2026-02-24 23:32:36 +01:00
calixteman
ab7629871a
Update Jasmine to version 6.0.0
It fixes #20715.

`failedExpectations` was removed from `suiteStarted` and `specStarted` events.
HtmlReporter and HtmlSpecFilter have been deprecated and removed.
2026-02-24 23:30:48 +01:00
Tim van der Meij
b43c8eab73
Merge pull request #20725 from calixteman/bug2018162
After cut & paste, the thumbnail must be correctly rendered (bug 2018162)
2026-02-24 23:27:07 +01:00
Tim van der Meij
943810a9ca
Merge pull request #20727 from calixteman/issue20722
Reset transfer functions when entering in a new group
2026-02-24 23:22:45 +01:00
Tim van der Meij
5259abb1ed
Merge pull request #20720 from calixteman/update_json
Use @eslint/json in order to lint the json files
2026-02-24 23:08:06 +01:00
Jonas Jenwald
185fee680a Use Map.prototype.getOrInsertComputed() in the web/struct_tree_layer_builder.js file 2026-02-24 09:04:37 +01:00
Jonas Jenwald
0d4e587a5f Reduce allocations when using Map.prototype.getOrInsert() with Arrays
Change all these cases to use `Map.prototype.getOrInsertComputed()` instead, in combination with a helper function for creating the `Array`s (similar to the previous patch).
2026-02-24 09:03:32 +01:00
Jonas Jenwald
2e07715c9d Reduce function creation when using Map.prototype.getOrInsertComputed()
With the exception of the first invocation the callback function is unused, which means that a lot of pointless functions may be created.
To avoid this we introduce helper functions for simple cases, such as creating `Map`s and `Objects`s.
2026-02-24 08:58:28 +01:00
calixteman
15e7a551ab
Reset transfer functions when entering in a new group
It fixes #20722.
2026-02-23 22:37:20 +01:00
Calixte Denizet
97d973ce09
After cut & paste, the thumbnail must be correctly rendered (bug 2018162) 2026-02-23 18:38:33 +01:00
calixteman
81479fe942
Use @eslint/json in order to lint the json files 2026-02-22 23:52:54 +01:00
Jonas Jenwald
c2f5e19eb0 Use Map.prototype.getOrInsertComputed() in the src/core/xfa/ folder 2026-02-22 22:57:50 +01:00
Jonas Jenwald
909a700afa
Merge pull request #20717 from Snuffleupagus/api-getOrInsertComputed
Use `Map.prototype.getOrInsertComputed()` in the `src/display/api.js` file
2026-02-22 22:57:01 +01:00
calixteman
c91de765e0
Merge pull request #20697 from calixteman/bug2018139
Add keyboard shortcuts for copying/cutting/deleting the pages (bug 2018139, bug 2010831)
2026-02-22 22:42:31 +01:00
Calixte Denizet
63c340fa35
Add keyboard shortcuts for copying/cutting/deleting the pages (bug 2018139, bug 2010831) 2026-02-22 22:17:59 +01:00
calixteman
176e085420
Merge pull request #20712 from calixteman/issue20689
Correctly generate the NormalizeWithNFKC string in generic build
2026-02-22 21:33:57 +01:00
Jonas Jenwald
e2c8fc6140 Use Map.prototype.getOrInsertComputed() in the src/display/api.js file 2026-02-22 21:01:13 +01:00
Jonas Jenwald
7b451f6a89
Merge pull request #20716 from Snuffleupagus/src-display-getOrInsert
Use `Map.prototype.getOrInsert()` more in the `src/display/` folder
2026-02-22 21:00:38 +01:00
calixteman
fb902c16e1
Correctly generate the NormalizeWithNFKC string in generic build
It fixes #20689.
2026-02-22 19:50:42 +01:00
Jonas Jenwald
c81904ac0a Use Map.prototype.getOrInsertComputed() in the src/display/canvas.js file 2026-02-22 17:55:51 +01:00
Jonas Jenwald
ab8e67ecff Use Map.prototype.getOrInsert() in the src/display/annotation_layer.js file 2026-02-22 17:54:17 +01:00
Tim van der Meij
5bb35eeb35
Merge pull request #20711 from Snuffleupagus/editorStats-getOrInsertComputed
Use `Map.prototype.getOrInsertComputed()` in the `editorStats` getter
2026-02-22 16:02:32 +01:00
Jonas Jenwald
bfe265ad31 Use Map.prototype.getOrInsertComputed() in the editorStats getter 2026-02-22 15:10:02 +01:00
Tim van der Meij
cc516d0dd4
Merge pull request #20709 from Snuffleupagus/scripting-unconditional-FinalizationRegistry
Use `FinalizationRegistry` unconditionally in the `src/scripting_api/app.js` file
2026-02-22 14:59:03 +01:00
calixteman
1df6367ef9
Merge pull request #20710 from calixteman/normalize_path
Remove the leading slash in windows file path when instrumenting js files for ccov
2026-02-22 13:40:13 +01:00
calixteman
a8b1c8bd70
Remove the leading slash in windows file path when instrumenting js files for ccov 2026-02-22 13:32:49 +01:00
Tim van der Meij
a5a27a5ca7
Merge pull request #20705 from Snuffleupagus/#collectParents-getOrInsert
Use `Map.prototype.getOrInsert()` in the `#collectParents` method
2026-02-22 12:55:41 +01:00
Tim van der Meij
8189ca358c
Merge pull request #20703 from Snuffleupagus/#collectFieldObjects-getOrInsert
Use `Map.prototype.getOrInsert()` in the `#collectFieldObjects` method
2026-02-22 12:39:54 +01:00
Jonas Jenwald
ad0a310394
Merge pull request #20706 from Snuffleupagus/ensureDebugMetadata-getOrInsertComputed
Use `Map.prototype.getOrInsertComputed()` in the `ensureDebugMetadata` helper
2026-02-22 10:35:44 +01:00
Jonas Jenwald
e62a990ae2
Merge pull request #20704 from Snuffleupagus/getPageAdvance-getOrInsert
Use `Map.prototype.getOrInsert()` in the `_getPageAdvance` method
2026-02-22 10:32:44 +01:00
Jonas Jenwald
2631750038
Merge pull request #20702 from Snuffleupagus/getNewAnnotationsMap-getOrInsert
Use `Map.prototype.getOrInsert()` in the `getNewAnnotationsMap` helper
2026-02-22 10:29:33 +01:00
calixteman
1118050231
Merge pull request #20696 from calixteman/bug2016656
Only show the status bar in the views manager when it's in thumbnails mode (bug 2016656)
2026-02-21 23:00:54 +01:00
Jonas Jenwald
956eb10329 Use FinalizationRegistry unconditionally in the src/scripting_api/app.js file
After the QuickJS update in PR 20708 this code can now be simplified.
2026-02-21 22:37:30 +01:00
Jonas Jenwald
b798fd8771
Merge pull request #20699 from Snuffleupagus/scripting-shorter
Slightly shorten some code in the `src/scripting_api/` folder
2026-02-21 22:35:15 +01:00
calixteman
62054ae0a2
Merge pull request #20708 from calixteman/update_quickjs
Update quickjs to fa628f8c523ecac8ce560c081411e91fcaba2d20
2026-02-21 21:59:29 +01:00
calixteman
32b49e99f0
Update quickjs to fa628f8c523ecac8ce560c081411e91fcaba2d20 2026-02-21 15:34:24 +01:00
Jonas Jenwald
0d8bc689b9 Add missing license header in src/display/canvas_dependency_tracker.js 2026-02-21 13:26:20 +01:00
Jonas Jenwald
c7bdf5b508 Use Map.prototype.getOrInsertComputed() in the ensureDebugMetadata helper
Also, shorten the function by using optional chaining.
2026-02-21 12:02:45 +01:00
Jonas Jenwald
3e7ad8d6bf Use Map.prototype.getOrInsert() in the #collectParents method 2026-02-21 11:42:42 +01:00
Jonas Jenwald
3940855511 Use Map.prototype.getOrInsert() in the _getPageAdvance method
Also, change the method to an actually private one.
2026-02-21 11:31:03 +01:00
Jonas Jenwald
210c969c4c Use Map.prototype.getOrInsert() in the #collectFieldObjects method 2026-02-21 11:23:32 +01:00
Jonas Jenwald
76a5aed05f Use Map.prototype.getOrInsert() in the getNewAnnotationsMap helper 2026-02-21 11:03:00 +01:00
calixteman
f548a159d6
Merge pull request #20698 from calixteman/image_utils_test
Add some unit tests for functions in image_utils.js
2026-02-20 22:58:22 +01:00
Jonas Jenwald
350f3fa7e5 Slightly shorten some code in the src/scripting_api/ folder
- Use nullish coalescing assignment more.
 - Use ternary expressions more.
2026-02-20 22:47:22 +01:00
Calixte Denizet
0bb59f15cb
Add some unit tests for functions in image_utils.js 2026-02-20 22:43:42 +01:00
Calixte Denizet
5f9a9f58ce
Only show the status bar in the views manager when it's in thumbnails mode (bug 2016656) 2026-02-20 22:33:34 +01:00
Tim van der Meij
aaf3ad5a4e
Merge pull request #20688 from calixteman/coverage_font_test
Add code coverage for font tests
2026-02-20 22:13:57 +01:00
Tim van der Meij
e07e8ed172
Merge pull request #20690 from Snuffleupagus/getPdfFilenameFromUrl-searchParams-findLast
Reduce duplication when parsing `searchParams` in the `getPdfFilenameFromUrl` function
2026-02-20 21:42:48 +01:00
Tim van der Meij
6f0d8d561f
Merge pull request #20695 from calixteman/bug2018125
Update the page count in the UI when some changes are done (bug 2018125)
2026-02-20 21:40:16 +01:00
Tim van der Meij
82de22428a
Merge pull request #20660 from Snuffleupagus/ChunkedStream-async-sendRequest
Convert `ChunkedStreamManager.prototype.sendRequest` to an asynchronous method
2026-02-20 21:39:26 +01:00
Tim van der Meij
b2cf54353c
Merge pull request #20693 from calixteman/bug2016321
Fix the style of the thumbnails in HCM (bug 2016491, bug 2016321, bug 2016323, bug 2016827)
2026-02-20 20:44:53 +01:00
Tim van der Meij
12ec25c9a7
Merge pull request #20694 from calixteman/bug2018134
Fix the menu dimensions when on of the item is too long (bug 2018134)
2026-02-20 20:41:43 +01:00
Tim van der Meij
f395042b8d
Merge pull request #20692 from Snuffleupagus/debugger-findIndex
Replace the `getStatIndex` helper, in `web/debugger.mjs`, with native functionality
2026-02-20 20:33:00 +01:00
Tim van der Meij
e87019ec04
Merge pull request #20686 from calixteman/bug2016311
Fix the color of the arrow on buttons when hovering in HCM (bug 2016311)
2026-02-20 20:31:25 +01:00
Calixte Denizet
bd3f14f62d
Update the page count in the UI when some changes are done (bug 2018125) 2026-02-20 18:06:48 +01:00
calixteman
a5c62b7489
Merge pull request #20691 from Snuffleupagus/rm-unnecessary-Map-entries
Remove unnecessary `Map.prototype.entries()` usage
2026-02-20 17:44:19 +01:00
calixteman
970717a732
Merge pull request #20684 from Snuffleupagus/src-rm-constructors
Remove unnecessary class constructors in the `src` folder
2026-02-20 17:43:18 +01:00
calixteman
34ba2064e6
Merge pull request #20661 from timvandermeij/updates
Update dependencies and translations to the most recent versions, and upgrade most packages to new major versions
2026-02-20 17:41:58 +01:00
Calixte Denizet
bff6f4cc01
Fix the style of the thumbnails in HCM (bug 2016491, bug 2016321, bug 2016323, bug 2016827) 2026-02-20 17:30:40 +01:00
Calixte Denizet
55448fd01c
Fix the menu dimensions when on of the item is too long (bug 2018134) 2026-02-20 17:19:31 +01:00
Jonas Jenwald
06e7f308fd Replace the getStatIndex helper, in web/debugger.mjs, with native functionality
This code is old enough that it predates the existence of `Array.prototype.findIndex()`, hence why a helper function was originally needed.
2026-02-20 14:09:20 +01:00
Jonas Jenwald
374f524c29 Remove unnecessary Map.prototype.entries() usage
A `Map` instance can be iterated directly with a `for...of` loop, hence using its `entries` method is not actually necessary.
2026-02-20 13:44:00 +01:00
Jonas Jenwald
34f27187f8 Reduce duplication when parsing searchParams in the getPdfFilenameFromUrl function
Currently we essentially "duplicate" the same code for parsing the `values` and `keys` of the `searchParams`, which seems a little unnecessary.

To be able to parse the `searchParams` from the end, we currently create an Array (from the Iterator) and then reverse it before finally looping through it. Here the latter two steps can be replaced with the `Array.prototype.findLast()` method instead.

*Please note:* I completely understand if this patch is rejected, on account of being less readable than the current code.
2026-02-19 17:37:12 +01:00
Jonas Jenwald
7fd939763e Remove unnecessary class constructors in the src folder
There's a number of classes where the constructors can be removed completely by instead using class fields, which help to slightly shorten the code.

It seems that `unicorn/prefer-class-fields` ESLint plugin, see PR 20657, unfortunately isn't able to detect all of these cases.
2026-02-19 00:08:57 +01:00
Jonas Jenwald
74ab1a98a6
Merge pull request #20685 from Snuffleupagus/Annotation-set-annotationType
Set the `annotationType` automatically in the `Annotation` constructor
2026-02-19 00:03:37 +01:00
calixteman
e2af2b83c3
Add code coverage for font tests 2026-02-18 22:00:45 +01:00
Calixte Denizet
0dcc96a09d
Fix the color of the arrow on buttons when hovering in HCM (bug 2016311) 2026-02-18 20:04:44 +01:00
calixteman
30ed527a80
Merge pull request #20677 from calixteman/bug2016007
Add the possibility to navigate with the keyboard to go from a checkbox to an other in the thumbnail view (bug 2016007)
2026-02-18 19:56:09 +01:00
Calixte Denizet
0149527a4b
Add the possibility to navigate with the keyboard to go from a checkbox to an other in the thumbnail view (bug 2016007) 2026-02-18 18:35:54 +01:00
calixteman
f609ee8a0c
Merge pull request #20670 from calixteman/reorg_delete
Add support for deleting, cutting, copying and pasting pages (bug 2010830, 2010831)
2026-02-18 17:52:35 +01:00
Calixte Denizet
d755fba96a
Add support for deleting, cutting, copying and pasting pages (bug 2010830, 2010831) 2026-02-18 16:43:00 +01:00
calixteman
e331d458cb
Merge pull request #20679 from calixteman/bug2016142
Add an aria-label to the sidebar resizer (bug 2016142)
2026-02-18 16:33:53 +01:00
calixteman
6b1b94e7d4
Merge pull request #20681 from calixteman/bug2016212
Correctly handle tab/page down when on a menu (bug 2016212)
2026-02-18 15:39:53 +01:00
Jonas Jenwald
e1cc24c595 Set the annotationType automatically in the Annotation constructor
Rather than assigning it manually in every extending class, we can utilize the fact that the `AnnotationType`-entries are simply the upper-case version of the `/Subtype` (when it exists) in the Annotation dictionary.
2026-02-18 14:47:42 +01:00
Calixte Denizet
5290534c53
Correctly handle tab/page down when on a menu (bug 2016212) 2026-02-18 10:17:39 +01:00
calixteman
61de56440a
Merge pull request #20678 from calixteman/bug2016136
Add an aria-label to the checkboxes in the thumbnails view (bug 2016136)
2026-02-18 10:14:36 +01:00
Jonas Jenwald
3a32ca7e69
Merge pull request #20682 from Snuffleupagus/CanvasGraphics-rm-unused-props
Remove unused `CanvasGraphics` properties (PR 700 follow-up)
2026-02-17 22:38:33 +01:00
Jonas Jenwald
336cda0c64 Remove unused CanvasGraphics properties (PR 700 follow-up)
These are probably a copy-and-paste mistake, since they appear to have been unused already in PR 700 all the way back in 2011.
2026-02-17 21:36:08 +01:00
Calixte Denizet
65f1b9b95b
Add an aria-label to the checkboxes in the thumbnails view (bug 2016136) 2026-02-17 20:58:10 +01:00
Tim van der Meij
cfc93e2606
Merge pull request #20665 from calixteman/fix_coverage
Fix code coverage line mapping
2026-02-17 20:16:41 +01:00
Tim van der Meij
178261a813
Merge pull request #20463 from matt-atticus/fix-text-selection-under-search-highlight
fix: support text selection under search highlights
2026-02-17 20:03:42 +01:00
Tim van der Meij
5084e3d0ec
Merge pull request #20675 from calixteman/bug2015916
Fix the keyboard accessibility of the manage button in the thumbnails view (bug 2015916)
2026-02-17 20:03:19 +01:00
Calixte Denizet
f4a2fd60db
Fix the keyboard accessibility of the manage button in the thumbnails view (bug 2015916) 2026-02-17 19:00:20 +01:00
Jonas Jenwald
fe44bac6ef
Merge pull request #20673 from Snuffleupagus/PDFObjects-Map
Convert the `PDFObjects` class to use a `Map` internally
2026-02-17 13:54:48 +01:00
Calixte Denizet
167dc5a415
Add an aria-label to the sidebar resizer (bug 2016142) 2026-02-17 13:38:56 +01:00
Jonas Jenwald
6323afab46 Convert the PDFObjects class to use a Map internally
This patch also adds unconditional `Map.prototype.getOrInsertComputed()` usage, which should be fine since it's [supported in the latest browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/getOrInsertComputed#browser_compatibility) and it'll be polyfilled (via core-js) in the `legacy` builds.
2026-02-17 09:42:27 +01:00
Matthew Lawrence
f01e4d477e fix: prevent search highlights from interfering with drag-selection 2026-02-17 13:46:02 +11:00
Jonas Jenwald
62ac1b844a
Merge pull request #20669 from Snuffleupagus/decode-truncate
Truncate too long /Decode map entries (issue 20668)
2026-02-16 20:39:12 +01:00
Jonas Jenwald
8319fff9b6
Merge pull request #20663 from Snuffleupagus/xref-rm-Object-hasOwn
Remove `Object.hasOwn` usage from the `src/core/xref.js` file
2026-02-16 20:38:18 +01:00
Jonas Jenwald
31b4612ac0 Truncate too long /Decode map entries (issue 20668) 2026-02-16 16:22:00 +01:00
calixteman
2b57ef4b56
Fix code coverage line mapping
When checking the code coverage report, it was noticed that the line numbers were off.
It was due to the fact that the files used for coverage were the transpiled ones,
when the ones used by Codecov were the original ones.
So this patches adds the source maps to the transpiled files, and also updates
the license header in the original files in using a babel plugin in order
to make sure the line numbers are correct.
As a side effect of this work, it's now possible to have the correct line
numbers in the stack traces when running tests with the transpiled files.
2026-02-15 23:03:07 +01:00
Jonas Jenwald
0a9176422e Remove Object.hasOwn usage from the src/core/xref.js file
This should not be necessary, given the following checks done early during the worker initialization: c5746949ac/src/core/worker.js (L124-L141)
2026-02-15 16:39:39 +01:00
Tim van der Meij
b27caa0f7b
Upgrade @csstools/postcss-light-dark-function to version 3.0.0
This is a major version bump, but the changelog at
https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-light-dark-function/CHANGELOG.md
doesn't indicate any breaking changes that should impact us.

We only have to list `@csstools/postcss-light-dark-function` in
`eslint.config.js` similar to e.g. commit a2909f9b.
2026-02-14 20:15:30 +01:00
Tim van der Meij
5875cddbf0
Upgrade postcss-dir-pseudo-class to version 10.0.0
This is a major version bump, but the changelog at
https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-dir-pseudo-class/CHANGELOG.md
doesn't indicate any breaking changes that should impact us.

We only have to list `postcss-dir-pseudo-class` in `eslint.config.js`
similar to e.g. commit a2909f9b.
2026-02-14 20:12:43 +01:00
Tim van der Meij
e6c85537c6
Upgrade postcss-nesting to version 14.0.0
This is a major version bump, but the changelog at
https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-nesting/CHANGELOG.md
doesn't indicate any breaking changes that should impact us.

We only have to list `postcss-nesting` in `eslint.config.js` similar
to e.g. commit a2909f9b.
2026-02-14 20:10:09 +01:00
Tim van der Meij
ebc8946298
Upgrade stylelint to version 17.3.0
This is a major version bump, but the changelog at
https://github.com/stylelint/stylelint/releases/tag/17.0.0
doesn't indicate any breaking changes that should impact us.

We only have to list `stylelint` in `eslint.config.js` similar to e.g.
commit a2909f9b.
2026-02-14 20:05:41 +01:00
Tim van der Meij
0888b85a46
Upgrade eslint-plugin-unicorn to version 63.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v63.0.0
doesn't indicate any breaking changes that should impact us.

Note that this version supports ESLint 10, which is a prerequisite for
being able to upgrade ESLint itself in a follow-up later.
2026-02-14 19:55:56 +01:00
Tim van der Meij
6bce7a3abc
Update translations to the most recent versions 2026-02-14 19:55:50 +01:00
Tim van der Meij
41e2f4e6c6
Fix moderate-severity vulnerability in the markdown-it dependency
This patch is generated automatically using `npm audit fix`.
2026-02-14 19:55:50 +01:00
Tim van der Meij
9edfeb0d33
Update dependencies to the most recent versions 2026-02-14 19:49:26 +01:00
Tim van der Meij
c5746949ac
Merge pull request #20659 from calixteman/codecov_badge
Add a Codecov badge
2026-02-14 19:35:28 +01:00
Jonas Jenwald
59fbad617b Convert ChunkedStreamManager.prototype.sendRequest to an asynchronous method
This is not only shorter, but (in my opinion) it also simplifies the code.

*Note:* In order to keep the *five* different `BasePDFStreamRangeReader` implementations consistent, we purposely don't re-factor the `PDFWorkerStreamRangeReader` class to support `for await...of` iteration.
2026-02-14 15:49:31 +01:00
calixteman
f975a95cc4
Add a Codecov badge 2026-02-14 15:48:16 +01:00
Tim van der Meij
b6d028419b
Merge pull request #20658 from calixteman/node_coverage
Add code coverage for unit tests running in node
2026-02-14 15:41:17 +01:00
Tim van der Meij
1d6307f5d4
Merge pull request #20657 from Snuffleupagus/unicorn-prefer-class-fields
Enable the `unicorn/prefer-class-fields` ESLint plugin rule
2026-02-14 15:26:28 +01:00
calixteman
07dbda2d80
Add code coverage for unit tests running in node
It's a first step to add code coverage.
In order to get the code coverage report locally, you can run the following command:
```bash
npx gulp unittestcli --coverage
```
The code coverage report will be generated in the `./build/coverage` directory.
And the report can be consulted by opening:
  http://localhost:8888/build/coverage/index.html

A GitHub workflow has also been added to run the unit tests with code coverage
on each push and pull request. The report will be uploaded to Codecov.
2026-02-14 15:22:35 +01:00
Tim van der Meij
f22fb6bbfb
Merge pull request #20652 from Snuffleupagus/ChunkedStream-sendRequest-skip-empty
Avoid parsing skipped range requests in `ChunkedStreamManager` (PR 10694 follow-up)
2026-02-14 13:55:31 +01:00
Jonas Jenwald
170599f1e7 Enable the unicorn/prefer-class-fields ESLint plugin rule
This leads to slightly shorter code[1] when initializing classes, and in some cases we can even remove the constructors, which shouldn't hurt; see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md

It's probably possible to also change a lot of these class fields to private ones[2], however it's often difficult to tell at a glance if that's safe hence this patch only does this for the `PDFRenderingQueue`.

---

[1] This reduces the size of the `gulp mozcentral` output by 999 bytes, for a mostly mechanical code change.

[2] That sort of re-factoring should generally be done separately, on a class-by-class basis, to reduce the risk of regressions.
2026-02-14 12:33:34 +01:00
calixteman
fa908e452c
Merge pull request #20641 from calixteman/fix_ts
Fix types to make "gulp typestest" succeeding
2026-02-13 22:37:16 +01:00
calixteman
45c7805daf
Fix types to make "gulp typestest" succeeding 2026-02-13 22:34:04 +01:00
Tim van der Meij
63110e34a7
Merge pull request #20654 from Snuffleupagus/eslint-unicorn-rules
Enable a couple of additional `eslint-plugin-unicorn` rules
2026-02-13 19:51:42 +01:00
Tim van der Meij
b8a091107d
Merge pull request #20655 from calixteman/pdfium_update
Update jbig2 decoder (pdfium@0455e822ded1a5537d826703988e986a33d2d4a1)
2026-02-13 19:50:35 +01:00
Tim van der Meij
3302b3d5b6
Merge pull request #20656 from Snuffleupagus/mv-stripPath
Move and re-use the `stripPath` helper function more
2026-02-13 19:49:57 +01:00
Jonas Jenwald
520928719c Move and re-use the stripPath helper function more
There's a couple of spots that essentially re-implement that function.
2026-02-13 17:38:21 +01:00
Calixte Denizet
5a146a8d2f
Update jbig2 decoder (pdfium@0455e822ded1a5537d826703988e986a33d2d4a1) 2026-02-13 14:40:32 +01:00
Jonas Jenwald
d595b09d01 Enable a couple of additional eslint-plugin-unicorn rules
- `no-useless-collection-argument` which required no code changes, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md
 - `prefer-classlist-toggle` which required one change (done automatically with `gulp lint --fix`), see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-classlist-toggle.md
2026-02-13 11:25:58 +01:00
calixteman
fa28ca1468
Merge pull request #20651 from Snuffleupagus/Response-bytes
Start using `Response.prototype.bytes()` in the code-base
2026-02-13 10:31:54 +01:00
calixteman
ae9fc13d8f
Merge pull request #20649 from calixteman/bug2015385
Ends the current drawing session when closing the tab (bug 2015385)
2026-02-13 08:27:16 +01:00
calixteman
1b20ba5c3f
Ends the current drawing session when closing the tab (bug 2015385) 2026-02-12 22:21:55 +01:00
Jonas Jenwald
b3c07f4b3d Avoid parsing skipped range requests in ChunkedStreamManager (PR 10694 follow-up)
While we don't dispatch the actual range request after PR 10694 we still parse the returned data, which ends up being an *empty* `ArrayBuffer` and thus cannot affect the `ChunkedStream.prototype._loadedChunks` property.
Given that no actual data arrived, it's thus pointless[1] to invoke the `ChunkedStreamManager.prototype.onReceiveData` method in this case (and it also avoids sending effectively duplicate "DocProgress" messages).

---
[1] With the *possible* exception of `disableAutoFetch === false` being set, see f24768d7b4/src/core/chunked_stream.js (L499-L517) however that never happens when streaming is being used; note f24768d7b4/src/core/worker.js (L237-L238)
2026-02-12 18:01:54 +01:00
calixteman
f24768d7b4
Merge pull request #20648 from Snuffleupagus/api-async-getTextContent
Convert `PDFPageProxy.prototype.getTextContent` to an asynchronous method
2026-02-12 13:47:04 +01:00
Jonas Jenwald
722f1ffbc6 Remove type === "arraybuffer" support from the fetchData helper function
After the previous patch there's no longer any call-site using that type.
2026-02-12 11:23:28 +01:00
Jonas Jenwald
8ba83e73fa Start using Response.prototype.bytes() in the code-base
In all cases where we currently use `Response.prototype.arrayBuffer()` the result is immediately wrapped in a `Uint8Array`, which can be avoided by instead using the newer `Response.prototype.bytes()` method; see https://developer.mozilla.org/en-US/docs/Web/API/Response/bytes
2026-02-12 11:20:05 +01:00
Jonas Jenwald
c1b824f2e5 Convert PDFPageProxy.prototype.getTextContent to an asynchronous method
This is a tiny bit shorter, which cannot hurt.
2026-02-11 19:14:10 +01:00
calixteman
7077b2a998
Merge pull request #20644 from marco-c/mcp
Add firefox-devtools-mcp to let AI agents test and debug in Firefox
2026-02-10 09:58:05 +01:00
Tim van der Meij
96dbe92b53
Merge pull request #20643 from calixteman/fix_integration_test2
Fix a 'FreeText accessibility' integration test
2026-02-09 20:46:05 +01:00
calixteman
0b5f402158
Merge pull request #20639 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2026-02-09 17:48:10 +01:00
Jonas Jenwald
4f40a5427c
Merge pull request #20645 from Snuffleupagus/Chrome-118
[api-minor] Update the minimum supported Google Chrome version to 118
2026-02-09 13:59:51 +01:00
Jonas Jenwald
385c936318 [api-minor] Update the minimum supported Google Chrome version to 118
This patch updates the minimum supported browsers as follows:
 - Google Chrome 118, which was released on 2023-10-10; see https://chromereleases.googleblog.com/2023/10/stable-channel-update-for-desktop_10.html

We haven't made any changes to the supported Google Chrome version for a year, and this change allows us to remove "hacks" needed to support `float: inline-start/inline-end` in old browsers; see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/float#browser_compatibility.

Note that nowadays we usually try, where feasible and possible, to support browsers that are about two years old. By limiting support to only "recent" browsers we reduce the risk of holding back improvements of the *built-in* Firefox PDF Viewer, and also (significantly) reduce the maintenance/support burden for the PDF.js contributors.

*Please note:* As always, the minimum supported browser version assumes that a `legacy`-build of the PDF.js library is being used; see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
2026-02-09 12:16:46 +01:00
Marco Castelluccio
c0c0dfb2fa
Add firefox-devtools-mcp to let AI agents test and debug in Firefox 2026-02-09 11:00:02 +01:00
calixteman
d0a6531939
Merge pull request #20642 from Snuffleupagus/version-5.5
Bump library version to `5.5`
2026-02-09 10:32:03 +01:00
calixteman
9870d898b4
Merge pull request #20640 from calixteman/issue20629
Set a pages mapper per loaded document
2026-02-09 10:27:33 +01:00
Calixte Denizet
0f9d20fa32
Fix a 'FreeText accessibility' integration test
It's a regression from #20624.
2026-02-09 10:14:43 +01:00
Jonas Jenwald
f0e8807f04 Bump library version to 5.5 2026-02-08 23:31:21 +01:00
calixteman
babd030a77
Merge pull request #20638 from calixteman/avoid_branching
Avoid branching in convertBlackAndWhiteToRGBA
2026-02-08 21:16:29 +01:00
calixteman
4b4ab10c54
Set a pages mapper per loaded document
It fixes #20629.
2026-02-08 21:09:27 +01:00
Tim van der Meij
2a2806dc07
Merge pull request #20637 from Snuffleupagus/issue-20246
Normalize the font name in `getBaseFontMetrics` (issue 20246)
2026-02-08 19:48:16 +01:00
Tim van der Meij
47d51feb22
Update translations to the most recent versions 2026-02-08 18:57:35 +01:00
Tim van der Meij
08b6fef5fa
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`.
2026-02-08 18:56:55 +01:00
Tim van der Meij
0c5a590bbd
Update dependencies to the most recent versions 2026-02-08 18:55:55 +01:00
calixteman
a9870adfa3
Avoid branching in convertBlackAndWhiteToRGBA
The function is now almost 8x faster than before.
And make the code in the file slightly more readable.
2026-02-08 18:36:40 +01:00
Jonas Jenwald
6a3d5fea6c Replace a few cases of "manual" font name normalization with the normalizeFontName helper function 2026-02-08 16:56:50 +01:00
Jonas Jenwald
e9c509aca9 Normalize the font name in getBaseFontMetrics (issue 20246)
We tried to lookup the font metrics using the font name as-is, which didn't work since the PDF file in question has non-embedded fonts with names that include commas.
Hence the font names need to be normalized here as well, similar to elsewhere in the font code.
2026-02-08 16:56:15 +01:00
Tim van der Meij
2b95a8eb38
Merge pull request #20634 from Snuffleupagus/progressiveDone-resolve-requests
Ensure that pending requests are resolved when calling `PDFDataTransportStreamReader.prototype.progressiveDone`
2026-02-08 14:56:41 +01:00
Tim van der Meij
025d658a9c
Merge pull request #20635 from Snuffleupagus/Node-update-support
[api-minor] Update the supported Node.js "patch" versions
2026-02-08 14:47:01 +01:00
Jonas Jenwald
0306e6c7ed Re-use the getArrayBuffer helper from src/display/fetch_stream.js with PDFNodeStreamReader and PDFNodeStreamRangeReader
Given that the Node.js code uses standard `ReadableStream`s now, see PR 20594, it can use the same `getArrayBuffer` as the Fetch API implementation.

Also, change the `getArrayBuffer` fallback case to an Error (rather than a warning) since that should never actually happen.
2026-02-08 13:20:55 +01:00
Jonas Jenwald
916b58a027 Add a helper function to resolve pending requests in src/display/transport_stream.js and src/display/network.js
Currently the same identical code is duplicated four times per file, which seems completely unnecessary.
Note that the function isn't placed in `src/display/network_utils.js`, since that file isn't included in MOZCENTRAL builds.
2026-02-08 13:20:50 +01:00
Jonas Jenwald
a80f8ff014 [api-minor] Update the supported Node.js "patch" versions
We haven't made any changes to the supported Node.js versions for close to a year, however now seems like a good time to do so in order to unblock future (major version) package upgrades.

 - Babel version `8` is now close to release, since https://github.com/babel/babel/releases contain an 8-RC version and according to [this article](https://babel.dev/blog/2026/01/31/7.29.0) no new `7` releases are planned.
   See also https://babel.dev/blog/2025/05/30/babel-8-beta and note the supported Node.js versions in https://next.babeljs.io/docs/v8-migration/#nodejs-support

 - ESLint version `10` was just released, see https://eslint.org/blog/2026/02/eslint-v10.0.0-released/ and note the supported Node.js versions in https://eslint.org/docs/latest/use/migrate-to-10.0.0#-nodejs--v2019-v21-v23-are-no-longer-supported
2026-02-08 12:32:09 +01:00
Jonas Jenwald
2d643efce5 Ensure that pending requests are resolved when calling PDFDataTransportStreamReader.prototype.progressiveDone
Doing skip-cache reloading of https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#disableRange=true in the latest Firefox Nightly version I noticed an *intermittent* bug, where the loadingBar would fill up but without the PDF ever rendering.
Initially I was quite worried that the changes in PR 20602 had somehow caused this, however after a bunch of testing in a slightly older Nightly I was able to reproduce the problem there as well.[1]

Instead I believe that this problem goes all the back to PR 10675, so still my fault, since the `progressiveDone` handling there was incomplete.
Note how we only set the `this._done` property, but don't actually resolve any still pending requests. For reference, compare with the handling in the `PDFDataTransportStreamRangeReader.prototype._enqueue` method.
Depending on the exact order in which the `PDFDataTransportStreamReader.prototype.{_enqueue, read, progressiveDone}` methods are invoked, which depends on how/when the PDF data arrives, the bug might occur.

The reason that this bug hasn't been caught before now is likely that `disableRange=true` isn't used by default and Firefox users are unlikely to manually set that in e.g. `about:config`.

---
[1] Possibly some timings changed to make it slightly more common, but given the intermittent nature of this it's difficult to tell.
2026-02-07 22:24:20 +01:00
calixteman
c00591c1b6
Merge pull request #20623 from calixteman/bug2014080
In tagged pdfs, TH can be either a column header or a row header (bug 2014080)
2026-02-06 16:42:22 +01:00
Calixte Denizet
280a02150e
In tagged pdfs, TH can be either a column header or a row header (bug 2014080) 2026-02-06 10:04:13 +01:00
calixteman
58ac273f1f
Merge pull request #20503 from andriivitiv/Fix-Worker-was-terminated-error
Fix `Worker was terminated` error when loading is cancelled
2026-02-06 09:59:05 +01:00
calixteman
b92bdf80a2
Merge pull request #20628 from calixteman/bug2014399
Cap the max canvas dimensions in order to avoid to downscale large images in the worker (bug 2014399)
2026-02-06 09:42:04 +01:00
Tim van der Meij
f302323c7e
Merge pull request #20627 from Snuffleupagus/ChunkedStream-onReceiveData-rm-copy
Improve progress reporting in `ChunkedStreamManager`, and prevent unnecessary data copy in `ChunkedStream.prototype.onReceiveData`
2026-02-05 21:27:42 +01:00
Tim van der Meij
a0f3528053
Merge pull request #20624 from calixteman/bug2013793
Flush the text content chunk only on real font changes (bug 2013793)
2026-02-05 21:14:49 +01:00
Calixte Denizet
ff42c0bd50
Cap the max canvas dimensions in order to avoid to downscale large images in the worker (bug 2014399) 2026-02-05 20:25:36 +01:00
Jonas Jenwald
b3cd042ded Prevent unnecessary data copy in ChunkedStream.prototype.onReceiveData
This method is only invoked via `ChunkedStreamManager.prototype.sendRequest`, which currently returns data in `Uint8Array` format (since it potentially combines multiple `ArrayBuffer`s).
Hence we end up doing a short-lived, but still completely unnecessary, data copy[1] in `ChunkedStream.prototype.onReceiveData` when handling range requests. In practice this is unlikely to be a big problem by default, given that streaming is used and the (low) value of the `rangeChunkSize` API-option. (However, in custom PDF.js deployments it might affect things more.)

Given that no data copy is better than a short lived one, let's fix this small oversight and add non-production `assert`s to keep it working as intended.
This way we also improve consistency, since all other streaming and range request methods (see e.g. `BasePDFStream` and related code) only return `ArrayBuffer` data.

---
[1] Remember that `new Uint8Array(arrayBuffer)` only creates a view of the underlying `arrayBuffer`, whereas `new Uint8Array(typedArray)` actually creates a copy of the `typedArray`.
2026-02-05 16:16:36 +01:00
Jonas Jenwald
01deb085f8 Improve progress reporting in the ChunkedStreamManager
Currently there's two small bugs, which have existed around a decade, in the `loaded` property that's sent via the "DocProgress" message from the `ChunkedStreamManager.prototype.onReceiveData` method.

 - When the entire PDF has loaded the `loaded` property can become larger than the `total` property, which obviously doesn't make sense.
   This happens whenever the size of the PDF is *not* a multiple of the `rangeChunkSize` API-option, which is a very common situation.

 - When streaming is being used, the `loaded` property can become smaller than the actually loaded amount of data.
   This happens whenever the size of a streamed chunk is *not* a multiple of the `rangeChunkSize` API-option, which is a common situation.
2026-02-05 16:04:45 +01:00
calixteman
222a24c623
Merge pull request #20622 from calixteman/bug2014167
Let the toggle button in the alt-text dialog downloading (resp. delete) the model and enabling (resp. disabling) alt-text guessing (bug 2014167)
2026-02-04 14:13:05 +01:00
calixteman
1e0ba4dfec
Merge pull request #20621 from calixteman/bug2013899
Avoid to have to download the model when toggling the button in the alt-text image settings dialog (bug 2013899)
2026-02-04 14:12:27 +01:00
calixteman
22b97d1741
Flush the text content chunk only on real font changes (bug 2013793) 2026-02-03 23:11:31 +01:00
Calixte Denizet
ea993bfc1b
Let the toggle button in the alt-text dialog downloading (resp. delete) the model and enabling (resp. disabling) alt-text guessing (bug 2014167) 2026-02-03 20:27:06 +01:00
Calixte Denizet
c7bea3b342
Avoid to have to download the model when toggling the button in the alt-text image settings dialog (bug 2013899) 2026-02-03 19:26:33 +01:00
calixteman
1c12b07726
Merge pull request #20613 from calixteman/ccittfax_pdfium
Use the ccittfax decoder from pdfium
2026-02-02 15:07:53 +01:00
calixteman
88c2051698
Use the ccittfax decoder from pdfium
The decoder is a dependency of the jbig2 one and is already
included in pdf.js, so we just need to wire it up.
It improves the performance of documents using ccittfax images.
2026-02-02 11:10:32 +01:00
Jonas Jenwald
bfd17b2586
Merge pull request #20615 from Snuffleupagus/transport-onProgress
Report loading progress "automatically" when using the `PDFDataTransportStream` class, and remove the `PDFDataRangeTransport.prototype.onDataProgress` method
2026-02-01 22:36:43 +01:00
Jonas Jenwald
d152e92185
Merge pull request #20614 from Snuffleupagus/BasePDFStream-url
Change all relevant `BasePDFStream` implementations to take an actual `URL` instance
2026-02-01 22:13:28 +01:00
Tim van der Meij
f4326e17c4
Merge pull request #20610 from calixteman/brotli
Add support for Brotli decompression
2026-02-01 20:41:06 +01:00
Tim van der Meij
3f21efc942
Merge pull request #20607 from Snuffleupagus/rm-web-interfaces
Replace the various interfaces in `web/interfaces.js` with proper classes
2026-02-01 20:31:13 +01:00
Tim van der Meij
8eb9340fa7
Merge pull request #20617 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2026-02-01 20:23:40 +01:00
Tim van der Meij
031f633236
Bump the stable version in pdfjs.config 2026-02-01 20:20:49 +01:00
Jonas Jenwald
6509fdb1d6 Assert that PDFFetchStream is only used with HTTP(S) URLs
Note how `getDocument` checks the protocol, via the `isValidFetchUrl` helper, before attempting to use the `PDFFetchStream` implementation.
2026-02-01 18:21:27 +01:00
Jonas Jenwald
586e85888b Change all relevant BasePDFStream implementations to take an actual URL instance
Currently this code expects a "url string", rather than a proper `URL` instance, which seems completely unnecessary now. The explanation for this is, as so often is the case, "historical reasons" since a lot of this code predates the general availability of `URL`.
2026-02-01 18:21:13 +01:00
Jonas Jenwald
76dabeddb3 Limit the Math.sumPrecise polyfill to non-MOZCENTRAL builds
After https://bugzilla.mozilla.org/show_bug.cgi?id=1985121 this functionality is now guaranteed to be available in Firefox.
Unfortunately general browser support is still somewhat lacking; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sumPrecise#browser_compatibility

Also, while unrelated, use the `MathClamp` helper in the `applyOpacity` function.
2026-02-01 18:20:29 +01:00
Jonas Jenwald
d25f13d1fd Report loading progress "automatically" when using the PDFDataTransportStream class, and remove the PDFDataRangeTransport.prototype.onDataProgress method
This is consistent with the other `BasePDFStream` implementations, and simplifies the API surface of the `PDFDataRangeTransport` class (note the changes in the viewer).
Given that the `onDataProgress` method was changed to a no-op this won't affect third-party users, assuming there even are any since this code was written specifically for the Firefox PDF Viewer.
2026-02-01 18:20:19 +01:00
Jonas Jenwald
aa4d0f7c07 Temporarily disable typestest in GitHub Actions 2026-02-01 17:56:07 +01:00
Jonas Jenwald
023af46186 Replace the IRenderableView interface with an abstract RenderableView class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different page/thumbnail classes.
2026-02-01 17:56:06 +01:00
Jonas Jenwald
839c257f87 Replace the IDownloadManager interface with an abstract BaseDownloadManager class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different `DownloadManager` classes.
2026-02-01 17:56:03 +01:00
Jonas Jenwald
ff7f87fc21 Replace the IPDFPrintServiceFactory interface with an abstract BasePrintServiceFactory class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different `PDFPrintServiceFactory` classes.
2026-02-01 17:53:45 +01:00
Jonas Jenwald
50a12e3e67 Remove the IL10n interface
Given that we either use the `L10n` class directly or extend it via `GenericL10n`, it should no longer be necessary to keep the interface-definition.
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the `L10n` class.
2026-02-01 17:53:45 +01:00
Jonas Jenwald
b517b5c597 Remove the IPDFLinkService interface
Given that `SimpleLinkService` now extends the regular `PDFLinkService` class, see PR 18013, it should no longer be necessary to keep the interface-definition.
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the `PDFLinkService` class.
2026-02-01 17:53:45 +01:00
Tim van der Meij
384c6208b2
Merge pull request #20565 from kairosci/fix-bug-20557
fix: Fix mailto links truncated at dash
2026-02-01 17:34:34 +01:00
Tim van der Meij
e4cd3176ab
Merge pull request #20602 from Snuffleupagus/BasePDFStream-2
Replace the `IPDFStream`, `IPDFStreamReader`, and `IPDFStreamRangeReader` interfaces with proper base classes
2026-02-01 16:53:17 +01:00
Jonas Jenwald
ecb09d62fc Add the current loading percentage to the onPassword callback
The percentage calculation is currently "spread out" across various viewer functionality, which we can avoid by having the API handle that instead.

Also, remove the `this.#lastProgress` special-case[1] and just register a "normal" `fullReader.onProgress` callback unconditionally. Once `headersReady` is resolved the callback can simply be removed when not needed, since the "worst" thing that could theoretically happen is that the loadingBar (in the viewer) updates sooner this way. In practice though, since `fullReader.read` cannot return data until `headersReady` is resolved, this change is not actually observable in the API.

---

[1] This was added in PR 8617, close to a decade ago, but it's not obvious to me that it was ever necessary to implement it that way.
2026-01-31 16:33:58 +01:00
calixteman
43273fde27
Add support for Brotli decompression
For now, `BrotliDecode` hasn't been specified but it should be in a
close future.
So when it's possible we use the native `DecompressionStream` API
with "brotli" as argument.
If that fails or if we've to decompress in a sync context, we fallback
to `BrotliStream` which a pure js implementation (see README in external/brotli).
2026-01-31 16:25:53 +01:00
Jonas Jenwald
4ca205bac3 Add an abstract BasePDFStreamRangeReader class, that all the old IPDFStreamRangeReader implementations inherit from
Given that there's no less than *five* different, but very similar, implementations this helps reduce code duplication and simplifies maintenance.
2026-01-30 14:15:39 +01:00
Jonas Jenwald
54d8c5e7b4 Add an abstract BasePDFStreamReader class, that all the old IPDFStreamReader implementations inherit from
Given that there's no less than *five* different, but very similar, implementations this helps reduce code duplication and simplifies maintenance.

Also, remove the `rangeChunkSize` not defined checks in all the relevant stream-constructor implementations.
Note how the API, since some time, always validates *and* provides that parameter when creating a `BasePDFStreamReader`-instance.
2026-01-30 14:15:39 +01:00
Jonas Jenwald
4a8fb4dde1 Add an abstract BasePDFStream class, that all the old IPDFStream implementations inherit from
Given that there's no less than *five* different, but very similar, implementations this helps reduce code duplication and simplifies maintenance.

Also, spotted during rebasing, pass the `enableHWA` option "correctly" (i.e. as part of the existing `transportParams`) to the `WorkerTransport`-class to keep the constructor simpler.
2026-01-30 14:15:39 +01:00
Jonas Jenwald
a80f10ff1a Remove the onProgress callback from the IPDFStreamRangeReader interface
Note how there's *nowhere* in the code-base where the `IPDFStreamRangeReader.prototype.onProgress` callback is actually being set and used, however the loadingBar (in the viewer) still works just fine since loading progress is already reported via:
 - The `ChunkedStreamManager` instance respectively the `getPdfManager` function, through the use of a "DocProgress" message, on the worker-thread.
 - A `IPDFStreamReader.prototype.onProgress` callback, on the main-thread.

Furthermore, it would definitely *not* be a good idea to add any `IPDFStreamRangeReader.prototype.onProgress` callbacks since they only include the `loaded`-property which would trigger the "indeterminate" loadingBar (in the viewer).

Looking briefly at the history of this code it's not clear, at least to me, when this became unused however it's probably close to a decade ago.
2026-01-30 14:15:39 +01:00
Jonas Jenwald
05b78ce03c Stop registering an onProgress callback on the PDFWorkerStreamRangeReader-instance, in the ChunkedStreamManager class
Given that nothing in the `PDFWorkerStreamRangeReader` class attempts to invoke the `onProgress` callback, this is effectively dead code now.
Looking briefly at the history of this code it's not clear, at least to me, when this became unused however it's probably close to a decade ago.

Finally, note also how progress is already being reported through the `ChunkedStreamManager.prototype.onReceiveData` method.
2026-01-30 14:15:38 +01:00
Jonas Jenwald
987265720e Remove the unused IPDFStreamRangeReader.prototype.isStreamingSupported getter
This getter was only invoked from `src/display/network.js` and `src/core/chunked_stream.js`, however in both cases it's hardcoded to `false` and thus isn't actually needed.
This originated in PR 6879, close to a decade ago, for a potential TODO which was never implemented and it ought to be OK to just simplify this now.
2026-01-30 14:15:38 +01:00
Jonas Jenwald
62d5408cf0 Stop tracking progressiveDataLength in the ChunkedStreamManager class
Currently this property is essentially "duplicated", so let's instead use the identical one that's availble on the `ChunkedStream` instance.
2026-01-30 14:15:38 +01:00
Jonas Jenwald
814df09e21
Merge pull request #20603 from Snuffleupagus/createChromiumPrefsSchema
Improve preferences building, and generate the `preferences_schema.json` file for the Chromium addon
2026-01-30 14:12:27 +01:00
Jonas Jenwald
d4fbae06d9
Merge pull request #20605 from Snuffleupagus/rm-util-global-tests
Remove unit-tests for global `ReadableStream` and `URL`
2026-01-30 14:06:15 +01:00
Jonas Jenwald
1370950843 Remove unnecessary IIFEs when setting the compatParams
This really isn't necessary, and it's just a left-over from before the code was moved into the current file.

Also, spotted during rebasing, use the existing "locale" hash-parameter in integration-tests rather than adding a duplicate one for testing.
2026-01-30 13:31:16 +01:00
Jonas Jenwald
5d02076313 Add tests (and CI) to ensure that preference generation works correctly for all relevant build-targets
Given that previous patches reduced that number of build-targets running this code, ensure that it's still tested sufficiently.
2026-01-30 13:31:13 +01:00
Jonas Jenwald
2a83f955b0 Make getDefaultPreferences a synchronous function, to simplify the build scripts 2026-01-30 13:26:19 +01:00
Jonas Jenwald
06cf7dd7b0 Stop pre-building the preference defaults, to simplify the build scripts
This is a left-over from before the introduction of `AppOptions`, but is no longer necessary now.
2026-01-30 13:26:19 +01:00
Jonas Jenwald
35e78f7f11 Generate the preferences_schema.json file, for the Chromium addon, during building
This avoids the hassle of having to manually update that file when adding/modifying preferences in the viewer.
Updating the preferences-metadata should now only be something that the Chromium addon maintainer has to do.
2026-01-30 13:26:16 +01:00
Jonas Jenwald
a2909f9b66 List postcss-values-parser as an import alias in the ESLint config
This is similar to how other packages are handled, note e.g. the `fluent` ones.
2026-01-30 10:26:23 +01:00
Jonas Jenwald
9c903a0ebc Remove unit-tests for global ReadableStream and URL
These unit-tests were added many years ago, when this functionality wasn't generally available and we still bundled polyfills.
Since they are both available everywhere nowadays, see [here](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) and [here](https://developer.mozilla.org/en-US/docs/Web/API/URL), these unit-tests no longer make sense.
2026-01-30 10:16:21 +01:00
Tim van der Meij
471adfd023
Merge pull request #20596 from Snuffleupagus/FileSpec-fixes
Simplify the `FileSpec` class, and remove no longer needed polyfills
2026-01-29 22:03:38 +01:00
Tim van der Meij
7cdd03ad9b
Merge pull request #20595 from Snuffleupagus/NetworkManager-simplify
Simplify the `NetworkManager` class, and inline it in the  `PDFNetworkStream` class
2026-01-29 21:56:58 +01:00
Tim van der Meij
c0572c1c8f
Merge pull request #20594 from Snuffleupagus/Node-ReadableStream
[Node.js] Don't abort the full request for local PDF files smaller than two range requests, and use standard `ReadableStream`s
2026-01-29 21:48:43 +01:00
Tim van der Meij
2cef80d05b
Merge pull request #20598 from calixteman/fix_sidebar_resize
Fix the sidebar resizer accessibility
2026-01-29 21:42:30 +01:00
Jonas Jenwald
5b368dd58a Remove the Uint8Array.prototype.toHex(), Uint8Array.prototype.toBase64(), and Uint8Array.fromBase64() polyfills
(During rebasing of the previous patches I happened to look at the polyfills and noticed that this one could be removed now.)

See:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toHex#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64#browser_compatibility

Note that technically this functionality can still be disabled via a preference in Firefox, however that's slated for removal in [bug 1985120](https://bugzilla.mozilla.org/show_bug.cgi?id=1985120).
Looking at the Firefox source-code, see https://searchfox.org/firefox-main/search?q=array.tobase64%28%29&path=&case=false&regexp=false, you can see that it's already being used *unconditionally* elsewhere in the browser hence removing the polyfills ought to be fine (since toggling the preference would break other parts of the browser).
2026-01-29 17:27:43 +01:00
Jonas Jenwald
247ee02299 Remove the Promise.try() polyfill
(During rebasing of the previous patches I happened to look at the polyfills and noticed that this one could be removed now.)

Note:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/try#browser_compatibility
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1928493
2026-01-29 17:25:46 +01:00
Jonas Jenwald
b3f35b6007 Return the rawFilename as-is even if it's empty, from FileSpec.prototype.serializable
It's more correct to return the `rawFilename` as-is, and limit the fallback for empty filenames to only the `filename` property.
2026-01-29 17:25:44 +01:00
Calixte Denizet
956c2a051a
Fix the sidebar resizer accessibility
It's width was a bit wrong because of its box-sizing property and it was causing some issues when resizing it with the keyboard.
And for the thumbnails sidebar, the tabindex was missing and some aria properties too.
2026-01-27 21:41:11 +01:00
calixteman
5505201930
Merge pull request #20582 from calixteman/reorg_save
Add a manage button in the thumbnail view in order to save an edited pdf (bug 2010830)
2026-01-26 19:25:50 +01:00
Calixte Denizet
dd6a0c6cf4
Add a manage button in the thumbnail view in order to save an edited pdf (bug 2010830) 2026-01-26 18:09:07 +01:00
calixteman
07a4aab246
Merge pull request #20587 from calixteman/reorg_simplify_mapping
Refactor a bit page mapping stuff in order to be able to support delete/copy pages
2026-01-26 17:43:49 +01:00
Calixte Denizet
806133379e
Refactor a bit page mapping stuff in order to be able to support delete/copy pages 2026-01-26 16:53:52 +01:00
calixteman
48df8a5ea2
Merge pull request #20586 from marco-c/commentundo
Bug 1999154 - Add the ability to undo comment deletion
2026-01-26 15:52:15 +01:00
calixteman
ab7d388ccb
Merge pull request #20591 from calixteman/reorg_fix_drag_width
Fix the drag marker dimensions in the thumbnails view
2026-01-26 09:00:01 +01:00
Calixte Denizet
f2ac669ee4
Fix the drag marker dimensions in the thumbnails view
STR:
 - open outline view;
 - switch to thumbnails one;
 - start to drag a thumbnail.
2026-01-25 21:49:17 +01:00
calixteman
001058abb2
Merge pull request #20593 from calixteman/decompress_content_stream
Use DecompressionStream in async code
2026-01-25 21:27:16 +01:00
Alessio Attilio
50f2d4db65 fix: allow hyphens in mailto link auto-detection (bug 20557)
Modified the regex in web/autolinker.js to explicitly allow hyphens (-) in
the domain part of email addresses, while maintaining the exclusion of
other punctuation. This fixes mailto links like user@uni-city.tld being
truncated at the hyphen.

Fixes #20557
2026-01-25 17:20:14 +01:00
calixteman
9f660be8a2
Use DecompressionStream in async code
Usually, content stream or fonts are compressed using FlateDecode.
So use the DecompressionStream API to decompress those streams
in the async code path.
2026-01-25 14:22:19 +01:00
Jonas Jenwald
640a3106d5 Remove caching/shadowing from the FileSpec getters, and simplify the code
Given that only the `FileSpec.prototype.serializable` getter is ever invoked from "outside" of the class, and only once per `FileSpec`-instance, the caching/shadowing isn't actually necessary.

Furthermore the `_contentRef`-caching wasn't actually correct, since it ended up storing a `BaseStream`-instance and those should *generally* never be cached.
(Since calling `BaseStream.prototype.getBytes()` more than once, without resetting the stream in between, will return an empty TypedArray after the first time.)
2026-01-25 13:16:29 +01:00
Jonas Jenwald
84b5866853 Reduce duplication in the pickPlatformItem helper function
Also, tweak code/comment used when handling "GoToR" destinations.
2026-01-25 13:16:06 +01:00
Jonas Jenwald
eaf605d720 Move the NetworkManager functionality into the PDFNetworkStream class
The `NetworkManager` is very old code at this point, and it predates the introduction of the streaming functionality by many years.
To simplify things, especially with upcoming re-factoring patches, let's move this functionality into private (and semi-private) methods in the `PDFNetworkStream` class to avoid having to deal with too many different scopes.
2026-01-25 12:41:33 +01:00
Jonas Jenwald
4d9301fceb Simplify the NetworkManager class
Store pending requests in a `WeakMap`, which allows working directly with the `XMLHttpRequest`-data and removes the need for a couple of methods.

Simplify the `PDFNetworkStreamRangeRequestReader.prototype._onDone` method, since after removing `moz-chunked-arraybuffer` support (see PR 10678) it's never called without an argument.

Stop sending the `begin`-property to the `onDone`-callbacks since it's unused. Originally this code was shared with the Firefox PDF Viewer, many years ago, and then that property mattered.

Re-factor the `status` validation, to avoid checking for a "bad" range-request response unconditionally.
2026-01-25 12:41:20 +01:00
Jonas Jenwald
663d4cd6e7 Use standard ReadableStreams in the src/display/node_stream.js code
Thanks to newer Node.js functionality, see https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options, we can use standard `ReadableStream`s which help to significantly shorten and simplify the code.

For older Node.js versions we use the `node-readable-to-web-readable-stream` package, see https://www.npmjs.com/package/node-readable-to-web-readable-stream, to get the same functionality.
2026-01-25 12:34:47 +01:00
Jonas Jenwald
45294d31cb In Node.js, don't abort the full request for local PDF files smaller than two range requests
This follows the behaviour used with both the Fetch API and `XMLHttpRequest`, compare with the `validateRangeRequestCapabilities` helper function.
2026-01-25 12:34:35 +01:00
Tim van der Meij
95f62f3b33
Merge pull request #20580 from calixteman/reorg_link_outline
Fix links and outline after reorganizing a pdf
2026-01-23 20:49:20 +01:00
Tim van der Meij
23c7b1ac8e
Merge pull request #20583 from calixteman/simplify_menu
Hide the menu container in changing it's visibility
2026-01-23 20:41:08 +01:00
Tim van der Meij
bfa44af327
Merge pull request #20554 from dgiessing/patch-1
Update image pattern in gulpfile to accommodate missing images
2026-01-23 20:22:23 +01:00
Tim van der Meij
109ea59fbc
Merge pull request #20588 from mozilla/dependabot/npm_and_yarn/lodash-4.17.23
Bump lodash from 4.17.21 to 4.17.23
2026-01-23 20:16:58 +01:00
David Giessing
0aa4fc6af8
fix: Update image pattern in gulpfile to accommodate missing images 2026-01-22 23:01:46 +01:00
Marco Castelluccio
bfdcaadf7c
Use kbUndo when possible 2026-01-22 13:12:38 +01:00
Marco Castelluccio
bdc9323b15
Hide comment popup after redo action 2026-01-22 13:12:13 +01:00
dependabot[bot]
3270c4a504
Bump lodash from 4.17.21 to 4.17.23
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-21 23:03:09 +00:00
Marco Castelluccio
84d15dc453
Restore date too 2026-01-21 17:06:13 +01:00
Marco Castelluccio
d9f67bd8ee
Bug 1999154 - Add the ability to undo comment deletion 2026-01-21 15:15:40 +01:00
Calixte Denizet
a4f4d460ca
Hide the menu container in changing it's visibility
This way, the dimensions of the menu container don't depend on its visibility.
This patch fixes few keyboard issues I noticed when reading:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menu_role#keyboard_interactions
2026-01-20 14:42:57 +01:00
calixteman
6a4a3b060d
Merge pull request #20475 from calixteman/organize_pages
Add the possibility to order the pages in an extracted pdf (bug 1997379)
2026-01-19 19:08:32 +01:00
calixteman
ce296d8d42
Add the possibility to order the pages in an extracted pdf (bug 1997379)
or in a merged one.
2026-01-19 18:58:23 +01:00
Calixte Denizet
43bd7fa738
Fix links and outline after reorganizing a pdf 2026-01-19 17:38:17 +01:00
calixteman
8188c87461
Merge pull request #20572 from calixteman/issue20571
Avoid exception after having moved an annotation
2026-01-18 21:06:50 +01:00
calixteman
8abfd9a797
Avoid exception after having moved an annotation
It fixes #20571.
2026-01-18 21:01:40 +01:00
calixteman
f04deeeddf
Merge pull request #20577 from calixteman/update_search
The 'find in page' feature must correctly work after the pages have been reorganized (bug 2010814)
2026-01-18 20:57:32 +01:00
Calixte Denizet
3a20ea75b9
The 'find in page' feature must correctly work after the pages have been reorganized (bug 2010814) 2026-01-18 20:54:15 +01:00
Tim van der Meij
fef0cb1a6f
Merge pull request #20578 from calixteman/bug2010820
Select the dropped thumbnail (bug 2010820)
2026-01-18 13:03:47 +01:00
Calixte Denizet
eb014a36cc
Select the dropped thumbnail (bug 2010820) 2026-01-16 19:54:14 +01:00
calixteman
67673ea274
Merge pull request #20559 from calixteman/new_sidebar2
Add the possibility to drag & drop some thumbnails in the pages view (bug 2009573)
2026-01-14 22:13:52 +01:00
Calixte Denizet
5e89981282
Add the possibility to drag & drop some thumbnails in the pages view
The goal is to be able to reorganize the pages in a pdf.
2026-01-14 21:04:38 +01:00
calixteman
cbcb6279ad
Merge pull request #20569 from calixteman/fix_caret_dark_mode
Make sure the caret is black in dark mode when in caret browsing mode
2026-01-14 16:57:05 +01:00
calixteman
6612d7afaf
Merge pull request #20567 from calixteman/bug2009627
Hide the text in the text layer associated with MathML elements (bug 2009627)
2026-01-14 14:19:37 +01:00
Calixte Denizet
cffd54e9c6
Hide the text in the text layer associated with MathML elements (bug 2009627)
The bug was supposed to be fixed by #20471 but here there are some annotations in the pdf.
When those annotations are added to the DOM, the struct tree has to be rendered but without
the text layer (because of asynchronicity).
So this patch is making sure that the modifications in the text layer are done once the
layer is rendered.
2026-01-13 20:37:52 +01:00
Tim van der Meij
f40ab1a3f8
Merge pull request #20570 from calixteman/no_contents_image_stream
Don't use contents stream which have an image format
2026-01-13 20:27:59 +01:00
Calixte Denizet
b5ed988267
Don't use contents stream which have an image format
The original bug has been filled in mupdf bug tracker:
https://bugs.ghostscript.com/show_bug.cgi?id=709033

The attached pdf can be open in Chrome but not in Acrobat.
2026-01-13 18:39:17 +01:00
Calixte Denizet
a362a24779
Make sure the caret is black in dark mode when in caret browsing mode 2026-01-13 18:10:11 +01:00
Tim van der Meij
a5010f99e7
Merge pull request #20566 from calixteman/update_jbig2
Update jbig2 decoder (pdfium@3c679253a9e17c10be696d345c63636b18b7f925)
2026-01-11 20:23:45 +01:00
calixteman
1f69a3f6af
Update jbig2 decoder (pdfium@3c679253a9e17c10be696d345c63636b18b7f925)
See a40f47cbc4
for details.
2026-01-11 13:39:46 +01:00
calixteman
6f5d5ac6d8
Merge pull request #20552 from calixteman/issue20529
Add some tests for the JBIG2 js decoder
2026-01-09 16:45:09 +01:00
calixteman
1dd6649b7d
Add some tests for the JBIG2 js decoder
It fixes #20529.

The files come from:
https://github.com/SerenityOS/serenity/tree/master/Tests/LibGfx/test-inputs/jbig2/

Thank you to Nico Weber for offering these test files.
2026-01-07 22:05:05 +01:00
calixteman
3532ac39d8
Merge pull request #20551 from calixteman/bug2004951_part2
Don't add an aria-label on MathML elements in the struct tree (bug 2004951)
2026-01-06 22:37:46 +01:00
Calixte Denizet
da463f2da9
Don't add an aria-label on MathML elements in the struct tree (bug 2004951) 2026-01-06 21:38:42 +01:00
Tim van der Meij
91fa05d2e8
Merge pull request #20550 from calixteman/bug2004951_part1
Aria-hide artifacts in the text layer (bug 2004951)
2026-01-06 20:29:25 +01:00
Calixte Denizet
0ef085e23b
Aria-hide artifacts in the text layer (bug 2004951) 2026-01-05 16:57:01 +01:00
Tim van der Meij
a939f12391
Merge pull request #20549 from timvandermeij/talos-revert
Revert "Remove some files from talos tests because they aren't available on webarchive"
2026-01-04 19:50:34 +01:00
Tim van der Meij
adde05b530
Revert "Remove some files from talos tests because they aren't available on webarchive"
This reverts commit fbce8bf829cba78281ea93e845c524725ff2c3ff. The file
is available in the Web Archive again.

Fixes #20528.
2026-01-04 19:29:26 +01:00
Tim van der Meij
54d84799c2
Merge pull request #20548 from calixteman/jbig2wasm_failure
Fix wasm url issue for the jbig2 decoder
2026-01-04 19:14:37 +01:00
calixteman
eab33828a9
Fix wasm url issue for the jbig2 decoder
and add a test for jbig2 decoding with the js decoder.
2026-01-04 00:08:59 +01:00
Tim van der Meij
cb36cbdc13
Merge pull request #20547 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2026-01-03 23:32:02 +01:00
calixteman
cb28250fbe
Merge pull request #20546 from calixteman/jbig2wasm
Use the PDFium JBig2 decoder compiled into wasm
2026-01-03 22:08:12 +01:00
calixteman
98c1955bd4
Use the PDFium JBig2 decoder compiled into wasm
The decoder is ~4x faster than the JS decoder on large images.
2026-01-03 22:05:14 +01:00
Tim van der Meij
5c06beae07
Update translations to the most recent versions 2026-01-03 20:43:08 +01:00
Tim van der Meij
687cd848e0
Upgrade eslint-plugin-perfectionist to version 5.2.0
This is a major version bump, but the changelog at
https://github.com/azat-io/eslint-plugin-perfectionist/releases/v5.0.0
doesn't indicate any breaking changes that should impact us.
2026-01-03 20:42:04 +01:00
Tim van der Meij
13e070a8a3
Upgrade globals to version 17.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/globals/releases/v17.0.0
doesn't indicate any breaking changes that should impact us.
2026-01-03 20:40:39 +01:00
Tim van der Meij
2838e161b8
Update dependencies to the most recent versions 2026-01-03 20:38:22 +01:00
calixteman
eccbcbe5eb
Merge pull request #20515 from calixteman/issue20513_2
Get glyph contours when stroking using a pattern
2025-12-29 11:32:28 +01:00
calixteman
424c7989aa
Get glyph contours when stroking using a pattern
Fix issue #20513 (second part).
2025-12-28 22:55:59 +01:00
Tim van der Meij
430b8a9e90
Merge pull request #20540 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-12-28 20:08:27 +01:00
Tim van der Meij
f385fd9783
Bump the stable version in pdfjs.config 2025-12-28 20:05:00 +01:00
Tim van der Meij
50cc4adac0
Merge pull request #20535 from calixteman/issue18062
Use CIDToGIDMap when the font is a type 2 with an OpenType font
2025-12-28 18:22:37 +01:00
calixteman
5518c8a544
Use CIDToGIDMap when the font is a type 2 with an OpenType font
It fixes #18062.
2025-12-28 14:51:06 +01:00
Tim van der Meij
1990fa7cd0
Merge pull request #20538 from calixteman/issue13425
Fix the loca table length when there is enough space for it
2025-12-28 13:52:32 +01:00
Tim van der Meij
67b92b3421
Merge pull request #20537 from calixteman/remove_undestack
Remove undefStack stuff in the cff parser
2025-12-28 13:47:18 +01:00
Tim van der Meij
884cd20156
Merge pull request #20531 from calixteman/issue20523
Avoid to have a mail link with string having the format ddd@d.dddd
2025-12-28 13:43:39 +01:00
Tim van der Meij
2d7c056ab1
Merge pull request #20522 from calixteman/claude
Add CLAUDE.md generated with claude code
2025-12-28 13:41:03 +01:00
calixteman
22932f7b68
Fix the loca table length when there is enough space for it
It fixes #13425.
2025-12-28 11:21:40 +01:00
calixteman
1dffcf7f25
Remove undefStack stuff in the cff parser
I think it should have been removed with #2527 so it should be useless now.
Because of that stuff, some commands with a wrong number of arguments
weren't stripped out (see the pdf in #13850).
2025-12-27 16:59:29 +01:00
calixteman
eaf49c1057
Avoid to have a mail link with string having the format ddd@d.dddd
It fixes #20523.
2025-12-24 19:42:18 +01:00
calixteman
165a12cfac
Add CLAUDE.md generated with claude code 2025-12-23 16:13:51 +01:00
Tim van der Meij
33e857995c
Merge pull request #20519 from timvandermeij/ink-simplify
Introduce a helper function to draw a line in the ink editor integration tests
2025-12-23 15:46:59 +01:00
Tim van der Meij
dd6459c3d2
Merge pull request #20525 from calixteman/simplify_gradient
Avoid pattern creation with some basic gradients
2025-12-23 15:44:54 +01:00
calixteman
f66575ac72
Merge pull request #20527 from calixteman/rm_talos
Remove some files from talos tests because they aren't available on webarchive
2025-12-23 15:35:17 +01:00
calixteman
fbce8bf829
Remove some files from talos tests because they aren't available on webarchive 2025-12-23 15:27:30 +01:00
Tim van der Meij
8af3060887
Merge pull request #20526 from calixteman/issue20489
Fix the encoding for some missing chinese fonts
2025-12-23 15:10:35 +01:00
Tim van der Meij
7f1f5ecf09
Merge pull request #20521 from calixteman/issue20520
Dont' throw when adding page labels in thumbnails
2025-12-23 14:49:57 +01:00
Tim van der Meij
cc0dadaabc
Merge pull request #20524 from calixteman/simplify_regex_escaping
Simplify regex escaping
2025-12-23 14:46:46 +01:00
calixteman
91033c2199
Fix the encoding for some missing chinese fonts
It fixes #20489.
2025-12-23 14:05:27 +01:00
calixteman
4ff582acbe
Avoid pattern creation with some basic gradients
Some gradients are represented as patterns in PDF.js, because they
mustn't be affected by the current transform. But in most of the cases,
the gradient is attached to the origin and the current transform is very
basic (dilatation + orthogonal + translation). In those cases, we can
avoid creating the pattern because the gradient is transformed into
another gradient when the inverse transform is applied.
2025-12-23 10:36:05 +01:00
calixteman
9f4db380aa
Merge pull request #20514 from calixteman/issue20513
Avoid exception when trying to render some glyphs contours
2025-12-23 10:15:21 +01:00
calixteman
01531dac06
Simplify regex escaping 2025-12-23 10:00:36 +01:00
calixteman
fc4985819f
Avoid exception when trying to render some glyphs contours
It fixes #20513.
2025-12-22 23:45:34 +01:00
Calixte Denizet
6d95eaad28
Dont' throw when adding page labels in thumbnails
It fixes #20520.
2025-12-22 23:15:20 +01:00
Tim van der Meij
71140e7d0f
Introduce a helper function to draw a line in the ink editor integration tests
This commit extracts the logic to draw a line from one coordinate to
another to both remove code duplication (8% of the total number of lines
in the file are removed) and clarify the intent of the individual tests.
2025-12-22 19:41:39 +01:00
Tim van der Meij
509fcc84e2
Merge pull request #20518 from calixteman/issue20516
Escape punctuation signs in search query
2025-12-22 19:02:45 +01:00
Tim van der Meij
bdf5005203
Merge pull request #20501 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-12-22 18:13:43 +01:00
calixteman
923a778d26
Escape punctuation signs in search query
It fixes #20516.

The chars `*{}()[]\` are punctuation signs in regex, so they need to be escaped
when searching for them literally.
2025-12-22 17:41:53 +01:00
Tim van der Meij
65ae8f62da
Update translations to the most recent versions 2025-12-22 16:26:37 +01:00
Tim van der Meij
40a8fdbca9
Upgrade @types/node to version 25.0.1
This is a major version bump, but the patch at
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73924
doesn't indicate any breaking changes that should impact us as it mainly
includes support for Node.js 25.
2025-12-22 16:26:37 +01:00
Tim van der Meij
c5db38dd86
Update dependencies to the most recent versions 2025-12-22 16:26:37 +01:00
Tim van der Meij
f7f963ef97
Merge pull request #20517 from calixteman/fix_unit_test_import_map
Fix unit tests in adding a comma in the JSON for imports
2025-12-22 16:25:09 +01:00
Calixte Denizet
8bcbf22ad4
Fix unit tests in adding a comma in the JSON for imports 2025-12-22 16:01:30 +01:00
Tim van der Meij
db6b0cd728
Merge pull request #20502 from timvandermeij/node-25
Run the CI tests in Node.js version 25 too
2025-12-22 15:07:12 +01:00
Tim van der Meij
b92f742a26
Run the CI tests in Node.js version 25 too
Node.js version 25 is the current (non-LTS) release, see
https://github.com/nodejs/release#release-schedule, so we should run the
tests with that version too to help catch any possible issues sooner.
2025-12-21 18:19:29 +01:00
Tim van der Meij
010e52e15d
Merge pull request #20507 from mozilla/dependabot/github_actions/actions/upload-artifact-6
Bump actions/upload-artifact from 5 to 6
2025-12-20 14:18:53 +01:00
calixteman
cdf34b65a4
Merge pull request #20495 from calixteman/new_sidebar
Change the sidebar for a views manager
2025-12-15 18:45:49 +01:00
calixteman
2367196a00
Change the sidebar for a views manager
Update the styles and HTML to reflect the new views manager concept.
For now, nothing about split/merge functionality is implemented or visible.
The new styles for the outline, attachments, and layers will be added later.

The thumbnail view is now accessible with the keyboard.
2025-12-15 17:43:52 +01:00
calixteman
6517dede85
Merge pull request #20508 from calixteman/tree_follow_up
Fix some css in the tree view
2025-12-15 17:15:51 +01:00
Calixte Denizet
f42a120aac
Fix some css in the tree view
It's a follow-up of #20493.
And simplify a bit the js to have only one click listener in the tree instead of
having one on each toggler.
2025-12-15 16:19:10 +01:00
dependabot[bot]
0b60e9c213
Bump actions/upload-artifact from 5 to 6
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-15 12:05:28 +00:00
Andrii Vitiv
9677798ba0
Fix Worker was terminated error when loading is cancelled
Fixes https://github.com/mozilla/pdf.js/issues/11595, where cancelling loading with `loadingTask.destroy()` before it finishes throws a `Worker was terminated` error that CANNOT be caught.

When worker is terminated, an error is thrown here:

6c746260a9/src/core/worker.js (L374)

Then `onFailure` runs, in which we throw again via `ensureNotTerminated()`. However, this second error is never caught (and cannot be), resulting in console spam.

There is no need to throw any additional errors since the termination is already reported [here](6c746260a9/src/core/worker.js (L371-L373)), and `onFailure` is supposed to handle errors, not throw them.
2025-12-14 18:15:10 +02:00
Tim van der Meij
6c746260a9
Merge pull request #20500 from calixteman/fix_menu_rtl
Fix the position of the checkmark when the menu is displayed in RTL
2025-12-13 14:26:33 +01:00
Tim van der Meij
8b4fae0a84
Merge pull request #20482 from Uzair-Ahmed-Shah/fix-issue-20420
Fix #20420: Prevent double decoding of file URL parameter
2025-12-13 14:22:47 +01:00
Calixte Denizet
9de04ef3de
Fix the position of the checkmark when the menu is displayed in RTL 2025-12-12 17:33:20 +01:00
calixteman
ff4529d127
Merge pull request #20492 from nicolo-ribaudo/simplify-markedcontent-text-layer
Simplify positioning of elements inside `markedContent`
2025-12-12 17:29:33 +01:00
calixteman
f824f38e30
Merge pull request #20499 from AtiX/master
Improves text rendering performance by skipping unnecessary pattern calculations
2025-12-12 17:28:22 +01:00
Nicolò Ribaudo
7e0c9395fb
Simplify positioning of elements inside markedContent
By setting `display: contents` on `.markedContent` containers, they stop
affecting the layout of their children. This means that we can always
position text layer `<span>` elements using percentages relative to the
page dimensions, rather than having two separate code paths.

For some reason this breaks the workaround for text selection flickering
in Chrome/Safari, which can be fixed by setting `user-select: text` on
the `.endOfContent` div (only in Chrome/Safari, as it would break
selection in Firefox).
2025-12-12 11:37:45 +01:00
Arthur Silber
9bc4175bde Improves text rendering performance by skipping unnecessary pattern calculations 2025-12-12 07:07:31 +01:00
Tim van der Meij
4af193bbfc
Merge pull request #20491 from nicolo-ribaudo/move-text-scaling-logic-to-css
Move text layer scaling logic to CSS
2025-12-11 20:53:14 +01:00
Tim van der Meij
d946f05841
Merge pull request #20440 from Gaurang-5/master
Fix infinite loop in JBIG2 decoder with >4 referred-to segments
2025-12-09 20:42:51 +01:00
Tim van der Meij
6075f6ee75
Merge pull request #20494 from calixteman/simplify_sidebar_resize
Use only one resize observer in the the sidebar
2025-12-09 20:39:09 +01:00
Tim van der Meij
171fede558
Merge pull request #20493 from calixteman/mv_tree
Move the css for tree object in its own file
2025-12-09 20:37:32 +01:00
Nicolò Ribaudo
eb2b7c2c86
Move text layer scaling logic to CSS
This commit moves all the logic to scale up&down `<span>`s in the text
layer, introduced in #18283, to CSS.

The motivation for this change is that #18283 is still not enough for
all cases. That PR fixed the problem in Chrome&Firefox desktop, which
allow users to set an actual minimum font size in the browser settings.
However, other browsers (e.g. the Chrome-based WebView on Android) have
more complex logic and they scale up small text rather than simply
applying a minimum.

A workaround for that behavior is probably out of scope for PDF.js
itself as it only affects not officially supported platforms. However,
having access to the actual expected font height (through
`--font-height`) allows embedders of PDF.js to implement a workaround by
themselves.
2025-12-09 13:12:20 +01:00
Calixte Denizet
83fa8e9df1
Use only one resize observer in the the sidebar
If the max-width is 50vw, then resizing the viewport will change the sidebar width
and the callbacks need to be called in such a case.
2025-12-08 20:34:00 +01:00
Calixte Denizet
3e59e7535d
Move the css for tree object in its own file 2025-12-08 20:05:43 +01:00
Uzair-Ahmed-Shah
a25448502d Fix #20420: Prevent double decoding of file URL parameter 2025-12-08 22:37:52 +05:30
calixteman
f75812b0af
Merge pull request #20346 from ryzokuken/binary-fontpath
Encode FontPath data into an ArrayBuffer
2025-12-08 13:59:23 +01:00
calixteman
2bb30fb38a
Merge pull request #20490 from calixteman/dot.vscode
Add .vscode to .gitignore
2025-12-08 10:01:44 +01:00
Calixte Denizet
6de24bab92
Add .vscode to .gitignore 2025-12-08 09:58:22 +01:00
calixteman
5b22189c24
Merge pull request #20485 from calixteman/lint_mc_css
Add a new linting task in order to detect unused/unknown css variables in the Firefox build
2025-12-08 09:48:18 +01:00
Calixte Denizet
4bf759404c
Add a new linting task in order to detect unused/unknown css variables in the Firefox build
The goal is to be able to catch the errors before making a release.
And fix some css issues (especially the missing css code for the newly added menu.css)
2025-12-08 09:44:33 +01:00
Tim van der Meij
de5709a7cd
Merge pull request #20454 from xiaobai2017666/russian-char
Extend getGlyphMapForStandardFonts with some Russian entries (issue 20453)
2025-12-07 18:28:41 +01:00
Gaurang Bhatia
ac8d80a8e4 Fix infinite loop in JBIG2 decoder with >4 referred-to segments and add regression test 2025-12-07 06:46:16 +05:30
Ujjwal Sharma
3a85770af1 Encode FontPath data into an ArrayBuffer
Serialize FontPath commands into a binary format
and store it in an ArrayBuffer so that it can
eventually be stored in a SharedArrayBuffer.
2025-12-06 03:00:48 +05:30
calixteman
36de2d976d
Merge pull request #20476 from calixteman/thumbnail_scroll
Use HTMLElement.scrollIntoView when showing a thumbnail
2025-12-05 09:59:11 +01:00
calixteman
8a42b82ecd
Merge pull request #20474 from calixteman/sidebar_resize_callbacks
Add some callbacks when resizing a sidebar
2025-12-05 08:54:24 +01:00
calixteman
30984435fe
Merge pull request #20483 from calixteman/menu
Add a menu class in order to be used in the new UI for the merge feature
2025-12-05 08:53:19 +01:00
calixteman
f29e6a92a1
Merge pull request #20472 from calixteman/bug1998046_2
Inject the text from the text layer in the MathML tags when they're in the struct tree (bug 1998046)
2025-12-05 08:52:16 +01:00
calixteman
79c72f2c9a
Inject the text from the text layer in the MathML tags when they're in the struct tree (bug 1998046)
This way, the screen readers can read the math content properly.
The elements in the text layer will also have aria-hidden="true"
to avoid duplication.
2025-12-04 22:13:26 +01:00
Calixte Denizet
4c6cc0a042
Add a menu class in order to be used in the new UI for the merge feature 2025-12-04 22:12:10 +01:00
calixteman
8435e8f4bb
Merge pull request #20471 from calixteman/bug1998046_1
Aria-hide the text content part of a MathML formula (bug 1998046)
2025-12-04 22:09:34 +01:00
Calixte Denizet
c51ceb750b
Add some callbacks when resizing a sidebar
And use a ResizeObserver in order to avoid to have to compare the width with min/max which can be in
an other unit than px.
2025-12-04 21:40:46 +01:00
calixteman
615965f3d9
Merge pull request #20470 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-12-03 16:27:32 +01:00
Calixte Denizet
f9b857463b
Use HTMLElement.scrollIntoView when showing a thumbnail 2025-12-03 15:51:34 +01:00
calixteman
8e2963ccad
Merge pull request #20226 from lab-core/pointer-type-initialization
[Editor] Pointer type initialization only when the user changes the mode
2025-12-02 20:55:39 +01:00
Weismann
365cc69cae Extend getGlyphMapForStandardFonts with some Russian entries (issue 20453) 2025-12-01 10:21:27 +08:00
calixteman
87b3b5212e
Aria-hide the text content part of a MathML formula (bug 1998046)
It'll avoid to have the text content and the MathML content read by
screen readers.
2025-11-30 22:21:37 +01:00
Tim van der Meij
93a8312a37
Update translations to the most recent versions 2025-11-29 18:53:22 +01:00
Tim van der Meij
758856e664
Update dependencies to the most recent versions
Note that the `prettier` update requires a small bit of reformatting in
the Gulpfile so that linting keeps passing.
2025-11-29 18:52:33 +01:00
Tim van der Meij
4aca13e77a
Merge pull request #20469 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-11-29 16:00:32 +01:00
Tim van der Meij
0b051a7cad
Bump the stable version in pdfjs.config 2025-11-29 15:57:15 +01:00
Tim van der Meij
f44e5f0e63
Merge pull request #20462 from calixteman/improve_thumbnails
Slightly reduce the memory used by thumbnails
2025-11-29 15:36:46 +01:00
Calixte Denizet
423379e42f
Slightly reduce the memory used by thumbnails
In using a blob instead of a base64 string it's possible to reduce the memory.
And simplify a bit the thumbnails themselves.
2025-11-28 21:52:40 +01:00
Tim van der Meij
a965536485
Merge pull request #20468 from timvandermeij/trusted-publishing
Use OIDC trusted publishing in the GitHub Actions release workflow
2025-11-28 21:13:06 +01:00
Tim van der Meij
8eb747663a
Use OIDC trusted publishing in the GitHub Actions release workflow
This commit updates the release pipeline to use OIDC trusted publishing
now that we have configured it between GitHub Actions and NPM. This
solution allows us to remove the token variable (because there is no
longer a fixed token) and provenance flag (because provenance
attestations are generated by default with this approach); refer to
https://docs.npmjs.com/trusted-publishers for more information.
2025-11-28 21:01:13 +01:00
calixteman
ec5330f78c
Merge pull request #20465 from calixteman/update_char_to_nfkc
Fix the regex string used to find the chars to normalize with NFKC when searching
2025-11-28 16:59:23 +01:00
calixteman
925fc3d8f2
Merge pull request #20467 from calixteman/make_sidebar
Create a sidebar object
2025-11-28 16:27:44 +01:00
Calixte Denizet
45578aa8f5
Create a sidebar object
For now its use is limited to the comment sidebar but it'll be used for the new one
containing the thumbnails.
And make the sidebar more accessible with the keyboard or a screen reader.
2025-11-28 16:22:26 +01:00
Calixte Denizet
eee20cf138
Fix the regex string used to find the chars to normalize with NFKC when searching
ICU has been updated in Firefox (see https://bugzilla.mozilla.org/show_bug.cgi?id=2000225).
The char `0xA7F1` is now alphabetic and can be normalized as a "S".
2025-11-28 16:19:43 +01:00
Tim van der Meij
907cceb4ab
Merge pull request #20460 from calixteman/issue20452
[Editor] Allow to save an edited comment in using CTRL+Enter shortcut.
2025-11-27 21:37:07 +01:00
Tim van der Meij
40b52fa43a
Merge pull request #20458 from calixteman/fix_firstchild
Don't use firstChild/lastChild when getting elements (follow-up of #20447)
2025-11-27 21:34:56 +01:00
Tim van der Meij
08074cf024
Merge pull request #20450 from Mario34/update-dependencies
Include missing `cached-iterable` dev dependency in `package.json`
2025-11-27 21:16:21 +01:00
Tim van der Meij
956aa7efad
Merge pull request #20459 from mozilla/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 5 to 6
2025-11-27 21:07:51 +01:00
Calixte Denizet
b6fcb523c5
[Editor] Allow to save an edited comment in using CTRL+Enter shortcut. 2025-11-24 20:20:31 +01:00
dependabot[bot]
f6ad1a5610
Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 12:42:52 +00:00
Mario34
0bad4e938e Include missing cached-iterable dev dependency in package.json
This dependency got introduced during the move to Fluent for
localization (bug 1858715), but it wasn't added to `package.json`
at the time. This worked because other dependencies already
installed it, but we shouldn't rely on that, so this commit
explicitly includes it in `package.json` instead.

Fixes 66982a2a.
2025-11-24 09:24:20 +08:00
calixteman
029cae2ad4 Don't use firstChild/lastChild when getting elements (follow-up of #20447) 2025-11-22 21:10:32 +01:00
calixteman
ec71e4ed65
Merge pull request #20455 from calixteman/bug1998843
[XFA] Set default max value in occur tag to -1 (bug 1998843)
2025-11-22 20:59:04 +01:00
calixteman
d4b6464675
Merge pull request #20456 from calixteman/issue20225
When searching for a group of punctuation signs, only add extraspaces around the group
2025-11-22 15:25:25 +01:00
calixteman
b41959bde8
Merge pull request #20413 from sachiniyer/siyer/fix-annotation-editor-deletion
fix: deleteAnnotationElement takes a full editor object
2025-11-21 22:28:06 +01:00
Sachin Iyer
464dae11ac fix: deleteAnnotationElement takes a full editor object 2025-11-21 11:32:29 -08:00
Calixte Denizet
039b9e4df3 When searching for a group of punctuation signs, only add extraspaces around the group
It fixes #20225.

And only add the extra spaces where it's required depending on their position in the query string.
2025-11-21 18:59:37 +01:00
Calixte Denizet
516aea5562 [XFA] Set default max value in occur tag to -1 (bug 1998843) 2025-11-21 17:53:38 +01:00
calixteman
ddf3a989ca
Merge pull request #20427 from Aditi-1400/issue-20426
Add setter for some FontFaceObject properties
2025-11-20 20:49:30 +01:00
Aditi
7743d11594 Add setter for some FontFaceObject properties 2025-11-20 22:47:57 +05:30
Tim van der Meij
8f0c62990e
Merge pull request #20447 from calixteman/lint_html
Lint and format the HTML in using Prettier
2025-11-18 21:11:52 +01:00
Tim van der Meij
20393c4c57
Merge pull request #20449 from mozilla/dependabot/npm_and_yarn/js-yaml-3.14.2
Bump js-yaml from 3.14.1 to 3.14.2
2025-11-18 20:51:32 +01:00
dependabot[bot]
b392cbf3c4
Bump js-yaml from 3.14.1 to 3.14.2
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.1 to 3.14.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.14.1...3.14.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-18 19:46:50 +00:00
Tim van der Meij
1c4c16f18f
Merge pull request #20448 from mozilla/dependabot/npm_and_yarn/multi-12cb0b0c21
Bump glob
2025-11-18 20:45:28 +01:00
dependabot[bot]
447aab7fe6
Bump glob
Bumps  and [glob](https://github.com/isaacs/node-glob). These dependencies needed to be updated together.

Updates `glob` from 10.4.5 to 10.5.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.4.5...v10.5.0)

Updates `glob` from 11.0.3 to 11.1.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.4.5...v10.5.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 10.5.0
  dependency-type: indirect
- dependency-name: glob
  dependency-version: 11.1.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-18 17:43:29 +00:00
Calixte Denizet
b9368b576d Lint and format the HTML in using Prettier
The linter found some issues in viewer.html with </input> which isn't required
and a missing closing div in test/resources/reftest-analyzer.html.
The HTML can now be nicely formatted. In order to not break the build for
mozilla-central, the preprocessor has been fixed in order to take into account
the white spaces at the beginning of a comment line.
And finally, make .prettierrc (which is supposed to be either json or yaml)
itself lintable.
2025-11-18 17:22:50 +01:00
calixteman
264046736d
Merge pull request #20151 from maettuu/reg-test-pr-19184
Add regression test for PR 19184
2025-11-18 09:26:11 +01:00
calixteman
c6b61a34e6
Merge pull request #20436 from calixteman/merge_struct_trees
Merge the structure trees coming from different pdfs (bug 1997379)
2025-11-17 20:10:06 +01:00
calixteman
b20bd9061e
Merge pull request #20405 from calixteman/add_telemetry_tagged_pdf
Add telemetry for tagged pdfs (bug 1997134)
2025-11-17 20:09:40 +01:00
Calixte Denizet
e13a618df3 Merge the structure trees coming from different pdfs (bug 1997379) 2025-11-17 19:56:36 +01:00
Calixte Denizet
50c48cf11b Add telemetry for tagged pdfs (bug 1997134) 2025-11-17 19:47:16 +01:00
Tim van der Meij
603e3a8f3e
Merge pull request #20430 from timvandermeij/freetext-helper
Introduce a helper function to create a freetext editor in the integration tests
2025-11-16 14:50:17 +01:00
Tim van der Meij
f880f4b803
Merge pull request #20429 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-11-16 14:49:52 +01:00
calixteman
e7288dca8e
Merge pull request #20431 from calixteman/split_merge_p4
Add a wrapper for the new xref in order to be able to get some values from cloned dictionaries
2025-11-11 21:47:42 +01:00
Tim van der Meij
bc4d90711a
Merge pull request #20432 from calixteman/version
Version entry in the catalog has to be a name and not a string
2025-11-11 20:31:59 +01:00
Calixte Denizet
a98b0b1fb5 Version entry in the catalog has to be a name and not a string 2025-11-09 15:34:57 +01:00
Calixte Denizet
65881f0e21 Add a wrapper for the new xref in order to be able to get some values from cloned dictionaries 2025-11-09 15:28:43 +01:00
calixteman
3676ffde17
Merge pull request #20421 from calixteman/split_merge_p3
Update the named page destinations when some pdf are combined (bug 1997379)
2025-11-09 15:19:05 +01:00
Tim van der Meij
b5b821365e
Introduce a helper function to create a freetext editor in the integration tests
Doing so has a number of advantages:

- it removes code duplication, thereby improving readability;
- it removes hardcoded editor IDs, by using the `getNextEditorId` helper
  function that was previously introduced for the highlight editor
  integration tests, thereby improving readability and reusability;
- it removes potential for intermittent failures by not proceeding until
  the freetext editor is fully created and all assertions pass, which
  didn't happen consistently before because the code wasn't centralized.
2025-11-09 14:32:24 +01:00
Tim van der Meij
398ba0331c
Update translations to the most recent versions 2025-11-08 19:27:15 +01:00
Tim van der Meij
7fc23de26f
Update dependencies to the most recent versions 2025-11-08 19:26:17 +01:00
Calixte Denizet
37f4712f7e Update the named page destinations when some pdf are combined (bug 1997379)
and remove link annotations pointing on a deleted page.
2025-11-07 18:22:19 +01:00
calixteman
57334bd205
Merge pull request #20411 from calixteman/split_merge_p2
Update the page labels tree when a pdf is extracted (bug 1997379)
2025-11-07 17:21:38 +01:00
Calixte Denizet
ad97c5b816 Update the page labels tree when a pdf is extracted (bug 1997379) 2025-11-07 15:59:57 +01:00
calixteman
85ed401b82
Merge pull request #20409 from calixteman/split_merge_p1
Add the possibility to create a pdf from different ones (bug 1997379)
2025-11-07 15:05:52 +01:00
Calixte Denizet
bc87f4e8d6 Add the possibility to create a pdf from different ones (bug 1997379)
For now it's just possible to create a single pdf in selecting some pages in different pdf sources.
The merge is for now pretty basic (it's why it's still a WIP) none of these data are merged for now:
 - the struct trees
 - the page labels
 - the outlines
 - named destinations
For there are 2 new ref tests where some new pdfs are created: one with some extracted pages and an other
one (encrypted) which is just rewritten.
The ref images are generated from the original pdfs in selecting the page we want and the new images are
taken from the generated pdfs.
2025-11-07 14:57:48 +01:00
calixteman
2201777d0f
Merge pull request #20425 from calixteman/only_parese_parenttree_one_time
Create the number tree for the ParentTree only one time
2025-11-07 09:45:17 +01:00
Calixte Denizet
04db38558a Create the number tree for the ParentTree only one time 2025-11-05 17:49:55 +01:00
legraina
396cff5652
Pointer type initialization only when the user changes the mode
Clear the pointer type of CurrentPointers outside of the DrawingEditor to always keep the same, until the user changes the mode.
One of the goal is to keep the same pointer type in case of a refresh of the page or if the user changes the pdf document.
2025-11-02 08:56:18 -05:00
Tim van der Meij
0a2680bca6
Merge pull request #20414 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-11-02 13:14:45 +01:00
Tim van der Meij
1febf9e30f
Bump the stable version in pdfjs.config 2025-11-02 13:11:00 +01:00
calixteman
2cc809ade2
Merge pull request #20213 from lab-core/pointer-type
[Editor] A new CurrentPointers class to store current pointers used by the editor
2025-11-01 19:17:32 +01:00
Tim van der Meij
6e7a6eb52b
Merge pull request #20408 from calixteman/fix_mml_encoding
Don't set the MathML namespace for attributes in MathML tags (bug 1997343)
2025-11-01 14:58:15 +01:00
Tim van der Meij
c696648826
Merge pull request #20404 from mozilla/revert-20031-telemetry_signature_certificate
Revert "Add some telemetry in order to know what are the certificates used in pdfs (bug 1973573)"
2025-11-01 14:55:07 +01:00
Calixte Denizet
6db23139be Don't set the MathML namespace for attributes in MathML tags (bug 1997343)
And by default a XML file is UTF-8 encoded so correctly decode the embedded file.
2025-10-30 18:37:19 +01:00
calixteman
27bb5fb173
Merge pull request #20406 from gregtatum/text-extractor
Add text extractor as an external service
2025-10-30 17:23:18 +01:00
Greg Tatum
b7708da368 Address review feedback 2025-10-30 09:48:46 -05:00
calixteman
7fc5706e16
Merge pull request #20327 from edoardocavazza/collect-list-table-children
Collect all child nodes of lists and tables in StructTree
2025-10-29 21:09:52 +01:00
Greg Tatum
26360c3e63 Add text extractor for an external service 2025-10-29 13:15:51 -05:00
Edoardo Cavazza
a932a063ea Revert unwanted change 2025-10-29 17:34:34 +01:00
Edoardo Cavazza
17cdd9b1e7 Move tables test to specific struct tree spec file 2025-10-29 17:33:36 +01:00
Edoardo Cavazza
d04832a82f Add test case for empty cells 2025-10-29 17:31:49 +01:00
Edoardo Cavazza
4c22b99df3 Collect all child nodes of lists and tables 2025-10-29 17:30:46 +01:00
calixteman
de7179fd74
Merge pull request #20394 from CoelacanthusHex/feat/pt-astra-serif
Add the font PT Astra Serif as a possible substitution for Times New Roman
2025-10-29 16:30:34 +01:00
calixteman
aeceee1df3
Revert "Add some telemetry in order to know what are the certificates used in pdfs (bug 1973573)" 2025-10-29 15:41:34 +01:00
calixteman
4a660967bd
Merge pull request #20396 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-10-29 14:25:37 +01:00
Coelacanthus
6590063614
Add the font PT Astra Serif as a possible substitution for Times New Roman
Metric-compatible font with Times New Roman created by ParaType, based on
their serif font PT Serif, released under OFL-1.1 license.

https://www.paratype.com/fonts/pt/pt-astra-serif

Signed-off-by: Coelacanthus <uwu@coelacanthus.name>
2025-10-29 17:15:31 +08:00
Tim van der Meij
3d175f2f48
Merge pull request #20400 from mozilla/dependabot/github_actions/actions/upload-artifact-5
Bump actions/upload-artifact from 4 to 5
2025-10-28 19:57:39 +01:00
dependabot[bot]
deb74b9062
Bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 13:01:42 +00:00
Tim van der Meij
982e7ea531
Update translations to the most recent versions 2025-10-26 16:42:41 +01:00
Tim van der Meij
1f7d3974e1
Upgrade eslint-plugin-unicorn to version 62.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v62.0.0
doesn't indicate any breaking changes that should impact us.
2025-10-26 16:41:13 +01:00
Tim van der Meij
cbd2b3d426
Update dependencies to the most recent versions 2025-10-26 16:40:07 +01:00
calixteman
520363b350
Merge pull request #20384 from calixteman/bug1937438
Make MathML elements visible in the struct tree (bug 1937438)
2025-10-23 17:55:42 +02:00
Calixte Denizet
e5a62c8d06 Make MathML elements visible in the struct tree (bug 1937438)
It'll help to make math equations "visible" for screen readers.
MS Office has a specific way to add some MathML code to struc tree leaf
and this patch handles it.
2025-10-23 16:29:01 +02:00
calixteman
f6317ddbbb
Merge pull request #20389 from calixteman/bug1995579
[Editor] Make sure the left (resp. right) corner of the popup is visible when in LTR (resp. RTL) (bug 1995579)
2025-10-23 09:01:50 +02:00
calixteman
638861008f
Merge pull request #20388 from calixteman/bug1995705
[Editor] Avoid to have several Undo entries in the context menu (bug 1995705)
2025-10-23 09:01:19 +02:00
calixteman
1b5ecd36e4
Merge pull request #20387 from calixteman/bug1995721
[Editor] Fix the css of the link in the comment sidebar (bug 1995721)
2025-10-23 09:00:48 +02:00
calixteman
64f6fb9049
Merge pull request #20386 from calixteman/bug1995766
[Editor] Fix the css of the button to close the comment sidebar (bug 1995766)
2025-10-23 09:00:21 +02:00
Calixte Denizet
cb36dc28a7 [Editor] Make sure the left (resp. right) corner of the popup is visible when in LTR (resp. RTL) (bug 1995579) 2025-10-22 22:47:20 +02:00
Calixte Denizet
19cbdba434 [Editor] Avoid to have several Undo entries in the context menu (bug 1995705) 2025-10-22 19:45:52 +02:00
Calixte Denizet
ad9bcabee3 [Editor] Fix the css of the link in the comment sidebar (bug 1995721) 2025-10-22 16:18:37 +02:00
Calixte Denizet
abfa1495d5 [Editor] Fix the css of the button to close the comment sidebar (bug 1995766) 2025-10-22 16:05:26 +02:00
calixteman
1a8689b9be
Merge pull request #20340 from Aditi-1400/serialize-pattern-ab
Serialize pattern data into ArrayBuffer
2025-10-22 11:05:22 +02:00
legraina
a932804fb5
A new CurrentPointers class to store current pointers used by the editor
Move current pointer field of DrawingEditor to CurrentPointer class in tools.js: The pointer types fields have been moved to a CurrentPointer object in tools.js. This object is used by eraser.js and ink.js.
Only reset pointer type when user select a new mode: Clear the pointer type when changing mode, instead of at the end of the session. It seems more stable, as the method is not called this way when the user changes pages. Also, clear the pointer type when the mode is changed by an event (the user changes the editor type), otherwise, the same pointer type is kept (the document is changed for example)
2025-10-21 17:00:08 -04:00
Tim van der Meij
a6934b478f
Merge pull request #20381 from mozilla/dependabot/github_actions/actions/setup-node-6
Bump actions/setup-node from 5 to 6
2025-10-21 20:22:31 +02:00
dependabot[bot]
6268f930ca
Bump actions/setup-node from 5 to 6
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-20 12:57:45 +00:00
calixteman
9f397a632c
Merge pull request #20378 from timvandermeij/integration-tests-aboutstacks
Don't use the `aboutstacks.pdf` file in the integration tests
2025-10-19 20:40:10 +02:00
calixteman
a40df9a5be
Merge pull request #20380 from timvandermeij/integration-tests-tweak-viewer-scroll
Tweak the "scroll into view" viewer integration test
2025-10-19 20:37:30 +02:00
calixteman
205fe258f2
Merge pull request #20355 from calixteman/highlight_span
Add a highlightSpan function in order to simplify a bit the integration tests
2025-10-19 20:35:52 +02:00
Calixte Denizet
9205305dbb Add a highlightSpan function in order to simplify a bit the integration tests 2025-10-19 19:37:41 +02:00
Tim van der Meij
4fd3bad67f
Tweak the "scroll into view" viewer integration test
On GitHub Actions this test could fail with `Expected 1.3125 to be less
than 1` due to slight differences in the decimals of the `rect.y` value.
However, for this check we're only really interested in full pixels, so
this commit rounds the value up to the next integer to not be affected
by small decimal differences so the test passes on GitHub Actions too.
2025-10-19 17:33:11 +02:00
Tim van der Meij
9ab4de5c04
Don't use the aboutstacks.pdf file in the integration tests
For the integration tests we prefer non-linked test cases because those
PDF files are directly checked into the Git repository and thus don't
need a separate download step that linked test cases do.

However, for the freetext and ink integration tests we currently use
`aboutstacks.pdf` which is a linked test case. Fortunately we don't need
to use it because for most tests we don't actually use any properties of
it: we only create editors on top of the canvas, but for that any PDF
file works, so we can simply use the non-linked `empty.pdf` file instead.

The only exception is the "aria-owns" test that needs a line of text from
the PDF file, so we move that particular test to a dedicated `describe`
block and adapt it to use the non-linked `attachment.pdf` file that just
contains a single line of text that can be used for this purpose.

The changes combined make 12 more integration tests run out-of-the-box
after a Git clone, which also simplifies running on GitHub Actions.
2025-10-19 13:05:46 +02:00
Tim van der Meij
b87c999815
Merge pull request #20379 from calixteman/fix_after_20373
Fix stream use when getting the text (follow-up of #20373)
2025-10-19 13:04:13 +02:00
Calixte Denizet
199b3d04df Fix stream use when getting the text (follow-up of #20373) 2025-10-18 22:58:27 +02:00
calixteman
b0e8c39f31
Merge pull request #20373 from calixteman/get_original_stream
Use stream for whatever substrem in stream classes
2025-10-18 14:53:49 +02:00
Tim van der Meij
b2810513c9
Merge pull request #20377 from calixteman/fix_integration_test1
[Editor] Fix integration test after #20372
2025-10-18 13:43:25 +02:00
Calixte Denizet
05f368056d Use stream for whatever substrem in stream classes
and add a method in order to get the original stream.
When writing an existing stream it'll help to have the original one instead of the filtered one.
2025-10-17 22:26:05 +02:00
Tim van der Meij
bd0bf03a68
Merge pull request #20375 from calixteman/fix_color_copy_paste
[Editor] Make sure the color picker has the right color when pasting an editor
2025-10-17 21:05:44 +02:00
Calixte Denizet
c2535b32fe [Editor] Fix integration test after #20372 2025-10-17 20:44:02 +02:00
Tim van der Meij
bc9d34b45c
Merge pull request #20374 from calixteman/bug1995028
[Editor] FreeText annotations aren't supposed to have an attached popup so disable commenting for them (bug 1995028)
2025-10-17 20:40:53 +02:00
Calixte Denizet
97fec3ab81 [Editor] Make sure the color picker has the right color when pasting an editor 2025-10-17 19:37:05 +02:00
Calixte Denizet
18a7a82c29 [Editor] FreeText annotations aren't supposed to have an attached popup so disable commenting for them (bug 1995028) 2025-10-17 18:33:15 +02:00
calixteman
928a758811
Merge pull request #20372 from calixteman/bug1994958
[Editor] Fix the tooltip of the comment button when in the editor toolbar (bug 1994958)
2025-10-17 16:20:30 +02:00
Calixte Denizet
54ffd860ec [Editor] Fix the tooltip of the comment button when in the editor toolbar (bug 1994958) 2025-10-17 15:47:55 +02:00
Tim van der Meij
1c1becf60b
Merge pull request #20369 from calixteman/bug1994738
[Editor] Correctly focus the annotation once the comment has been removed in the annotation layer (bug 1994738)
2025-10-16 20:43:55 +02:00
Tim van der Meij
455e89a295
Merge pull request #20367 from calixteman/bin_format_font_path
Use a binary format for the glyph paths
2025-10-16 20:39:29 +02:00
Calixte Denizet
fd3f7528b6 [Editor] Correctly focus the annotation once the comment has been removed in the annotation layer (bug 1994738) 2025-10-16 16:12:36 +02:00
Calixte Denizet
bb2a1126e6 Use a binary format for the glyph paths
We used a SVG string which can be pass to the Path2D ctor but it's a bit slower than
building the path step by step.
Having numerical data instead of a string will help the font data serialization.
2025-10-16 15:52:51 +02:00
calixteman
745e42701f
Merge pull request #20361 from nicolo-ribaudo/reset-setTextMatrix
Reset `sameLineText` dependencies data on `setTextMatrix`
2025-10-16 09:00:46 +02:00
calixteman
238694891c
Merge pull request #20356 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-10-16 08:17:41 +02:00
calixteman
79a7396583
Merge pull request #20363 from timvandermeij/python-3.14
Use Python 3.14 in the GitHub workflows
2025-10-16 08:16:06 +02:00
Nicolò Ribaudo
d79651e797
Reset sameLineText dependencies data on setTextMatrix
The position of the text rendered by `showText` is affected
incrementally by the preceding `showText` operations "on the same line".
For this reason, we keep track of all of them (with their dependencies)
in `sameLineText`.

`sameLineText` can be reset whenever we explicitly position the text
somewhere else. We were previously only doing it for `moveText`, and
this patch updates the code to also do it on `setTextMatrix` (which
resets `this.current.x/y` in `CanvasGraphics` to 0).

The complexity of subsequent `sameLineText` operations dependency
tracking grows quadratically with the number of operations on the same
line, so this patch fixes the performance problem when there are whole
pages of text that only use `setTextMatrix` and not `moveText`.
2025-10-15 17:56:30 +02:00
Tim van der Meij
0528885029
Use Python 3.14 in the GitHub workflows
Python 3.14 is the current stable version, released on October 7th. The
dependencies we use also support Python 3.14 now, most importantly
`fonttools` for which the OS-specific builds have been published (see
the `cp314` wheels on https://pypi.org/project/fonttools/#files).
2025-10-14 21:48:21 +02:00
Tim van der Meij
6eef518883
Update translations to the most recent versions 2025-10-14 20:26:53 +02:00
Tim van der Meij
6bd5c7cdb3
Update dependencies to the most recent versions 2025-10-14 20:26:50 +02:00
Tim van der Meij
3eca60735b
Merge pull request #20358 from calixteman/intersector
Very slightly improve intersector performance
2025-10-14 20:25:40 +02:00
Tim van der Meij
30c04550c8
Merge pull request #20357 from mozilla/dependabot/github_actions/github/codeql-action-4
Bump github/codeql-action from 3 to 4
2025-10-14 20:21:13 +02:00
Calixte Denizet
aab521327b Very slightly improve intersector performance
It just avoid useless computations.
2025-10-13 14:55:44 +02:00
dependabot[bot]
a3b5fcfa9d
Bump github/codeql-action from 3 to 4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-13 12:41:18 +00:00
Aditi
fa631806bf Serialize pattern data into ArrayBuffer
Follow up on https://github.com/mozilla/pdf.js/pull/20197,
This serializes pattern data into an ArrayBuffer which is
then transferred from the worker to the main thread.

It sets up the stage for us to eventually switch to a
SharedArrayBuffer in the future.
2025-10-11 01:58:07 +05:30
calixteman
30fdf16071
Merge pull request #20354 from Aditi-1400/use-enum
Use enums instead of string for mesh shading figure type
2025-10-10 18:49:50 +02:00
calixteman
0d8a300777
Merge pull request #20353 from calixteman/improve_intersector
[Annotation] Improve the performance of the code for getting glyphs which belongs to annotations bounding boxes (bug 1987914)
2025-10-10 13:31:03 +02:00
Calixte Denizet
c4d436764c [Annotation] Improve the performance of the code for getting glyphs which belongs to annotations bounding boxes (bug 1987914)
Instead of looking at every bbox, we use a grid (64x64) where each cell of the grid is associated with the bboxes
touching it.
In order to get the potential bboxes containing a point, we just have to compute the number of the cell containing
it and in using the associated described above, we can quickly know if the point is contained.
With the pdf in the mentioned bug, it's ~20 times faster.
2025-10-10 13:28:18 +02:00
calixteman
c8d8f9fbb4
Merge pull request #20352 from calixteman/improve_struct_tree_parser
Improve performance of the struct tree build (bug 1987914)
2025-10-10 13:27:11 +02:00
Aditi
e8d08c941c Use enums instead of string for mesh shading figure type 2025-10-10 04:21:03 +05:30
Tim van der Meij
0fedfc9ceb
Merge pull request #20351 from calixteman/avoid_null
[Editor] Avoid to have a null button in the DOM when there's no comment manager
2025-10-09 20:57:20 +02:00
calixteman
16630b61bd
Merge pull request #20350 from calixteman/refactor_annotation_layer_a11y
[Annotation] Use the annotations rect in order to fix the order in the DOM (bug 1987914)
2025-10-09 20:53:08 +02:00
Calixte Denizet
f5a6dd4164 [Annotation] Use the annotations rect in order to fix the order in the DOM (bug 1987914)
It's just a partial fix for bug 1987914 but the time spent to add the annotations in the DOM
is divided by 5.
2025-10-09 17:43:49 +02:00
Calixte Denizet
9797dc0eb4 Improve performance of the struct tree build (bug 1987914)
For the pdf in bug 1987914, the overall time spent in `addTopLevelNode` is dropping from ~6s to ~70ms.
2025-10-09 16:08:56 +02:00
Calixte Denizet
16d0077387 [Editor] Avoid to have a null button in the DOM when there's no comment manager 2025-10-09 09:25:43 +02:00
calixteman
8ba18075f2
Merge pull request #20344 from calixteman/bug1992770
[Editor] Make sure that annotation positions in the DOM respect the visual order (bug 1992770)
2025-10-08 16:55:01 +02:00
calixteman
152324fdbd
Merge pull request #20347 from calixteman/bug1990826
[Editor] Remove the role radio for the editing buttons (bug 1990826)
2025-10-08 15:15:51 +02:00
Calixte Denizet
41dea1e38b [Editor] Make sure that annotation positions in the DOM respect the visual order (bug 1992770) 2025-10-08 15:11:09 +02:00
Calixte Denizet
2d759a5f4b [Editor] Remove the role radio for the editing buttons (bug 1990826) 2025-10-08 14:45:28 +02:00
calixteman
d83cbb28a9
Merge pull request #20341 from calixteman/bug1992868
[Editor] Make sure all editors are focusable with the keyboard (bug 1992868)
2025-10-07 22:34:10 +02:00
calixteman
262741634f
Merge pull request #20343 from calixteman/bug1992832
[Editor] Make sure the editor is focused after the comment has been deleted (bug 1992832)
2025-10-07 22:33:04 +02:00
Calixte Denizet
76e0de6c08 [Editor] Make sure the editor is focused after the comment has been deleted (bug 1992832) 2025-10-07 21:31:09 +02:00
Calixte Denizet
5c28346abc [Editor] Make sure all editors are focusable with the keyboard (bug 1992868) 2025-10-07 21:15:26 +02:00
Tim van der Meij
1df2ee68b7
Merge pull request #20342 from calixteman/bug1992987
[Editor] Make sure that comment stuff is removed when an editor is deleted (bug 1992987)
2025-10-07 20:55:53 +02:00
Calixte Denizet
be987f2fbf [Editor] Make sure that comment stuff is removed when an editor is deleted (bug 1992987) 2025-10-07 19:09:48 +02:00
Tim van der Meij
f4104326f3
Merge pull request #20338 from calixteman/test_date_tz
Add a test for PR #20320
2025-10-05 20:24:02 +02:00
calixteman
7f92a6e2be
Merge pull request #20335 from timvandermeij/setDims
[Editor] Remove obsolete arguments for `setDims` calls in the highlight code
2025-10-05 19:43:07 +02:00
calixteman
66763b33a4
Merge pull request #20337 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-10-05 19:41:43 +02:00
Calixte Denizet
25ce14042f Add a test for PR #20320 2025-10-05 19:38:37 +02:00
Tim van der Meij
44c498549c
Merge pull request #20339 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-10-05 19:07:21 +02:00
Tim van der Meij
66bf335a6c
Bump the stable version in pdfjs.config 2025-10-05 19:04:33 +02:00
Tim van der Meij
b9d9523871
Update translations to the most recent versions 2025-10-05 14:41:45 +02:00
Tim van der Meij
4f50eacdfc
Update dependencies to the most recent versions 2025-10-05 14:41:05 +02:00
Tim van der Meij
68ed5be9ac
[Editor] Remove obsolete arguments for setDims calls in the highlight code
The `width` and `height` arguments for `setDims` have been removed in
PR #20285, but for two calls in the highlight code they remained. This
commit removes them as they are no longer used in the method itself.

Fixes 0722faa9.
2025-10-05 13:52:09 +02:00
calixteman
f56dc86014
Merge pull request #20333 from calixteman/issue20302
Fix incremental saving with hybrid references
2025-10-04 20:31:09 +02:00
Calixte Denizet
19ff148163 Fix incremental saving with hybrid references
This patch removes some previous fixes which are now likely fixed by #17636.

Fixes #20302.
2025-10-04 18:31:55 +02:00
Tim van der Meij
6c3036836f
Merge pull request #20301 from mozilla/dependabot/npm_and_yarn/tar-fs-3.1.1
Bump tar-fs from 3.1.0 to 3.1.1
2025-10-04 14:59:34 +02:00
Tim van der Meij
d27cd6a4a1
Merge pull request #20334 from calixteman/issue20319
Only apply word spacing when there is a 0x20 in the text chunk
2025-10-04 14:47:30 +02:00
Calixte Denizet
4d15bfec0d Only apply word spacing when there is a 0x20 in the text chunk
Fixes #20319.
2025-10-03 22:18:02 +02:00
calixteman
4e7db4f59c
Merge pull request #20332 from calixteman/bug1992385
[Editor] Slightly move the resizer in the sidebar comment in order to make it easier to use (bug 1992385)
2025-10-03 18:36:52 +02:00
Calixte Denizet
3ecefa5e0c [Editor] Slightly move the resizer in the sidebar comment in order to make it easier to use (bug 1992385)
And highlight the resizer when hovering it.
2025-10-03 17:07:42 +02:00
calixteman
e1de28c866
Merge pull request #20328 from calixteman/fix_dialog_position
[Editor] Make sure the comment dialog always have relative coordinates between 0% and 100%
2025-10-03 09:17:09 +02:00
calixteman
af542a84cc
Merge pull request #20329 from calixteman/fix_annotation_layer_driver
Fix the creation of the annotation layer in the ref tests
2025-10-02 22:04:10 +02:00
Calixte Denizet
17993a0c5d Fix the creation of the annotation layer in the ref tests 2025-10-02 20:27:29 +02:00
Calixte Denizet
2aef871d5d [Editor] Make sure the comment dialog always have relative coordinates between 0% and 100%
This way, when the window is resized, the dialog stay visible.
2025-10-02 18:55:55 +02:00
calixteman
3234912c86
Merge pull request #20224 from james-atticus/improve-serif-fallback-font-name-matching
Improve serif fallback font name matching
2025-10-01 19:58:13 +02:00
calixteman
9d917b2896
Merge pull request #20323 from calixteman/bug1991482
Increase the rendering quality of the detail view (bug 1991482)
2025-10-01 19:29:17 +02:00
Calixte Denizet
91e2f6c400 Increase the rendering quality of the detail view (bug 1991482)
But keep a lower quality when enableOptimizedPartialRendering is true because we need to compensate the time
used to compute the bboxes and since subsequent rendering are faster it's more acceptable to see
a lower quality image for few tenths of seconds.
2025-10-01 16:40:41 +02:00
calixteman
7fa50712c9
Merge pull request #20322 from calixteman/bug1990491
[Editor] Add the possibility to unselect a comment from the sidebar
2025-10-01 15:24:03 +02:00
Calixte Denizet
bb556dcb5c [Editor] Add the possibility to unselect a comment from the sidebar 2025-10-01 14:36:12 +02:00
calixteman
042e821bec
Merge pull request #20320 from calixteman/bug1991584
[Annotation] Fix some timezone issues when getting a date from the date picker (bug 1991584)
2025-10-01 00:41:17 -11:00
calixteman
cd66ecf3d2
Merge pull request #20318 from calixteman/fix_editorStats
[Editor] Avoid an error when getting the editors telemetry data
2025-10-01 00:40:35 -11:00
calixteman
d18289bccb
Merge pull request #20321 from calixteman/bug1989420
[Editor] Add a fake annotation (in the annotation layer) associated with an editor in order to be able to show the comment button (bug 1989420)
2025-10-01 00:40:13 -11:00
Calixte Denizet
12066af578 [Editor] Add a fake annotation (in the annotation layer) associated with an editor in order to be able to show the comment button (bug 1989420) 2025-10-01 09:08:57 +02:00
Calixte Denizet
7b9cde1daf [Annotation] Fix some timezone issues when getting a date from the date picker (bug 1991584) 2025-09-30 11:07:31 +02:00
Calixte Denizet
678aec9890 [Editor] Avoid an error when getting the editors telemetry data 2025-09-29 16:41:15 +02:00
calixteman
ec4f616d21
Merge pull request #20314 from calixteman/rm_useless_sidebar_css
[Editor] Remove useless sidebar css
2025-09-27 14:10:57 +02:00
Calixte Denizet
7041459fc0 [Editor] Remove useless sidebar css 2025-09-26 22:32:54 +02:00
calixteman
e3a5f61234
Merge pull request #20313 from calixteman/bug1991172
[Editor] Add some telemetry for the commenting feature (bug 1991172)
2025-09-26 21:07:01 +02:00
Calixte Denizet
02ddf277ab [Editor] Add some telemetry for the commenting feature (bug 1991172) 2025-09-26 21:04:09 +02:00
calixteman
f64ece2a97
Merge pull request #20312 from calixteman/bug1991029
[Annotation] In reading mode with new commment stuff enabled, use the comment popup for annotations without a popup but with some contents (bug 1991029)
2025-09-26 20:26:40 +02:00
Calixte Denizet
7fc7b79cd0 [Annotation] In reading mode with new commment stuff enabled, use the comment popup for annotations without a popup but with some contents (bug 1991029) 2025-09-26 18:24:55 +02:00
calixteman
91384738f8
Merge pull request #20311 from calixteman/fix_focus_comment_button
[Editor] Give the focus to the comment button after editing in reading mode
2025-09-26 18:24:32 +02:00
Calixte Denizet
f547e834e1 [Editor] Give the focus to the comment button after editing in reading mode 2025-09-26 17:18:37 +02:00
calixteman
d5fb95cda1
Merge pull request #20309 from calixteman/update_deps
Update dependencies
2025-09-26 14:02:50 +02:00
calixteman
28fb4f0f47
Merge pull request #20310 from calixteman/bug1990762
[Editor] Show the comments in the sidebar in the chronological order,newest to oldest (bug 1990762)
2025-09-26 11:09:27 +02:00
Calixte Denizet
f854770806 [Editor] Show the comments in the sidebar in the chronological order, newest to oldest (bug 1990762) 2025-09-26 10:10:43 +02:00
calixteman
101fa6201c
Merge pull request #20308 from calixteman/bug1990454
[Editor] Fix the URL for the 'Learn more' link in the comment sidebar (bug 1990454)
2025-09-26 09:25:00 +02:00
Calixte Denizet
893de3e754 Update dependencies 2025-09-26 09:23:17 +02:00
calixteman
7051fd0215
Merge pull request #20307 from calixteman/bug1990872
[Editor] Make sure the selected editor is correctly focused after switching editing mode (bug 1990872)
2025-09-26 09:17:48 +02:00
Calixte Denizet
5f832757bd [Editor] Fix the URL for the 'Learn more' link in the comment sidebar (bug 1990454) 2025-09-26 09:16:36 +02:00
Calixte Denizet
888df7c319 [Editor] Make sure the selected editor is correctly focused after switching editing mode (bug 1990872) 2025-09-25 22:42:32 +02:00
calixteman
a4f072f3df
Merge pull request #20304 from calixteman/bug1990820
[Editor] Move the focus to the comment button once editing is done (bug 1990820)
2025-09-25 21:07:30 +02:00
Calixte Denizet
442932f0b3 [Editor] Move the focus to the comment button once editing is done (bug 1990820) 2025-09-25 20:17:52 +02:00
calixteman
37c79c3837
Merge pull request #20305 from calixteman/bug1990813
[Editor] Add a title to the comment buttons (bug 1990813)
2025-09-25 20:16:57 +02:00
Calixte Denizet
90e56b706e [Editor] Add a title to the comment buttons (bug 1990813) 2025-09-25 18:47:49 +02:00
calixteman
007148e2c5
Merge pull request #20303 from calixteman/bug1990544
[Editor] Make the comment sidebar resizable (bug 1990544)
2025-09-25 16:27:24 +02:00
Calixte Denizet
a372294ea3 [Editor] Make the comment sidebar resizable (bug 1990544) 2025-09-25 15:29:41 +02:00
calixteman
8448d08345
Merge pull request #20300 from calixteman/bug1990499
[Editor] Fix the button labels in the comment dialog (bug 1990499)
2025-09-25 15:29:20 +02:00
dependabot[bot]
96ee833bf4
Bump tar-fs from 3.1.0 to 3.1.1
Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 3.1.0 to 3.1.1.
- [Commits](https://github.com/mafintosh/tar-fs/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-version: 3.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-24 20:01:25 +00:00
calixteman
a8cf9a41d1
Merge pull request #20299 from calixteman/bug1990104
[Editor] Use some percent coordinates for the comment dialog (bug 1990104)
2025-09-24 18:45:16 +02:00
Calixte Denizet
7b67ed3454 [Editor] Fix the button labels in the comment dialog (bug 1990499) 2025-09-24 18:18:43 +02:00
Calixte Denizet
0427c1d93c [Editor] Use some percent coordinates for the comment dialog (bug 1990104) 2025-09-24 17:59:30 +02:00
calixteman
83b5e9efb0
Merge pull request #20298 from calixteman/bug1990082
[Editor] Avoid to use similar colors for background and foreground colors in HCM (bug 1990082)
2025-09-24 17:54:37 +02:00
Calixte Denizet
80c7aee347 [Editor] Avoid to use similar colors for background and foreground colors in HCM (bug 1990082) 2025-09-24 17:04:27 +02:00
calixteman
1ed99237a8
Merge pull request #20297 from calixteman/bug1990099
[Editor] Don't add scrollbars when it's useless in the comment sidebar (bug 1990099)
2025-09-24 17:02:32 +02:00
Calixte Denizet
3f1dbbcb77 [Editor] Don't add scrollbars when it's useless in the comment sidebar (bug 1990099) 2025-09-24 15:38:13 +02:00
calixteman
f5b5b6868a
Merge pull request #20295 from calixteman/comment_update_position
[Editor] Update the color and the position of the comment button in reading mode they've been modified
2025-09-24 14:28:48 +02:00
Calixte Denizet
0b40bf1743 [Editor] Update the color and the position of the comment button in reading mode they've been modified 2025-09-24 09:45:37 +02:00
calixteman
ae3c23e28a
Merge pull request #20291 from calixteman/bug1977269
[Editor] When in HCM, don't apply light/dark color in the comment buttons (bug 1977269)
2025-09-23 20:27:01 +02:00
calixteman
48c10d8938
Merge pull request #20285 from calixteman/editor_remove_useless_dim_stuff
[Editor] Remove useless computations when setting the dimensions of an editor
2025-09-23 20:26:12 +02:00
calixteman
225b07aa29
Merge pull request #20283 from calixteman/bug1989304
[Editor] Make sure the comment dialog is visible on the screen (bug 1989304)
2025-09-23 19:30:28 +02:00
Calixte Denizet
5d079c10b6 [Editor] When in HCM, don't apply light/dark color in the comment buttons (bug 1977269)
Add fix the color name to use in HCM.
2025-09-22 17:31:11 +02:00
calixteman
44affa76b9
Merge pull request #20197 from ryzokuken/sab-font-data
Serialize font data into an ArrayBuffer
2025-09-22 09:40:14 +02:00
calixteman
594fda13de
Merge pull request #20286 from calixteman/openjpeg_2.5.4
Update OpenJPEG to 2.5.4
2025-09-21 18:53:00 +02:00
Calixte Denizet
e9394d0f63 Update OpenJPEG to 2.5.4 2025-09-21 12:11:40 +02:00
Calixte Denizet
0722faa9ce [Editor] Remove useless computations when setting the dimensions of an editor
And remove an unused functions AnnotationEditor::setAspectRatio/fixDims.
2025-09-19 18:08:56 +02:00
Ujjwal Sharma
4bed7370f4 [WIP] Serialize font data into an ArrayBuffer
This PR serializes font data into an ArrayBuffer
that is then transfered from the worker to the
main thread. It's more efficient than the current
solution which clones the "export data" object
which includes the font data as a Uint8Array.

It prepares us to switch to a SharedArrayBuffer
in the future, which would allow us to share
the font data with multiple agents, which would be
crucial for the upcoming "renderer" worker.
2025-09-19 12:02:40 +05:30
Calixte Denizet
623d422ddb [Editor] Make sure the comment dialog is visible on the screen (bug 1989304) 2025-09-18 21:23:42 +02:00
Tim van der Meij
33e638c66f
Merge pull request #20282 from calixteman/fix_showing_invisible_editor
[Editor] Make sure to not add extra editors when showing again a destroyed page
2025-09-18 20:54:15 +02:00
Tim van der Meij
20f31d782b
Merge pull request #20281 from calixteman/comment_dialog_focus
[Editor] Fix the focus outline for the comment dialog buttons
2025-09-18 20:50:50 +02:00
Calixte Denizet
cbc5241b53 [Editor] Make sure to not add extra editors when showing again a destroyed page 2025-09-18 15:18:50 +02:00
Calixte Denizet
a1906f02d9 [Editor] Fix the focus outline for the comment dialog buttons
And add an aria label to the dialog.
2025-09-18 14:01:07 +02:00
James Fitzsimmons
ae8f8e4d34 Improve serif fallback font name matching 2025-09-18 14:15:41 +10:00
Tim van der Meij
05af4ff783
Merge pull request #20252 from sigmaSd/patch-1
Use `console.warn`/`console.info` where appropriate
2025-09-16 19:41:54 +02:00
calixteman
4eeabcb70b
Merge pull request #20279 from calixteman/unused_css
Avoid unused css variables
2025-09-16 13:45:04 +02:00
Calixte Denizet
d1f06fe70e Avoid unused css variables 2025-09-16 13:40:09 +02:00
Bedis Nbiba
b6165c02b9 use console.warn/info where appropriate
Change info to use console.info and warn function
to use console.warn, this not only makes sense semantically
but also in practice server side runtimes like deno
write console.log to stdout, and console.warn
to stderr (info goes to stdout, unfortunately?)
this is important because logging to stdout
can break some cli apps.
2025-09-15 22:37:08 +00:00
Tim van der Meij
d85fd12437
Merge pull request #20274 from calixteman/save_comment_reading_mode
[Annotation] Save the comment changes made in reading mode (bug 1987427)
2025-09-15 23:32:51 +02:00
Tim van der Meij
a68630eee4
Merge pull request #20278 from calixteman/fix_comment_popup_position
[Editor] Fix the position of the comment popup and its dialog
2025-09-15 23:23:10 +02:00
Calixte Denizet
764c2e639c [Editor] Fix the position of the comment popup and its dialog
Only fix the popup position if the user didn't change it.
And don't adjust the dialog position since it should have the same as the popup.
2025-09-15 21:26:36 +02:00
Calixte Denizet
5feb4674d6 [Annotation] Save the comment changes made in reading mode (bug 1987427) 2025-09-15 19:49:49 +02:00
calixteman
394fa2c184
Merge pull request #20250 from calixteman/new_popup_reading_mode
[Annotation] Use the new popup in reading mode (bug 1987426)
2025-09-15 18:00:14 +02:00
Calixte Denizet
38b86cb97a [Annotation] Use the new popup in reading mode (bug 1987426) 2025-09-15 16:58:22 +02:00
calixteman
3432c1933e
Merge pull request #20249 from calixteman/new_comment_popup_2
[Editor] Add a new popup for comments (bug 1987425)
2025-09-15 08:27:17 +02:00
calixteman
0982ff2911
Merge pull request #20272 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-09-15 08:25:35 +02:00
Calixte Denizet
b660b721f9 [Editor] Add a new popup for comments (bug 1987425)
And:
 - improve the editing dialog in removing menu;
 - position correctly the popup on the left/right depending on the direction value.
2025-09-15 08:24:26 +02:00
calixteman
adf9233f46
Merge pull request #20270 from calixteman/issue20232
Consider a ttf font with both Symbolic and Nonsymbolic flags set with a Differences array in the encoding dict as non-symbolic
2025-09-14 21:37:58 +02:00
Tim van der Meij
2f53e50074
Update translations to the most recent versions 2025-09-14 19:23:35 +02:00
Tim van der Meij
637599dc23
Upgrade eslint-plugin-unicorn to version 61.0.2
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v61.0.0
doesn't indicate any breaking changes that should impact us.
2025-09-14 19:23:34 +02:00
Tim van der Meij
a730cba414
Update dependencies to the most recent versions 2025-09-14 19:23:34 +02:00
Tim van der Meij
10bc635fc8
Merge pull request #20271 from timvandermeij/integration-tests-pending
Replace manual returns with `pending` in the integration tests
2025-09-14 19:17:41 +02:00
Calixte Denizet
b6d772d71d Consider a ttf font with both Symbolic and Nonsymbolic flags set with a Differences array in the encoding dict as non-symbolic
It fixes #20232.
2025-09-14 18:52:16 +02:00
Tim van der Meij
ffeaa9111a
Replace manual returns with pending in the integration tests
This allows Jasmine to track skipped tests and makes it easier to
discover them using e.g. `grep`.
2025-09-14 18:30:17 +02:00
Tim van der Meij
1cae8e2933
Merge pull request #20269 from calixteman/dichotomic_find_color
Use a dichotomy to find a color with a good contrast ratio
2025-09-14 18:15:52 +02:00
Tim van der Meij
e78c7d0cc2
Merge pull request #20256 from nicolo-ribaudo/bboxes-when-needed
Only record bboxes when needed
2025-09-14 16:22:46 +02:00
Calixte Denizet
634bef5fb4 Use a dichotomy to find a color with a good contrast ratio
It helps to reduce the number of iterations so it makes the algorithm
slightly faster in general.
2025-09-13 15:45:00 +02:00
calixteman
2138ec17cc
Merge pull request #20267 from nicolo-ribaudo/fix-jsdoc
Fix JSDoc description in src/display/api.js
2025-09-13 15:40:47 +02:00
Nicolò Ribaudo
5de14aa429
Only record bboxes when needed
Before this patch, when `enableOptimizedPartialRendering`
is enabled we would record the bounding boxes of the
various operations on the first render.

This patches change it to happen on the first render that we
know will also need a detail view, so that the performance
cost is not paid for the case when the detail view is not used.
2025-09-12 15:02:24 +02:00
Nicolò Ribaudo
42b4d97115
Fix JSDoc description in src/display/api.js 2025-09-12 15:01:41 +02:00
calixteman
beb5f5ca85
Merge pull request #20208 from nicolo-ribaudo/bboxes-typedarray
Store ops bboxes in a linear Uint8Array
2025-09-12 14:52:42 +02:00
calixteman
d77f89026f
Merge pull request #20240 from calixteman/fix_contrast
Make sure that a good constrast ratio is respected when darkening/lightening a color
2025-09-12 09:24:40 +02:00
calixteman
0e28b5c3c4
Merge pull request #20258 from calixteman/cleanup_before_editing_mode
[Editor] Cleanup the pages not being fully rendered before switching to editing mode
2025-09-11 23:03:08 +02:00
Tim van der Meij
e8cc25c0ae
Merge pull request #20259 from calixteman/no_throw_when_switching_editing_mode
[Editor] Don't throw when switching to editing mode before an annotation editor layer is rendered
2025-09-11 22:04:47 +02:00
Calixte Denizet
7f85c00ee6 Make sure that a good constrast ratio is respected when darkening/lightening a color 2025-09-11 21:29:28 +02:00
Tim van der Meij
557eb2c7e1
Merge pull request #20253 from calixteman/scroll_and_center
Add an option in scrollIntoView and goToXY in order to be able to center vertically or horizontally the point XY in the viewer container
2025-09-11 21:20:55 +02:00
Tim van der Meij
f049360689
Merge pull request #20255 from nicolo-ribaudo/low-res
Reduce background canvas resolution
2025-09-11 21:04:27 +02:00
Nicolò Ribaudo
4c7bbd0fef
Reduce background canvas resolution
The size of the canvas has significant impact on the rendering
performance. If we are going to render a high-res detail
view on top of the full-page canvas, we can further
reduce the full-page canvas resolution to improve
rendering time without affecting the resolution seen by
the user.

Users will se the lower resolution when quickly scrolling around the
page, but it will then be replaced with the high-res
detail view.
2025-09-10 16:52:57 +02:00
Calixte Denizet
593ceadc93 [Editor] Don't throw when switching to editing mode before an annotation editor layer is rendered
It can happen with a pdf having a large text layer.
Instead of waiting for the first rendered page to enable the buttons we wait for
a rendered annotation editor layer.
2025-09-10 11:04:47 +02:00
Calixte Denizet
0fc8986dc6 [Editor] Cleanup the pages not being fully rendered before switching to editing mode
In order to see the issue this patch is fixing:
 - open a pdf with some highlights and a comment on page 1, at page 7
 - open the comment sidebar
 - click on the comment on page 1

Opening at page 7 lets a not fully rendered page which means that when jumping to it
with the sidebar, we re-use what we've instead of redrawing it.
2025-09-10 10:23:29 +02:00
Calixte Denizet
e1bdc34b4a Add an option in scrollIntoView and goToXY in order to be able to center vertically or horizontally the point XY in the viewer container 2025-09-09 13:10:49 +02:00
Nicolò Ribaudo
e4ea2e0c79
Store ops bboxes in a linear Uint8Array
This PR changes the way we store bounding boxes so that they use less
memory and can be more easily shared across threads in the future.

Instead of storing the bounding box and list of dependencies for each
operation that renders _something_, we now only store the bounding box
of _every_ operation and no dependencies list. The bounding box of
each operation covers the bounding box of all the operations affected
by it that render something. For example, the bounding box of a
`setFont` operation will be the bounding box of all the `showText`
operations that use that font.

This affects the debugging experience in pdfBug, since now the bounding
box of an operation may be larger than what it renders itself. To help
with this, now when hovering on an operation we also highlight (in red)
all its dependents. We highlight with white stripes operations that do
not affect any part of the page (i.e. with an empty bbox).

To save memory, we now save bounding box x/y coordinates as uint8
rather than float64. This effectively gives us a 256x256 uniform grid
that covers the page, which is high enough resolution for the usecase.
2025-09-09 10:24:48 +02:00
calixteman
5b7f9ca8b9
Merge pull request #20247 from calixteman/wait_for_rendered_editors
[Editor] When clicking on a comment in the sidebar, wait for the annotation editor layer to be rendered
2025-09-09 09:26:45 +02:00
calixteman
d009c434f5
Merge pull request #20248 from calixteman/toolbar_button_position
[Editor] Make sure the comment button is at the right place when adding it in the toolbar
2025-09-08 23:06:02 +02:00
calixteman
b5113d9a74
Merge pull request #20239 from timvandermeij/integration-test-unskip-timezone
Unskip the `must check that date entered by the user is consistent` scripting integration test for Firefox
2025-09-08 22:35:18 +02:00
calixteman
17a27806c6
Merge pull request #20245 from calixteman/comment_richtext
[Editor] Add the dates and rich text if any to the editors in order to use them when displaying the popup
2025-09-08 22:23:03 +02:00
Tim van der Meij
3f0d39b024
Merge pull request #20244 from calixteman/fix_deleting_popup
[Editor] Fix saving a deleted popup
2025-09-08 21:23:47 +02:00
Tim van der Meij
512c30b1f6
Unskip the must check that date entered by the user is consistent scripting integration test for Firefox
Bug 1978027 has been fixed upstream 10 days ago, so this integration
test can be enabled for Firefox too now that it passed with recent
Nightly versions.
2025-09-08 20:48:24 +02:00
Tim van der Meij
8bd13f7f25
Merge pull request #20172 from timvandermeij/misc-test-improvements
Improve the integration test code
2025-09-08 20:44:29 +02:00
Tim van der Meij
5382c54803
Merge pull request #20243 from mozilla/dependabot/github_actions/actions/setup-node-5
Bump actions/setup-node from 4 to 5
2025-09-08 20:43:01 +02:00
Tim van der Meij
7e3417f862
Merge pull request #20242 from mozilla/dependabot/github_actions/actions/setup-python-6
Bump actions/setup-python from 5 to 6
2025-09-08 20:42:35 +02:00
Calixte Denizet
f5c913bc9e [Editor] Make sure the comment button is at the right place when adding it in the toolbar 2025-09-08 17:59:28 +02:00
Calixte Denizet
94d72e903f [Editor] Add the dates and rich text if any to the editors in order to use them when displaying the popup 2025-09-08 17:40:47 +02:00
Calixte Denizet
54351ee437 [Editor] When clicking on a comment in the sidebar, wait for the annotation editor layer to be rendered
and add a getter for the layer bounding rect.
2025-09-08 17:13:37 +02:00
Calixte Denizet
2d5794f79d [Editor] Fix saving a deleted popup 2025-09-08 15:36:41 +02:00
dependabot[bot]
f9be06a8c1
Bump actions/setup-node from 4 to 5
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 5.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 12:31:52 +00:00
dependabot[bot]
a5ef8ca828
Bump actions/setup-python from 5 to 6
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 12:26:36 +00:00
calixteman
d946de904c
Merge pull request #20238 from timvandermeij/fix-freetext-permafail
Fix the rendering of XFA rich text in popup annotations
2025-09-07 20:59:36 +02:00
Tim van der Meij
f1f8ee47ff
Fix the rendering of XFA rich text in popup annotations
Before the introduction of the `renderRichText` helper function we
exclusively used `this.#html` for XFA rich text and exclusively used
`this.#contentsObj` for plain text. However, after the refactoring we
tried to access `this.#contentsObj.dir` in both cases, which fails for
XFA rich text because `this.#contentsObj` is `null` in that case.

This commit fixes the issue by using optional chaining to make sure we
don't try to access non-existent `this.#contentsObj` properties, which
makes the `must update an existing annotation and show the right popup`
freetext integration pass again.

Fixes #20237.
Fixes 35c90984.
2025-09-07 18:35:17 +02:00
Tim van der Meij
7f74fbf8fd
Fix block spacing inconsistencies in the integration test code
Most places have a newline before/after `before{Each,All}`,
`after{Each,All}` and `it` to visually separate the blocks for clarity,
but in a handful of places this wasn't done. This commit removes the
inconsistencies so that the test code is formatted consistently.
2025-09-07 14:39:52 +02:00
Tim van der Meij
cf5bffef2e
Use the getAnnotationSelector helper function more in the integration test code
The helper function was used in a number of places, but also a lot of
places contained the annotation selector string inline. This commit
makes sure that all places use `getAnnotationSelector` consistently to
make sure the annotation selector string is only defined in a single
place and to improve readability of the test code.
2025-09-07 14:39:52 +02:00
Tim van der Meij
c09ad5a2ce
Use the closePages helper function more in the integration test code
This test called `closeSinglePage` manually at the end of the test,
which is inconsistent with all other tests that call `closePages` in an
`afterEach` block. This commit fixes the difference for consistency.
2025-09-07 14:39:48 +02:00
calixteman
2a93ade197
Merge pull request #20231 from calixteman/xfa_render_richtext
Add a new function renderRichText to be used in the annotation layer
2025-09-05 08:36:28 +02:00
Calixte Denizet
35c909843b Add a new function renderRichText to be used in the annotation layer
and which will be used in order to make the contents of the new popup used for comments.
2025-09-04 22:27:31 +02:00
calixteman
7b87c220a5
Merge pull request #20233 from calixteman/dont_add_image_stamp_update
[Editor] Don't save the image when updating a stamp annotation
2025-09-04 22:19:36 +02:00
Tim van der Meij
84e32964ed
Merge pull request #20221 from calixteman/button_color_comment
[Editor] Use the color of the annotation for the background of the comment button
2025-09-04 21:27:07 +02:00
Calixte Denizet
2354ae4233 [Editor] Don't save the image when updating a stamp annotation
It adds some useless bytes in the file.
2025-09-04 18:54:13 +02:00
maettuu
2d8dfb0b62 Add regression test for Unicode mapping
Verifies that ToUnicodeMap correctly maps Extension B characters to their full Unicode code points using codePointAt

See PR https://github.com/mozilla/pdf.js/pull/19184
2025-09-04 17:17:34 +02:00
Calixte Denizet
ca280399c2 [Editor] Use the color of the annotation for the background of the comment button 2025-09-02 21:17:08 +02:00
Tim van der Meij
c386d9b87d
Merge pull request #20222 from calixteman/sidebar_scroll
[Editor] Make scrollable the area containing the comments in the sidebar
2025-09-01 20:28:35 +02:00
Calixte Denizet
dd4b475109 [Editor] Make scrollable the area containing the comments in the sidebar 2025-08-31 23:21:19 +02:00
calixteman
c8d49db624
Merge pull request #20217 from calixteman/comment_editor_sidebar
[Editor] Add editors with a comment in the sidebar
2025-08-31 21:48:52 +02:00
Calixte Denizet
2a459857ce [Editor] Add editors with a comment in the sidebar
and add a button close to the editor.
Clicking on the button will display a popup with the comment but it's for a next patch.
2025-08-31 19:59:16 +02:00
Tim van der Meij
9855d85fb5
Merge pull request #20220 from timvandermeij/editor-hint-bugfix
[Editor] Hide the comment sidebar on document change
2025-08-31 18:56:27 +02:00
Tim van der Meij
5a7c872618
[Editor] Hide the comment sidebar on document change
If the document changes the comment state from the old document should
be replaced with that of the new document. To do this the comment
manager is destroyed, but the corresponding comment sidebar wasn't
destroyed yet, which resulted in the comment state from the old document
still being visible for the new document.

This commit fixes the issue by hiding the comment sidebar if the comment
manager is destroyed. Note that hiding the comment sidebar effectively
destroys all its state, and we already set the annotation mode to "none"
on document change so we don't want to keep showing the comment sidebar
anyway.
2025-08-31 16:26:03 +02:00
calixteman
c96fa68c9d
Merge pull request #20204 from calixteman/add_changelightness
Add a function changeLightness in order to change the lightness of a RGB color
2025-08-30 21:40:31 +02:00
Calixte Denizet
0ec503e5ef Add a function changeLightness in order to change the lightness of a RGB color 2025-08-30 21:18:12 +02:00
Tim van der Meij
c2699a941e
Merge pull request #20216 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-08-30 20:01:51 +02:00
Tim van der Meij
cac052c0be
Update translations to the most recent versions 2025-08-30 18:39:19 +02:00
Tim van der Meij
4dcfc96703
Update dependencies to the most recent versions 2025-08-30 18:38:25 +02:00
Tim van der Meij
f110e57512
Merge pull request #20215 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-08-30 17:52:18 +02:00
Tim van der Meij
a5456033ce
Bump the stable version in pdfjs.config 2025-08-30 17:49:19 +02:00
calixteman
9e2e9e2096
Merge pull request #20210 from calixteman/comment_sidebar
[Editor] Add a sidebar allowing the user to navigate between the comments in a pdf (bug 1985567)
2025-08-30 14:19:04 +02:00
Tim van der Meij
a2d4b259c5
Merge pull request #20212 from calixteman/reset_mode
Reset editing mode when changing the pdf document
2025-08-29 20:45:21 +02:00
Calixte Denizet
25990e4287 [Editor] Add a sidebar allowing the user to navigate between the comments in a pdf (bug 1985567)
This implements what has been specified but it's still not done: we have to handle editing a comment
or an annotation containing one.
2025-08-29 16:00:06 +02:00
Calixte Denizet
3e01ee9bb7 Reset editing mode when changing the pdf document 2025-08-28 22:38:05 +02:00
Tim van der Meij
13ba311e5a
Merge pull request #20211 from calixteman/fix_css_unit
[Editor] Fix unit (for consistency) and remove few useless px
2025-08-28 20:37:18 +02:00
Tim van der Meij
53c37547f0
Merge pull request #20209 from calixteman/fix_comment_icon
[Editor] Fix the dimensions of the comment icon
2025-08-28 20:33:31 +02:00
Calixte Denizet
0a4817fb71 [Editor] Fix unit (for consistency) and remove few useless px 2025-08-28 16:09:58 +02:00
Calixte Denizet
1876013e4e [Editor] Fix the dimensions of the comment icon 2025-08-27 16:01:29 +02:00
calixteman
e37a58f978
Merge pull request #20200 from calixteman/remove_useless_css2
[Editor] Remove useless CSS and fix styling for the comment button
2025-08-26 22:10:11 +02:00
Calixte Denizet
e44e470eb2 [Editor] Remove useless CSS and fix styling for the comment button 2025-08-26 22:06:49 +02:00
Tim van der Meij
d8c01bf70d
Merge pull request #20196 from calixteman/xy_getter
[Editor] Add a method to get an editor rect in the pdf page coordinates
2025-08-26 20:27:06 +02:00
Calixte Denizet
1fc039e14f [Editor] Add a method to get an editor rect in the pdf page coordinates 2025-08-26 19:40:41 +02:00
Tim van der Meij
bde01f0998
Merge pull request #20195 from timvandermeij/fix-chrome-windows
Skip the curvature ink editor integration test for Chrome on Windows
2025-08-25 21:35:13 +02:00
Tim van der Meij
11d5d6d0ce
Skip the curvature ink editor integration test for Chrome on Windows
This test permafails for that particular OS/browser combination.

Fixes 18d3dc18.
2025-08-25 20:09:32 +02:00
calixteman
5a10376e4d
Merge pull request #20191 from calixteman/link_gotoxy
Add a method goToXY in PDFLinkService in order to scroll the document at a given location
2025-08-25 20:08:03 +02:00
calixteman
261c1f9e05
Merge pull request #20194 from calixteman/update_comment_icon
[Editor] Change the icon for inline comments
2025-08-25 20:07:37 +02:00
Calixte Denizet
5ed2dfbf26 [Editor] Change the icon for inline comments 2025-08-25 20:04:56 +02:00
Calixte Denizet
1678782680 Add a method goToXY in PDFLinkService in order to scroll the document at a given location
This function is required for the commenting feature: the user will be able to click
on a comment in the sidebar and the document will be scrolled accordingly.
2025-08-25 19:57:53 +02:00
Tim van der Meij
ab41f5095c
Merge pull request #20190 from timvandermeij/text-layer-permafail
Improve the selection check in the "doesn't jump when moving selection" integration test
2025-08-25 19:40:27 +02:00
calixteman
7a65c58b5e
Merge pull request #20170 from calixteman/bug1980958
Don't iterate over all empty slots in the xref entries (bug 1980958)
2025-08-25 15:46:20 +02:00
Calixte Denizet
af144be3ba Don't iterate over all empty slots in the xref entries (bug 1980958) 2025-08-25 14:02:08 +02:00
calixteman
5d4f0659bc
Merge pull request #20182 from calixteman/add_comment_button
[Editor] Add a button to the annotation having a popup in order to edit it
2025-08-25 13:18:37 +02:00
calixteman
307ea5d25d
Merge pull request #20187 from calixteman/update_puppeteer_24.17.0
Update puppeteer to 24.17.0
2025-08-25 13:09:44 +02:00
Calixte Denizet
0af61f5bf4 Update puppeteer to 24.17.0 2025-08-25 09:33:53 +02:00
Calixte Denizet
bd8c438428 [Editor] Add a button to the annotation having a popup in order to edit it 2025-08-24 21:36:19 +02:00
Tim van der Meij
4cc93af364
Improve the selection check in the "doesn't jump when moving selection" integration test
Locally, on Arch Linux, this integration test permafails:

```
1) Text layer Text selection using selection carets doesn't jump when moving selection
  Message:
    second selection:
        Expected '(frequently executed) bytecode sequences, records
        them, and compiles them to fast native code. We call such a s' to roughly match /frequently .* We call such a se/s.
  Stack:
        at <Jasmine>
        at UserContext.<anonymous> (file:///home/timvandermeij/Documenten/Ontwikkeling/pdf.js/Code/test/integration/text_layer_spec.mjs:521:12)
  Message:
    third selection:
        Expected '(frequently executed) bytecode sequences, records
        them, and compiles them to fast native code. We call such a s' to roughly match /frequently .* We call such a se/s.
  Stack:
        at <Jasmine>
        at UserContext.<anonymous> (file:///home/timvandermeij/Documenten/Ontwikkeling/pdf.js/Code/test/integration/text_layer_spec.mjs:529:12
```

The exact selection can differ a bit per OS/browser. In this case the
last character was consistently not selected while on other platforms it
is, so this commit fixes the issue by relaxing the regex to not consider
the final character so that the test passes if the rest matches.
2025-08-24 20:46:20 +02:00
Tim van der Meij
649a03f817
Merge pull request #20189 from timvandermeij/null-signal
[Editor] Don't use a null signal for the comment button
2025-08-24 20:43:36 +02:00
Tim van der Meij
eec1bea1b4
[Editor] Don't use a null signal for the comment button
This removes the following error from the integration test logs:

```
JavaScript error: http://127.0.0.1:59283/build/generic/build/pdf.mjs, line 3879:
TypeError: EventTarget.addEventListener: 'signal' member of AddEventListenerOptions is not an object.
```

Fixes 636ff50.
Extends 63651885.
2025-08-24 20:01:10 +02:00
Tim van der Meij
535a042b01
Merge pull request #20188 from timvandermeij/chrome-webdriverbidi
Use WebDriver BiDi for Chrome
2025-08-24 19:59:31 +02:00
Tim van der Meij
18d3dc18e0
Use WebDriver BiDi for Chrome 2025-08-24 15:58:52 +02:00
calixteman
592d6c070a
Merge pull request #20179 from calixteman/add_rect_popup
[Editor] Add a Rect entry to a saved popup in order to avoid to have an invalid pdf
2025-08-24 12:01:31 +02:00
calixteman
78f63dd6db
Merge pull request #20180 from calixteman/mv_comment_button
[Editor] Move the comment button just before the delete one
2025-08-24 12:00:29 +02:00
calixteman
cfe08bd035
Merge pull request #20184 from calixteman/use_cached_annotations
Use the cached annotations when collecting them by types
2025-08-24 11:57:17 +02:00
Tim van der Meij
8be21711a4
Merge pull request #20183 from calixteman/resizer_top_editor
[Editor] Make sure the resizers are on top of the editor content
2025-08-23 21:27:35 +02:00
calixteman
4e089f210a
Merge pull request #20186 from calixteman/puppeteer_switch_nightly
Use Firefox nightly with puppeteer
2025-08-23 15:36:21 +02:00
Calixte Denizet
22c0e25eb5 Use Firefox nightly with puppeteer 2025-08-22 22:02:34 +02:00
calixteman
673f19bc2b
Merge pull request #19043 from nicolo-ribaudo/compute-bounding-boxes
Add logic to track rendering area of various PDF ops
2025-08-22 20:34:03 +02:00
Nicolò Ribaudo
6a22da9c2e
Add logic to track rendering area of various PDF ops
This commit is a first step towards #6419, and it can also help with
first compute which ops can affect what is visible in that part of
the page.

This commit adds logic to track operations with their respective
bounding boxes. Only operations that actually cause something to
be rendered have a bounding box and dependencies.

Consider the following example:
```
0. setFillRGBColor
1. beginText
2. showText "Hello"
3. endText
4. constructPath [...] -> eoFill
```
here we have three rendering operations: the showText op (2) and the
path (4). (2) depends on (0), (1) and (3), while (4) only depends on
(0). Both (2) and (4) have a bounding box.

This tracking happens when first rendering a PDF: we then use the
recorded information to optimize future partial renderings of a PDF, so
that we can skip operations that do not affected the PDF area on the
canvas.

All this logic only runs when the new `enableOptimizedPartialRendering`
preference, disabled by default, is enabled.

The bounding boxes and dependencies are also shown in the pdfBug
stepper. When hovering over a step now:
- it highlights the steps that they depend on
- it highlights on the PDF itself the bounding box
2025-08-22 18:26:59 +02:00
Calixte Denizet
ebc3411727 Use the cached annotations when collecting them by types 2025-08-21 18:04:00 +02:00
Calixte Denizet
0c6cf84274 [Editor] Make sure the resizers are on top of the editor content 2025-08-21 09:10:57 +02:00
Calixte Denizet
f8466c9ff8 [Editor] Add a Rect entry to a saved popup in order to avoid to have an invalid pdf 2025-08-20 17:56:50 +02:00
Calixte Denizet
f8ea63606c [Editor] Move the comment button just before the delete one 2025-08-20 17:18:38 +02:00
calixteman
e20ee99580
Merge pull request #20178 from calixteman/pinpoint_firefox
Use Firefox stable for the tests because bug 1983414
2025-08-20 17:04:08 +02:00
Calixte Denizet
2beb26ad14 Use Firefox stable for the tests because bug 1983414 2025-08-20 16:11:59 +02:00
calixteman
212547e865
Merge pull request #20169 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-08-19 10:41:27 +02:00
calixteman
65dd6b05a9
Merge pull request #20167 from calixteman/get_all_editable_annotations
[Editor] Add the ability to get all the editable annotations in a pdf document
2025-08-19 10:39:48 +02:00
Calixte Denizet
9e5ee1e5a7 [Editor] Add the ability to get all the editable annotations in a pdf document
We want to be able to show all the comments in a pdf even if the pages where they are
haven't been rendered.
And it'll help to fix the issue #18915.
2025-08-18 21:31:11 +02:00
Tim van der Meij
13de21841d
Update translations to the most recent versions 2025-08-17 16:32:29 +02:00
Tim van der Meij
d49fc494cd
Update dependencies to the most recent versions 2025-08-17 16:32:29 +02:00
Tim van der Meij
dd560ee453
Merge pull request #20171 from timvandermeij/firefox-test-prefs
Update Firefox preferences for testing
2025-08-17 16:31:16 +02:00
Tim van der Meij
844681a2fa
Disable AI/ML features using Firefox preferences for testing
We don't need AI/ML features in the tests, so this should reduce CPU
usage by not having the inference process running. Moreover, it prevents
the following lines from being logged in the test output:

```
JavaScript error: resource://gre/actors/MLEngineParent.sys.mjs, line 509: Error: Unable to get the ML engine from Remote Settings.
JavaScript error: resource://gre/actors/MLEngineParent.sys.mjs, line 1279: TypeError: can't access property "postMessage", this[#port] is null
```
2025-08-17 16:05:04 +02:00
Tim van der Meij
a05dc9c1c5
Remove obsolete Firefox preferences for testing
The following preferences don't have to be set manually anymore:

- `print.show_print_progress`
  - Why: removed
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1770536
  - Commit: b522664310

- `gfx.offscreencanvas.enabled`
  - Why: removed
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1914083
  - Commit: 7d2c688920

- `layout.css.round.enabled`
  - Why: removed
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1874633
  - Commit: 97909653e7

- `dom.events.asyncClipboard.clipboardItem`
  - Why: enabled by default
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1887845
  - Commit: de56ae88bf
2025-08-17 14:53:35 +02:00
Tim van der Meij
5adff6a2e2
Merge pull request #20126 from timvandermeij/fix-intermittents-chrome
Implement a delay for Chrome protocol calls in the integration tests, and skip the "must check that an existing highlight is ignored on hovering" integration test on Windows
2025-08-15 19:34:13 +02:00
Tim van der Meij
17dc9e9917
Skip the "must check that an existing highlight is ignored on hovering" integration test on Windows
This is a temporary measure to reduce noise until #20136 is fixed. Note
that this shouldn't be an issue in terms of coverage because we still
run the test on Linux.
2025-08-14 20:54:41 +02:00
Tim van der Meij
7294377cd9
Implement a delay for Chrome protocol calls in the integration tests
In Chrome protocol calls are faster than in Firefox and thus trigger in
quicker succession. This can cause intermittent failures because new
protocol calls can run before events triggered by the previous protocol
calls had a chance to be processed (essentially causing events to get
lost).

This commit fixes the issue by configuring Chrome with a protocol call
delay value that gives it a more similar execution speed as Firefox
(which also gives us more consistency between the two browser runs).

Note that this doesn't negatively impact the overall runtime of the
integration tests because Puppeteer already waits for a test to complete
in both browsers before continuing to the next one and Chrome
consistently was, and with this patch still slightly is, faster in
completing the tests.
2025-08-14 20:54:37 +02:00
Tim van der Meij
c6bd044438
Merge pull request #20164 from calixteman/editor_hide_deleted_annotation
[Editor] Correctly hide deleted annotations
2025-08-14 20:39:39 +02:00
Tim van der Meij
5951485b98
Merge pull request #20166 from calixteman/fix_signal_integration_test
[Editor] Avoid to use a null signal when setting listeners in the editor toolbar
2025-08-14 20:32:49 +02:00
Calixte Denizet
6365188535 [Editor] Avoid to use a null signal when setting listeners in the editor toolbar
It should fix the error:
```
JavaScript error: http://127.0.0.1:43303/build/generic/build/pdf.mjs, line 1445:
TypeError: EventTarget.addEventListener: 'signal' member of AddEventListenerOptions is not an object.
```

we've when running integration tests on the Linux bot.
2025-08-14 15:07:22 +02:00
Calixte Denizet
6a00174688 [Editor] Correctly hide deleted annotations 2025-08-13 22:41:19 +02:00
Tim van der Meij
7ea7a94ed5
Merge pull request #20160 from calixteman/issue20155
Check the setDash arguments
2025-08-12 20:48:44 +02:00
Tim van der Meij
32ea986c9b
Merge pull request #20161 from mozilla/dependabot/github_actions/actions/checkout-5
Bump actions/checkout from 4 to 5
2025-08-12 20:02:18 +02:00
dependabot[bot]
e38fb68724
Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 17:13:51 +00:00
Tim van der Meij
1bada43a22
Merge pull request #20159 from calixteman/update_l10n_1
Update l10n files
2025-08-10 11:15:19 +02:00
Calixte Denizet
1d4ae786f4 Check the setDash arguments
It fixes #20155.
2025-08-09 22:34:44 +02:00
Calixte Denizet
02635814a2 Update l10n files 2025-08-08 14:46:17 +02:00
calixteman
41ca92b2ea
Merge pull request #20149 from k-nut/patch-1
Mark `canvasContext` as optional
2025-08-07 22:38:32 +02:00
Knut Hühne
760c8d632c
Mark canvasContext as optional
In #20016, the `canvasContext` property of `RenderParameters` was deprecated in favor of the new `canvas` property.

The JSDoc was updated to include the new parameter along with the old one.

I think the old one should be enclosed in `[]` to mark it as optional (and to allow usage from TypeScript with just the `canvas` parameter provided).

I also reordered the properties so that all required properties come first, follow by optional ones.
2025-08-06 12:38:30 +02:00
calixteman
fcf69d8536
Merge pull request #20093 from Aditi-1400/fix-horizontal-scroll
Make horizontal padding relative to device width
2025-08-06 11:44:55 +02:00
calixteman
d41f144716
Merge pull request #20148 from fnlctrl/icc-lazy-finalization-registry
Lazy initialize FinalizationRegistry used by IccColorSpace.#finalizer
2025-08-06 11:24:40 +02:00
宋铄运 (Alan Song)
3d9374e02e lazy initialize IccColorSpace.#finalizer 2025-08-05 22:29:32 +00:00
Aditi
9babc144a7 Make horizontal padding relative to device width
The fixed -400px horizontal offset used by
scrollIntoView led to horizontal scroll only moving
part-way right on narrow screens. The highlights near
the right-edge remained party or completely off
screen.

This centres the highlighted match on any viewport width while
clamping the left margin to 20-400px. On very narrow screens
the scrollbar now moves all the way to the right instead of
stopping midway.
2025-08-04 15:29:52 +05:30
Tim van der Meij
e9a483014d
Merge pull request #20142 from calixteman/bug1957680
Trigger a fake scrollend event in case it hasn't been triggered by the browser (bug 1957680)
2025-08-03 16:03:39 +02:00
Tim van der Meij
17527d84f8
Merge pull request #20138 from calixteman/bug1976597
[Editor] Highlight text on a selectionchange event which hasn't been triggered by the pointer or the keyboard (bug 1976597)
2025-08-03 15:29:07 +02:00
Calixte Denizet
287776483f Trigger a fake scrollend event in case it hasn't been triggered by the browser (bug 1957680)
This way, it should unblock zooming with ctrl+wheel after scrolling.
2025-08-01 19:06:26 +02:00
Calixte Denizet
a81e99168a [Editor] Highlight text on a selectionchange event which hasn't been triggered by the pointer or the keyboard (bug 1976597)
It's useful for users highlighting with NVDA.
They've to enable native selection and then selection some text.
In this case only a selectionchange is triggered once the selection is done.
2025-07-31 21:03:32 +02:00
calixteman
e5922f2e72
Merge pull request #20129 from calixteman/bug1978985
Disable printing when enablePermission is true and the pdf isn't allowed to be printed (bug 1978985)
2025-07-30 20:03:44 +02:00
Calixte Denizet
806f9c1cee Disable printing when enablePermission is true and the pdf isn't allowed to be printed (bug 1978985) 2025-07-30 19:29:01 +02:00
Tim van der Meij
e48563ab5d
Merge pull request #20134 from timvandermeij/fix-intermittent-scripting
Fix intermittent failure in the "must check that the computed value is correct" scripting integration test
2025-07-29 20:04:51 +02:00
Tim van der Meij
48c6253b32
Fix intermittent failure in the "must check that the computed value is correct" scripting integration test
Typing in the text field causes a sandbox event to trigger, which we
should await to avoid continuing to the next part of the test before
the sandbox event is fully processed.
2025-07-29 19:31:08 +02:00
calixteman
f16e0b6daa
Merge pull request #20132 from calixteman/fix_css_2
[Editor] Remove unused property
2025-07-29 12:01:49 +02:00
Calixte Denizet
38b410f7e5 [Editor] Remove unused property 2025-07-29 11:58:49 +02:00
calixteman
d9ffffd435
Merge pull request #20131 from calixteman/fix_css
[Editor] Remove useless css and use a defined but unused property
2025-07-29 10:03:51 +02:00
Calixte Denizet
fbdeb7bb6d [Editor] Remove useless css and use a defined but unused property 2025-07-29 09:33:38 +02:00
Tim van der Meij
aa4b9ffd4a
Merge pull request #20128 from calixteman/issue20127
Add comment-* images when building components
2025-07-28 20:15:18 +02:00
calixteman
2e974e8f30
Merge pull request #20109 from maettuu/reg-test-pr-19639
Add regression test for PR 19639
2025-07-28 18:53:24 +02:00
calixteman
995f070f23
Merge pull request #20119 from calixteman/comment_floating_button
[Editor] Add a floating button in order to highlight the text selection and add a comment (bug 1979381)
2025-07-28 18:20:34 +02:00
Calixte Denizet
3fb7cd40e7 [Editor] Add a floating button in order to highlight the text selection and add a comment (bug 1979381)
The callback called when clicking on the button is the same as the one trigged by clicking in the context menu (in m-c).
2025-07-28 15:32:23 +02:00
calixteman
366727d734
Merge pull request #20125 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-07-28 14:54:28 +02:00
Calixte Denizet
605c9be94f Add comment-* images when building components
It fixes #20127.
2025-07-28 14:30:03 +02:00
Tim van der Meij
7f5c517b49
Update translations to the most recent versions 2025-07-27 18:32:32 +02:00
Tim van der Meij
c19271f7c3
Upgrade eslint-plugin-unicorn to version 60.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v60.0.0
doesn't indicate any breaking changes that should impact us.

Note that this brings the vulnerability count back to zero because this
version addresses https://github.com/advisories/GHSA-xffm-g5w8-qvg7.
2025-07-27 18:32:32 +02:00
Tim van der Meij
7594f21adb
Update dependencies to the most recent versions
Note that we must include `eslint-config-prettier` explicitly because
it's now a required dependency and without it linting fails; please see
https://github.com/prettier/eslint-plugin-prettier?tab=readme-ov-file#installation.
2025-07-27 18:31:03 +02:00
Tim van der Meij
e4b146221b
Merge pull request #20124 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-07-27 17:55:59 +02:00
Tim van der Meij
8771175e5f
Bump the stable version in pdfjs.config 2025-07-27 17:52:46 +02:00
Tim van der Meij
295fb3ec4f
Merge pull request #20120 from calixteman/remove_actions_button
[Editor] Don't show the actions button in the comment popup when it's useless
2025-07-27 14:24:17 +02:00
Calixte Denizet
efc1654326 [Editor] Don't show the actions button in the comment popup when it's useless 2025-07-25 19:47:58 +02:00
calixteman
542514efbd
Merge pull request #20116 from calixteman/add_date_picker
Use a HTML date/time input when a field requires a date or a time.
2025-07-25 15:34:52 +02:00
Calixte Denizet
57ce4f8f43 Use a HTML date/time input when a field requires a date or a time.
The user will be able to enter a date in the format corresponding to their locale
and it'll be formatted in using the format provided by the pdf.
2025-07-24 22:01:45 +02:00
calixteman
aee4f2d33c
Merge pull request #20113 from calixteman/bug1978317
Fix the xref table with the values we've at the beginning of a xref stream (bug 1978317)
2025-07-23 09:36:29 +02:00
Calixte Denizet
78391ed85a Fix the xref table with the values we've at the beginning of a xref stream (bug 1978317) 2025-07-22 22:10:23 +02:00
maettuu
ac8757f36f Add regression test for negative LW normalization in gs operator
Ensure that negative “LW” entries in an ExtGState dictionary are converted to their absolute values when the “gs” operator is processed.

See PR https://github.com/mozilla/pdf.js/pull/19639
2025-07-20 16:03:46 +02:00
Tim van der Meij
bfc20250b2
Merge pull request #20107 from timvandermeij/updates
Update translations and dependencies to the most recent versions
2025-07-19 20:06:33 +02:00
Tim van der Meij
dcf161e2eb
Update translations to the most recent versions 2025-07-19 18:41:21 +02:00
Tim van der Meij
5d6023cb2a
Update dependencies to the most recent versions 2025-07-19 18:39:16 +02:00
Tim van der Meij
ed141970e6
Merge pull request #20099 from calixteman/bug1977259
[Editor] Fix the highlighting colors in HCM (bug 1977259)
2025-07-18 22:25:43 +02:00
Tim van der Meij
f3080a185b
Merge pull request #20106 from timvandermeij/fix-viewer-alert-intermittent
Fix intermittent failure in the viewer alert tests
2025-07-18 21:32:26 +02:00
Tim van der Meij
603fd2524a
Fix intermittent failure in the viewer alert tests
It takes some time for the viewer alert to be updated after the editor
is committed, but the current tests don't await that and proceed too
fast to the viewer alert string assertion. This commit fixes the issue
by waiting for the expected viewer alert string to appear instead.
2025-07-18 20:56:02 +02:00
Tim van der Meij
daf2cbbfe9
Merge pull request #20096 from calixteman/bug1708041
Make the link annotations correctly announced by screen readers (bug 1708041)
2025-07-18 20:33:30 +02:00
Calixte Denizet
f695e0ca62 Make the link annotations correctly announced by screen readers (bug 1708041)
And focus the targeted page when the user clicks on a link.
2025-07-18 20:15:31 +02:00
Calixte Denizet
c022a3294a [Editor] Fix the highlighting colors in HCM (bug 1977259)
Using the same color in HCM or non-HCM was inducing a too small contrast between
some bg/fg colors making the text a bit hard to read.
2025-07-18 20:11:28 +02:00
calixteman
bfc7fc4da9
Merge pull request #20101 from calixteman/issue20065
Use canvas context text primitives when the font file is missing
2025-07-18 20:03:22 +02:00
Calixte Denizet
8b17e5ecd8 Use canvas context text primitives when the font file is missing
It fixes #20065.

The only to get a path (from the path generator) is when the font is embedded.
So when we need a path (disableFontFace: true or when we want to use a pattern for stroking/filling), it's impossible
to fulfil.
2025-07-18 19:57:30 +02:00
Tim van der Meij
e4585c2452
Merge pull request #20104 from calixteman/fix_newpopup
[Editor] Only add a popup to an existing annotation if it exits
2025-07-18 19:34:03 +02:00
Calixte Denizet
6d7e0e7025 [Editor] Only add a popup to an existing annotation if it exits
It fixes the ink integration test "must update an existing annotation".
2025-07-18 17:31:53 +02:00
Tim van der Meij
23bd705cea
Merge pull request #20080 from calixteman/add_comment_1
[Editor] Add the possibility to add Popup annotations (bug 1976724)
2025-07-17 21:07:06 +02:00
calixteman
d2f8e60794
Merge pull request #20098 from calixteman/update_highlight_color
[Editor] Make possible to change the highlight color from the main panel
2025-07-17 21:06:29 +02:00
Calixte Denizet
5162209b27 [Editor] Make possible to change the highlight color from the main panel
It's consistent with the way to change colors for FreeText or Ink annotations.
2025-07-17 20:57:51 +02:00
Tim van der Meij
ef9292094c
Merge pull request #20103 from calixteman/avoid_undefined_id
Don't add an undefined id to the span for marked content
2025-07-17 20:36:16 +02:00
Calixte Denizet
86d58b637f Don't add an undefined id to the span for marked content
It fixes #20102.
2025-07-17 19:13:30 +02:00
Calixte Denizet
636ff503ff [Editor] Add the possibility to add Popup annotations (bug 1976724)
It's a first big step.
This patch contains a new modal dialog to let the user edit/update a Popup
2025-07-15 22:39:16 +02:00
Tim van der Meij
9f645fb9a6
Merge pull request #20095 from calixteman/issue20091
[Editor] Make sure that doorhangers are large enough to fit localized strings
2025-07-15 19:50:48 +02:00
Tim van der Meij
be10bb8c7b
Merge pull request #20094 from calixteman/use_rounded_color_swatch
[Editor] Use a round color swatch for the basic color picker
2025-07-15 19:48:07 +02:00
Calixte Denizet
ca4e219b7b [Editor] Make sure that doorhangers are large enough to fit localized strings
It fixes #20091.
2025-07-15 17:14:44 +02:00
Calixte Denizet
b2aba463a5 [Editor] Use a round color swatch for the basic color picker 2025-07-15 15:06:07 +02:00
calixteman
5600c0ac02
Merge pull request #20092 from calixteman/mv_a11y_alert
Avoid Firefox test failure
2025-07-15 10:53:32 +02:00
Calixte Denizet
6b5aee2923 Avoid Firefox test failure
It fixes test: accessible/tests/mochitest/elm/test_HTMLSpec.html
2025-07-15 10:50:38 +02:00
calixteman
4f2390a607
Merge pull request #20070 from calixteman/editor_toolbar_color
[Editor] Add a color picker in the toolbar of Ink and Freetext annotations
2025-07-14 23:55:51 +02:00
Calixte Denizet
dbd6f8cdd4 [Editor] Add a color picker in the toolbar of Ink and Freetext annotations 2025-07-14 23:00:01 +02:00
calixteman
ac2a0c5080
Merge pull request #20085 from calixteman/bug1975719
Handle the case where all the image data are in the alpha channel (bug 1975719)
2025-07-14 22:44:19 +02:00
calixteman
e0783cd075
Merge pull request #20086 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-07-13 19:47:11 +02:00
calixteman
9070a2786a
Merge pull request #20087 from timvandermeij/fix-intermittent-viewer
Fix the "must check that canvas perfectly fits the page whatever the zoom level" viewer integration test
2025-07-13 13:54:24 +02:00
Tim van der Meij
a0f8cbafcf
Fix the "must check that canvas perfectly fits the page whatever the zoom level" viewer integration test
In order to screenshot the page and assert that it's monochrome,
providing a regression test for #18694, the viewer background is
configured to match the page background because screenshotting the page
always captures a small part of the viewer background as well, and this
way we can easily go over all pixels and check that they are all equal.

However, in addition to configuring the viewer background the test also
hides the toolbar and removes the page border. Especially the latter
makes `scrollIntoView` fail in both Chrome and Firefox with recent
Puppeteer versions, for reasons which remain a bit unclear.

Fortunately both hiding the toolbar and removing the page border is not
actually necessary (anymore) for the test to work, so we can simply
remove those actions to fix the issue and reduce the amount of code. To
make sure that the test still covers the original issue correctly we've
reverted the changes from #18698 and then test still fails as expected.

Fixes #19811.
Fixes 68332ec2.
2025-07-12 21:49:33 +02:00
Tim van der Meij
3054942101
Update translations to the most recent versions 2025-07-12 20:21:07 +02:00
Tim van der Meij
7a129f8eae
Update dependencies to the most recent versions 2025-07-12 20:20:05 +02:00
Tim van der Meij
b7a0f01f40
Merge pull request #19976 from calixteman/write_popup
[Editor] Add the possibility to add a popup to an annotation when saving
2025-07-12 15:28:56 +02:00
Tim van der Meij
64b150f78f
Merge pull request #20077 from calixteman/remove_popup
[Editor] Remove a popup from the DOM when it's deleted
2025-07-12 15:25:49 +02:00
Calixte Denizet
6f8796d2c8 Handle the case where all the image data are in the alpha channel (bug 1975719)
and add an error message in case where there is no data in the image.
2025-07-11 22:34:37 +02:00
Calixte Denizet
b07914843b [Editor] Remove a popup from the DOM when it's deleted 2025-07-11 21:55:14 +02:00
Calixte Denizet
8fc51dc089 [Editor] Add the possibility to add a popup to an annotation when saving
When saving/printing, only update the properties which are provided and set
a default value only when there is no pre-existing one.
2025-07-11 21:42:21 +02:00
Tim van der Meij
e853a8f41a
Merge pull request #20081 from calixteman/signature_description
Add the l10n parameter when pasting a Signature annotation
2025-07-11 20:27:06 +02:00
Tim van der Meij
c296fb8f95
Merge pull request #20084 from calixteman/hcm_popup_trigger_area
In HCM, invert colors when hovering an annotation with a popup
2025-07-11 20:22:31 +02:00
Tim van der Meij
094253f2de
Merge pull request #20082 from calixteman/fix_firefox_printing
Use the canvas context from mozPrintCallback when printing a pdf from the Firefox viewer
2025-07-11 20:21:03 +02:00
Calixte Denizet
7091647039 In HCM, invert colors when hovering an annotation with a popup 2025-07-11 15:35:35 +02:00
Calixte Denizet
1c15ba7789 Use the canvas context from mozPrintCallback when printing a pdf from the Firefox viewer
The context is specific to the callback and cannot be created from the canvas itself.
2025-07-11 12:55:39 +02:00
Calixte Denizet
0f504d9a1a Add the l10n parameter when pasting a Signature annotation 2025-07-10 21:01:24 +02:00
calixteman
2e0f1ec515
Merge pull request #20076 from calixteman/revert_20047
Revert "Make horizontal padding relative to device width"
2025-07-09 18:09:26 +02:00
Calixte Denizet
e36f58ee4d Revert "Make horizontal padding relative to device width"
This reverts commit c138887c1f7613bce44b99d22b63e2d744b0fb40.
2025-07-09 17:38:49 +02:00
calixteman
2dadac8877
Merge pull request #20071 from ryzokuken/bump-version-5.4
Bump library version to `5.4`
2025-07-09 14:57:13 +02:00
Ujjwal Sharma
1d702d4d6d Bump library version to 5.4 2025-07-08 23:27:41 +02:00
calixteman
1b427a3af5
Merge pull request #20016 from ryzokuken/move-getcontext
[api-minor] Move getContext call to InternalRenderTask
2025-07-08 22:20:19 +02:00
calixteman
0e2b59e3d5
Merge pull request #20064 from calixteman/dict_api
Add few methods to the Dict class in order to simplify the code when writing an annotation
2025-07-08 22:16:57 +02:00
calixteman
481b74a1c2
Merge pull request #20063 from calixteman/issue20062
Fix the default appearance of a Polygon annotation when a fill color is provided
2025-07-08 22:10:52 +02:00
Calixte Denizet
63b37b4371 Add few methods to the Dict class in order to simplify the code when writing an annotation 2025-07-08 21:23:29 +02:00
Calixte Denizet
ecc7096a80 Fix the default appearance of a Polygon annotation when a fill color is provided
It fixes #20062.
2025-07-08 20:51:58 +02:00
Tim van der Meij
b999d5ce58
Merge pull request #20060 from noritaka1166/fix-typos
Fix typos across the codebase
2025-07-08 18:28:52 +02:00
calixteman
729f2bb148
Merge pull request #20058 from calixteman/use_creationdate_popup
Use the creation date in the popup when there is no modification date
2025-07-07 10:55:28 +02:00
Calixte Denizet
bb52a440ce Use the creation date in the popup when there is no modification date
Remove the h1 element in popup title because it caused a warning in Firefox and use a span instead.
2025-07-07 10:51:35 +02:00
Noritaka Kobayashi
fa568e826d
Fix typos across the codebase 2025-07-07 09:59:36 +09:00
Tim van der Meij
b3794c7148
Merge pull request #20061 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-07-06 20:45:30 +02:00
Tim van der Meij
be1f5fe009
Bump the stable version in pdfjs.config 2025-07-06 20:42:12 +02:00
Tim van der Meij
cbeef3233f
Merge pull request #20056 from calixteman/one_click
[Editor] Allow to change the editor mode when selecting the corresponding editor (bug 1975538)
2025-07-06 19:35:31 +02:00
Ujjwal Sharma
b1b728d47f [api-minor] Move getContext call to InternalRenderTask
This is a precursor to moving the call into a
worker thread to let us use `OffscreenCanvas`. The
current position wouldn't work since we make
transformations to the canvas object after the
getContext call, which isn't allowed for
OffscreenCanvas. Also it isn't allowed to clone or
`transferControlToOffscreen` the canvas after the
`getContext` call.
2025-07-04 00:53:51 +02:00
Calixte Denizet
6d2c6cfc9f [Editor] Allow to change the editor mode when selecting the corresponding editor (bug 1975538)
For example, selecting an ink editor just after having created a freetext will switch to ink mode.
2025-07-03 23:27:34 +02:00
calixteman
2d0ba7db08
Merge pull request #20043 from yyliu12/popup-rotation-fix
Make Popup annotations always have noRotate flag set as true
2025-07-03 17:27:40 +02:00
calixteman
ad31385792
Merge pull request #20055 from calixteman/bug1975264
[Editor] When an annotation is added, announce it if the user is using a screen reader (bug 1975264)
2025-07-03 17:23:56 +02:00
calixteman
54c0d56ccf
Merge pull request #20054 from calixteman/bug1974863
Don't focus the viewer at startup (bug 1974863)
2025-07-03 17:01:19 +02:00
Calixte Denizet
c22a425b04 [Editor] When an annotation is added, announce it if the user is using a screen reader (bug 1975264) 2025-07-03 16:53:01 +02:00
calixteman
fd87e668e0
Merge pull request #20047 from Aditi-1400/fix-horizontal-scroll
Make horizontal padding relative to device width
2025-07-03 16:52:15 +02:00
Yuyang Liu
d8ecfad8bd Make Popup annotations always have noRotate flag set as true
Necessary because when there is no Popup annotation created along
with a Text annotation, the Popup annotation created by pdf.js
does not receive the noRotate flag
2025-07-03 05:52:31 +09:00
Calixte Denizet
aaae516894 Don't focus the viewer at startup (bug 1974863)
It's useless and it causes screen readers to not always read the document title.
2025-07-02 17:34:23 +02:00
calixteman
426ee03488
Merge pull request #20041 from calixteman/bug1974436
Remove the shadow from the links (bug 1974436)
2025-07-01 12:59:17 +02:00
Tim van der Meij
8f2a4561b2
Merge pull request #20039 from calixteman/bug1974257
[Editor] In the signature modal, disable the save checkbox when the storage is full (bug 1974257)
2025-06-30 21:46:38 +02:00
Calixte Denizet
9acd16a0c7 [Editor] In the signature modal, disable the save checkbox when the storage is full (bug 1974257) 2025-06-30 21:42:28 +02:00
Calixte Denizet
fc9ba0cda3 Remove the shadow from the links (bug 1974436)
The shadow was taken into account when computing the bounding box of the section
containing the link and it was making the clip path wrong.
Since the shadow is almost invisible because of the opacity, the yellow color and the clip
we can remove it without causing any visual regressions (and as a side effect it'll avoid
to use resources to compute it when displayed).
2025-06-30 21:39:22 +02:00
Tim van der Meij
f4043b03e2
Merge pull request #20038 from calixteman/bug1974112
Don't remove a dash at the end of a line when guessing urls (bug 1974112)
2025-06-30 20:43:17 +02:00
Aditi
c138887c1f Make horizontal padding relative to device width
The fixed -400px horizontal offset used by
scrollIntoView led to horizontal scroll only moving
part-way right on narrow screens. The highlights near
the right-edge remained party or completely off
screen.

This centres the highlighted match on any viewport width while
clamping the left margin to 20-400px. On very narrow screens
the scrollbar now moves all the way to the right instead of
stopping midway.
2025-06-30 19:08:02 +05:30
Calixte Denizet
bb6b42177c Don't remove a dash at the end of a line when guessing urls (bug 1974112) 2025-06-26 18:55:59 +02:00
calixteman
85b67f19bc
Merge pull request #20031 from calixteman/telemetry_signature_certificate
Add some telemetry in order to know what are the certificates used in pdfs (bug 1973573)
2025-06-24 22:36:14 +02:00
Calixte Denizet
194e2ede4d Add some telemetry in order to know what are the certificates used in pdfs (bug 1973573) 2025-06-24 22:23:29 +02:00
calixteman
1ebc896b6f
Merge pull request #20019 from calixteman/bug1885505
Get the text under highlight/squiggly/underline/strikethrough annotations (bug 1885505)
2025-06-22 23:39:40 +02:00
Calixte Denizet
3bdc5d54fe Get the text under highlight/squiggly/underline/strikethrough annotations (bug 1885505)
and add an invisible element containing the text in the annotation layer to make
it readable by a screen reader.
2025-06-22 21:47:29 +02:00
Tim van der Meij
7d3b2a6d3f
Merge pull request #20028 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-06-22 18:38:23 +02:00
Tim van der Meij
08c0a6d6b1
Update translations to the most recent versions 2025-06-22 15:40:43 +02:00
Tim van der Meij
571a04bd23
Fix low-severity vulnerability in the brace-expansion dependency
This patch is automatically generated with `npm audit fix` and fixes
CVE-2025-5889.
2025-06-22 15:40:43 +02:00
Tim van der Meij
bd511747c8
Upgrade @types/node to version 24.0.3
This commit makes the type definitions compatible with Node 24 which was
released in May 2025.
2025-06-22 15:25:35 +02:00
Tim van der Meij
7f619c7605
Update dependencies to the most recent versions 2025-06-22 15:24:53 +02:00
Tim van der Meij
8fe9db0fb5
Merge pull request #20022 from calixteman/color_picker_a11y
[Editor] Fix the accessibility of the dropdown in the color picker
2025-06-22 14:23:20 +02:00
Tim van der Meij
ac399e77e8
Merge pull request #20023 from calixteman/edit_added_annotation
[Editor] When editing mode is disabled, allow to double click on a added annotation to edit it
2025-06-21 16:23:56 +02:00
Tim van der Meij
032f80e46a
Merge pull request #20027 from calixteman/issue20024
Allow to have an URL as file parameter when loading the viewer
2025-06-21 16:17:45 +02:00
Calixte Denizet
eafc040734 Allow to have an URL as file parameter when loading the viewer 2025-06-21 14:57:24 +02:00
calixteman
c7796c7f8d
Merge pull request #19993 from calixteman/editor_toolbar_simplification
Slightly simplify the way to create the editor toolbar
2025-06-20 21:59:01 +02:00
calixteman
e78575e593
Merge pull request #19986 from calixteman/dont_show_empty_popup
Only show popups when they've some contents to display
2025-06-20 13:48:30 +02:00
calixteman
84d1703897
Merge pull request #19992 from calixteman/hashtag_filename
Correctly handle files with a hash sign in their names (bug 1894166)
2025-06-20 12:52:31 +02:00
Calixte Denizet
b97cee2ab5 Correctly handle files with a hash sign in their names (bug 1894166)
It fixes #19990.
2025-06-20 09:21:41 +02:00
calixteman
e9527ce308
Merge pull request #20021 from calixteman/issue15490
[JS] Make the date parser less strict
2025-06-20 09:12:43 +02:00
Calixte Denizet
2541d96bf5 [JS] Make the date parser less strict
and display the expected date formt as a tooltip.
2025-06-20 08:57:07 +02:00
Calixte Denizet
2548405401 Slightly simplify the way to create the editor toolbar 2025-06-19 23:03:06 +02:00
Calixte Denizet
d0b0064643 [Editor] When editing mode is disabled, allow to double click on a added annotation to edit it
It's already possible but only when double clicking outside the the text layer.
This patach adds the possibility to click on the text layer.
2025-06-19 21:15:08 +02:00
Calixte Denizet
1f2e9e5c0f [Editor] Fix the accessibility of the dropdown in the color picker 2025-06-19 20:08:33 +02:00
Calixte Denizet
96216de410 Only show popups when they've some contents to display
Chrome, Edge and Acrobat do that.
2025-06-19 16:33:52 +02:00
calixteman
5653458b51
Merge pull request #20013 from calixteman/fix_annotation_tabindex
Make annotations focusable just after the text layer
2025-06-19 14:09:27 +02:00
calixteman
3baea2feff
Merge pull request #20003 from calixteman/bug1971299
Remove the possibility to go to the next page in using the ENTER key (bug 1971299)
2025-06-17 22:43:18 +02:00
calixteman
412500c9b9
Merge pull request #19996 from calixteman/bug1961423_bis
Fix a printing issue on Mac (bug 1961423)
2025-06-17 21:23:49 +02:00
calixteman
35b604b9f8
Merge pull request #20011 from calixteman/bug1971134
[Editor] Fix the text alignment in freetext annotations (bug 1971134)
2025-06-17 21:18:50 +02:00
calixteman
802808c47a
Merge pull request #20004 from calixteman/move_popup_dom
Move the popup annotation in the DOM just after the element triggering it
2025-06-16 23:11:23 +02:00
Calixte Denizet
0d995fa089 Make annotations focusable just after the text layer 2025-06-16 19:06:13 +02:00
Calixte Denizet
8d7246af98 [Editor] Fix the text alignment in freetext annotations (bug 1971134) 2025-06-16 15:11:32 +02:00
Calixte Denizet
27a81c506e Move the popup annotation in the DOM just after the element triggering it 2025-06-16 14:42:44 +02:00
Tim van der Meij
c796b93473
Merge pull request #20002 from nicolo-ribaudo/reftest-log-progress
Log test number and id in reftests
2025-06-15 19:36:11 +02:00
Calixte Denizet
07f94825c3 Remove the possibility to go to the next page in using the ENTER key (bug 1971299) 2025-06-10 14:58:18 +02:00
Nicolò Ribaudo
f789c132da
Log test number and id in reftests
The new output looks like
```
Harness thinks this browser is firefox
Fetching manifest "/test/test_manifest.json"... done
[1/1152] bug1755201:
  Skipping file "pdfs/bug1755201.pdf"
[2/1152] issue14864:
  Skipping file "pdfs/issue14864.pdf"
[3/1152] issue18503:
  Skipping file "pdfs/issue18503.pdf"
[4/1152] issue19835:
  Skipping file "pdfs/issue19835.pdf"
[5/1152] filled-background-range:
  Loading file "pdfs/filled-background.pdf"
    Loading page 1/3... Snapshotting... done
    Loading page 2/3... Snapshotting... done
    Loading page 3/3... Snapshotting... done
[6/1152] tracemonkey-eq:
  Loading file "pdfs/tracemonkey.pdf"
    Loading page 1/14... Snapshotting... done
    Loading page 2/14... Snapshotting... done
```

This gives an idea of how many tests are left while they are running
2025-06-09 18:48:06 +02:00
Tim van der Meij
250cc7d299
Merge pull request #20000 from timvandermeij/intermittent-find
Fix intermittent failure in the find integration tests
2025-06-08 22:11:15 +02:00
Tim van der Meij
7133259341
Merge pull request #19997 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-06-08 22:10:01 +02:00
Tim van der Meij
64a2d708f9
Fix intermittent failure in the find integration tests
After clicking the find button we need to wait for the input field to
appear before we try to type in it, but instead we were waiting for the
button to appear. However, the button is always present, so the current
`waitForSelector` call is basically a no-op, and this can cause the
integration tests to fail intermittently if we continue before the
input field is actually visible.

This appears to be due a typo first introduced in commit
d10da907dac86c103b787127110a59aed82c7aaa that has been copy/pasted.

This commit fixes the issue by waiting for the input field to be visible
before we continue typing in it.
2025-06-08 20:21:13 +02:00
Tim van der Meij
9edcfa26ca
Update translations to the most recent versions 2025-06-08 18:07:23 +02:00
Tim van der Meij
fda68a5a56
Upgrade yargs to version 18.0.0
This is a major version bump, but the changelog at
https://github.com/yargs/yargs/releases/tag/v18.0.0
doesn't indicate any breaking changes that should impact us.
2025-06-08 18:07:23 +02:00
Tim van der Meij
34ef9ece38
Upgrade svglint to version 4.1.0
This is a major version bump, but the changelog at
https://github.com/simple-icons/svglint/releases/tag/v4.0.0
doesn't indicate any breaking changes that should impact us.
2025-06-08 18:06:12 +02:00
Tim van der Meij
003cffe6cb
Update dependencies to the most recent versions 2025-06-08 18:02:45 +02:00
Calixte Denizet
14f0e88910 Fix a printing issue on Mac (bug 1961423)
On mac, the pdf backend used when printing is using the cid from the font,
so if a char has null cid then it's equivalent to .notdef and some viewers
don't display it.
2025-06-07 21:33:17 +02:00
calixteman
18d7aafc94
Merge pull request #19985 from calixteman/puppeteer_24.10.0
Update Puppeteer to version 24.10.0
2025-06-03 20:55:45 +02:00
Calixte Denizet
fd3a41c149 Update Puppeteer to version 24.10.0 2025-06-03 19:38:35 +02:00
Tim van der Meij
7e8587428d
Merge pull request #19981 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-06-01 20:30:28 +02:00
Tim van der Meij
8a0eb51f53
Bump the stable version in pdfjs.config 2025-06-01 20:26:12 +02:00
Tim van der Meij
47ad820d95
Merge pull request #19952 from timvandermeij/intermittent-viewer-origin
Fix intermittent failure in the "supports specifying a custom origin" viewer integration test
2025-06-01 20:10:31 +02:00
Tim van der Meij
f251e600d2
Fix intermittent failure in the "supports specifying a custom origin" viewer integration test
The problem in the original code is that `getTextAt` is called too
early and therefore returns unexpected text content. This can happen
because we call `increaseScale` and then wait for the page's text layer
to be visible, but it can take some time before the zoom actually
occurs/completes in the viewer and in the meantime the old (pre-zoom)
text layer may still be visible, causing us to continue too soon because
we don't validate that we're dealing with the post-zoom text layer.

This commit fixes the issue by simply waiting for the expected text to
show up at the given origin coordinates, which makes the test work
independent of viewer actions/timing.
2025-06-01 19:33:58 +02:00
calixteman
d63aabd662
Merge pull request #19969 from calixteman/editor_inconsistencies
[Editor] Change mode when double clicking on an editor
2025-05-28 18:00:26 +02:00
Calixte Denizet
47e69e93a3 [Editor] Change mode when double clicking on an editor
It was only possible to double click on a FreeText editor while being in ink mode (or any other).
2025-05-28 17:49:16 +02:00
calixteman
712d502561
Merge pull request #19975 from calixteman/fix_color_dialog_buttons
Fix the colors of disabled buttons in the dialogs
2025-05-28 16:14:28 +02:00
Calixte Denizet
de1a9e7055 Fix the colors of disabled buttons in the dialogs 2025-05-26 19:11:24 +02:00
Tim van der Meij
21ef454faf
Merge pull request #19962 from Snuffleupagus/api_utils
Move a few helper functions/classes out of the `src/display/api.js` file
2025-05-24 14:21:29 +02:00
Tim van der Meij
d90ec29b4d
Merge pull request #19964 from Snuffleupagus/core-catalog-private
Replace semi-private fields/methods with actual private ones in `src/core/catalog.js`
2025-05-24 14:16:06 +02:00
Jonas Jenwald
f11d8b0f67
Merge pull request #19972 from Snuffleupagus/issue-19971
Ignore empty paths when optimizing `constructPath` operations (issue 19971)
2025-05-23 18:34:07 +02:00
Jonas Jenwald
c5449a98e0 Ignore empty paths when optimizing constructPath operations (issue 19971)
Note how we're handling empty paths in [src/display/canvas.js](a8e05d82e2/src/display/canvas.js (L1423-L1428)), hence we need add similar code in the `QueueOptimizer` as well.
2025-05-23 13:59:05 +02:00
Jonas Jenwald
a8e05d82e2
Merge pull request #19961 from nicolo-ribaudo/debugger-contructPath-op
Show the op dispatched by constructPath in the debugger
2025-05-23 13:15:55 +02:00
Jonas Jenwald
d81174d7bc
Merge pull request #19956 from Snuffleupagus/versionInfoHeader
Improve how the PDF.js version/commit information is exposed in the *built* files
2025-05-22 15:24:02 +02:00
calixteman
875233b3c6
Merge pull request #19967 from mozilla/revert-19934-minify
Revert "Minify the js code when building for Firefox (bug 1965003)"
2025-05-22 14:22:49 +02:00
calixteman
32789073a9
Revert "Minify the js code when building for Firefox (bug 1965003)" 2025-05-22 14:08:31 +02:00
Jonas Jenwald
a90e46bdc9 Use nullish coalescing in the Catalog.prototype.numPages getter 2025-05-21 16:47:20 +02:00
Jonas Jenwald
0d2ab3c709 Replace semi-private fields/methods with actual private ones in src/core/catalog.js
Additionally, move a couple of "public" fields out of the class constructor and initialize them directly instead.
2025-05-21 12:10:07 +02:00
Jonas Jenwald
e91b480c09 Move the PDFObjects class to its own file
This isn't directly part of the official API, and having this class in its own file could help avoid future changes (e.g. issue 18148) affecting the size of the `src/display/api.js` file unnecessarily.
2025-05-20 13:47:36 +02:00
Jonas Jenwald
0105237af6 Move a few helper functions/classes out of the src/display/api.js file
Given that this file represents the official API, it's difficult to avoid it becoming fairly large as we add new functionality. However, it also contains a couple of smaller (and internal) helpers that we can move into a new utils-file.

Also, we inline the `DEFAULT_RANGE_CHUNK_SIZE` constant since it's only used *once* and its value has never been changed in over a decade.
2025-05-20 13:47:36 +02:00
Nicolò Ribaudo
0596f03d4e
Show the op dispatched by constructPath in the debugger
The `constructPath` op receives as arguments not only the
information to construct the path, but also the op to apply
the path to (such as "fill", or "stroke").

This commit updates the Stepper tool in the debugger to decode
that op, showing its name rather than just its numeric ID.
2025-05-19 19:33:14 +02:00
calixteman
fc68a9f3ee
Merge pull request #19958 from calixteman/rm_useless_subarray_flate_stream
Don't create a useless subarray when getting image data from a flate stream
2025-05-19 19:29:25 +02:00
Jonas Jenwald
e921533577
Merge pull request #19960 from Snuffleupagus/version-5.3
Bump library version to `5.3`
2025-05-19 18:00:47 +02:00
Jonas Jenwald
6c803e89e6 Bump library version to 5.3 2025-05-19 17:57:28 +02:00
calixteman
f148106cb1
Merge pull request #19957 from calixteman/rm_qcms_subarray
Remove all the useless subarrays when using qcms.
2025-05-19 17:33:52 +02:00
calixteman
72faeeab93
Merge pull request #19959 from calixteman/undefined_worker_port
Fix pdfjsPreloadedWorker when it's undefined
2025-05-19 17:29:18 +02:00
Jonas Jenwald
36b40d959b
Merge pull request #19955 from Snuffleupagus/issue-19954
Support Type3 fonts with an incomplete /FontDescriptor dictionary (issue 19954)
2025-05-19 17:26:46 +02:00
Calixte Denizet
69231e2dbd Fix pdfjsPreloadedWorker when it's undefined 2025-05-19 17:05:37 +02:00
Calixte Denizet
3ecbef516d Don't create a useless subarray when getting image data from a flate stream 2025-05-19 16:48:23 +02:00
Calixte Denizet
782e883a87 Remove all the useless subarrays when using qcms.
It reduces the memory use and the newly added function `getRgbHex` is 4 times faster.
2025-05-19 16:07:57 +02:00
calixteman
2b9f621087
Merge pull request #19953 from calixteman/rm_useless_arrays
[api-minor] Create the css color to use with the canvas in the worker
2025-05-19 16:02:08 +02:00
Jonas Jenwald
c02ea0c681 Simplify how we handle Type3 fonts without a /FontDescriptor dictionary
Part of this is very old code, which we can now simplify a little bit.
2025-05-19 15:26:11 +02:00
Jonas Jenwald
97a42486f5 Improve how the PDF.js version/commit information is exposed in the *built* files
To make it easier to tell which PDF.js version/commit that the *built* files correspond to, they have (since many years) included `pdfjsVersion` and `pdfjsBuild` constants with that information.

As currently implemented this has a few shortcomings:
 - It requires manually adding the code, with its preprocessor statements, in all relevant files.

 - It requires ESLint disable statements, since it's obviously unused code.

 - Being unused, this code is removed in the minified builds.

 - This information would be more appropriate as comments, however Babel discards all comments during building.

 - It would be helpful to have this information at the top of the *built* files, however it's being moved during building.

To address all of these issues, we'll instead utilize Webpack to insert the version/commit information as a comment placed just after the license header.
2025-05-19 15:01:05 +02:00
Calixte Denizet
5789afd3f8 Create the css color to use with the canvas in the worker
It slightly reduces the time spent to draw and the memory used.
2025-05-19 14:52:24 +02:00
Jonas Jenwald
5f5d9dfc28 Support Type3 fonts with an incomplete /FontDescriptor dictionary (issue 19954)
We have a fallback for the common case of Type3 fonts without a /FontDescriptor dictionary, however we also need to handle the case where it's present but lacking the required /FontName entry.
2025-05-19 12:56:14 +02:00
Tim van der Meij
60574fb7e3
Merge pull request #19950 from timvandermeij/intermittent-all-await
Fix missing `await` for asynchronous method calls in the integration tests
2025-05-18 19:12:48 +02:00
Tim van der Meij
393e799e49
Fix missing await for asynchronous method calls in the integration tests
The `Page.evaluate()` and `Mouse.click()` APIs in Puppeteer both return
a promise; see https://pptr.dev/api/puppeteer.page.evaluate and
https://pptr.dev/api/puppeteer.mouse.click, and should therefore be
awaited before proceeding in tests to make sure that the test's behavior
is deterministic and avoid intermittent failures.

The following command was used to find potential places to fix:
`grep -nEr "[^await|return] page\." test/integration/*`
2025-05-18 18:19:46 +02:00
Tim van der Meij
819671d42f
Merge pull request #19949 from timvandermeij/intermittent-stamp-undo
Fix intermittent failure in the stamp editor's undo-related integration tests
2025-05-18 15:17:41 +02:00
Tim van der Meij
6355dd7ded
Fix intermittent failure in the stamp editor's undo-related integration tests
The clipboard, used via the `copyImage` helper function, is a shared
resource, so access to it cannot happen concurrently because it could
result in tests overwriting each other's contents. Most tests using
the clipboard are therefore run sequentially, but only the stamp
editor's undo-related tests weren't, so this commit fixes the issue
by running those tests sequentially too.
2025-05-18 14:36:19 +02:00
Tim van der Meij
f6e4b1cf4a
Merge pull request #19945 from Snuffleupagus/NetworkStream-rm-Node-Error
Remove Node.js-specific checks when using the Fetch API
2025-05-18 12:05:13 +02:00
Tim van der Meij
30bba5f165
Merge pull request #19944 from Snuffleupagus/PDFDataRangeTransport-private-fields
Use private fields in the `PDFDataRangeTransport` class
2025-05-18 12:01:03 +02:00
Jonas Jenwald
a882195e9b Remove Node.js-specific checks when using the Fetch API
Given that Node.js has full support for the Fetch API since version 21, see the "History" data at https://nodejs.org/api/globals.html#fetch, it seems unnecessary for us to manually check for various globals before using it.

Since our primary development target is browsers in general, and Firefox in particular, being able to remove Node.js-specific compatibility code is always helpful.

Note that we still, for now, support Node.js version 20 and if the relevant globals are not available then Errors will instead be thrown from within the `PDFFetchStream` class.
2025-05-18 10:49:02 +02:00
Jonas Jenwald
99b23ea1f6 Use private fields in the PDFDataRangeTransport class 2025-05-18 10:16:46 +02:00
Jonas Jenwald
f72f240699
Merge pull request #19939 from Snuffleupagus/disableWorker-clear-workerPort
Ensure that the viewer clears the `workerPort` option when using "fake" workers
2025-05-18 08:38:48 +02:00
Tim van der Meij
23f269b353
Merge pull request #19942 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-05-17 20:41:48 +02:00
Tim van der Meij
91679ece4b
Merge pull request #19943 from Snuffleupagus/PDFWorker-create
Replace `PDFWorker.fromPort` with a generic `PDFWorker.create` method
2025-05-17 19:12:38 +02:00
Jonas Jenwald
fc697b3602 Utilize private fields and methods more in the PDFWorker class
This replaces, wherever possible, the old semi-private fields and methods with actually private ones.
2025-05-17 18:05:49 +02:00
Jonas Jenwald
ab672f0b77 Replace PDFWorker.fromPort with a generic PDFWorker.create method
This allows us to simply invoke `PDFWorker.create` unconditionally from the `getDocument` function, without having to manually check if a global `workerPort` is available first.
2025-05-17 16:13:41 +02:00
Tim van der Meij
1e4ba0b8bf
Update translations to the most recent versions 2025-05-17 15:58:38 +02:00
Tim van der Meij
d297e44f3f
Update dependencies to the most recent versions 2025-05-17 15:50:54 +02:00
Tim van der Meij
278fc064eb
Merge pull request #19917 from Snuffleupagus/unicorn-59-rule-updates
Add a couple of new `eslint-plugin-unicorn` rules
2025-05-17 13:55:52 +02:00
Jonas Jenwald
b81b9ce00d Add a couple of new eslint-plugin-unicorn rules
The recent `eslint-plugin-unicorn` update added, and replaced, a few rules that seem useful for us; please refer to https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v59.0.0

Note that none of the following rules required any code-changes:
 - Replace `no-array-push-push` with `prefer-single-call`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-call.md

 - Add `no-unnecessary-slice-end`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-slice-end.md

 - Add `no-unnecessary-array-flat-depth`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md

 - Add `no-unnecessary-array-splice-count`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md
2025-05-17 13:49:11 +02:00
Tim van der Meij
b05351ceae
Merge pull request #19937 from studystill/master
chore: remove redundant word in comment
2025-05-17 13:34:39 +02:00
Tim van der Meij
57cbaae8e4
Merge pull request #19916 from Snuffleupagus/prefer-import-meta-properties
Enable the `unicorn/prefer-import-meta-properties` ESLint plugin rule
2025-05-17 13:33:48 +02:00
Jonas Jenwald
eef1e3e87f Ensure that the viewer clears the workerPort option when using "fake" workers
Without this "fake" workers may be ignored in the API, which isn't really what you want when manually providing the `disableWorker=true` hash parameter. (Note that this requires the `pdfBugEnabled` option/preference to be set as well.)

Also, after the changes in PR 19810 we can just load the "fake" worker directly in development mode and don't need to manually assign it to the global scope.
2025-05-17 11:41:33 +02:00
studystill
b585937340 chore: remove redundant word in comment
Signed-off-by: studystill <chenghuiyue@outlook.com>
2025-05-16 15:16:26 +08:00
Jonas Jenwald
13c9995455 Enable the unicorn/prefer-import-meta-properties ESLint plugin rule
Given that we require Node.js versions `>=20.16.0 || >=22.3.0` using this should be fine, based on the "History" data in https://nodejs.org/api/esm.html#importmetadirname respectively https://nodejs.org/api/esm.html#importmetafilename.

Please also see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-import-meta-properties.md
2025-05-16 07:47:08 +02:00
Jonas Jenwald
d97b65378f
Merge pull request #19933 from mozilla/dependabot/npm_and_yarn/undici-6.21.3
Bump undici from 6.21.1 to 6.21.3
2025-05-15 23:28:00 +02:00
calixteman
f4a3e47018
Merge pull request #19935 from calixteman/bug1966721
Use the worker created in the child actor (bug 1966721)
2025-05-15 21:21:06 +02:00
Calixte Denizet
f01b13d332 Use the worker created in the child actor (bug 1966721) 2025-05-15 21:17:44 +02:00
Jonas Jenwald
b3ccc55c1d
Merge pull request #19936 from Snuffleupagus/workerPort-firefox
Allow using the `workerPort` option in Firefox
2025-05-15 21:09:08 +02:00
calixteman
be463f0e0c
Merge pull request #19934 from calixteman/minify
Minify the js code when building for Firefox (bug 1965003)
2025-05-15 20:11:11 +02:00
Jonas Jenwald
e5e9d18289 Allow using the workerPort option in Firefox 2025-05-15 19:30:43 +02:00
Calixte Denizet
8129ccc9a7 Minify the js code when building for Firefox (bug 1965003)
It helps to improve the loading time in the worker by around 25% on Windows, Mac and Android.
2025-05-15 19:01:52 +02:00
dependabot[bot]
64c1e07f22
Bump undici from 6.21.1 to 6.21.3
Bumps [undici](https://github.com/nodejs/undici) from 6.21.1 to 6.21.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.21.1...v6.21.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.21.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-15 15:23:50 +00:00
Jonas Jenwald
b070a502c3
Merge pull request #19929 from Snuffleupagus/bug-1966086
Prefer the /Metadata, when available, in the document properties dialog (bug 1966086)
2025-05-15 15:54:42 +02:00
Jonas Jenwald
ab89773e49 Prefer the /Metadata, when available, in the document properties dialog (bug 1966086) 2025-05-15 15:12:09 +02:00
Jonas Jenwald
d4d0081ac9
Merge pull request #19923 from nicolo-ribaudo/fix-new-url
Remove unused OpenJPEG wasm fallback logic
2025-05-14 08:11:37 +02:00
Marco Castelluccio
2ed959d75a
Merge pull request #19897 from Snuffleupagus/ci-Node-24
Run CI tests in Node.js version 24
2025-05-14 00:09:06 +02:00
calixteman
a4b5b7c4bb
Merge pull request #19925 from calixteman/bug1962819
[Editor] Keep aspect ratio when rescaling an image before being processed for a signature (bug 1962819)
2025-05-13 20:07:11 +02:00
Nicolò Ribaudo
aebe0cb67f
Remove unused OpenJPEG wasm fallback logic
Emscripten generates code that allows the caller to provide the Wasm
module (thorugh Module.instantiateWasm), with a fallback in case
.instantiateWasm is not provided. We always define instantiateWasm, so
we can hard-code the check and let our dead code elimination logic
remove the unused fallback.

This commit also improved the dead code elimination logic so that if
a function declaration becomes unused as a result of removing dead
code, the function itself is removed.
2025-05-13 19:38:17 +02:00
Calixte Denizet
d6605674dd [Editor] Keep aspect ratio when rescaling an image before being processed for a signature (bug 1962819) 2025-05-13 19:12:17 +02:00
calixteman
2bb8099831
Merge pull request #19924 from calixteman/update_qcms
Update qcms build
2025-05-13 17:49:54 +02:00
Calixte Denizet
09f0af5b83 Update qcms build
It's a follow-up of https://github.com/mozilla/pdf.js.qcms/pull/1.
2025-05-13 16:44:18 +02:00
Jonas Jenwald
5e3d26601e
Merge pull request #19922 from nicolo-ribaudo/vite-ignore-minified
Preserve webpack/vite ignore comments when minifying
2025-05-13 14:54:17 +02:00
Nicolò Ribaudo
ff432c39f9
Preserve webpack/vite ignore comments when minifying
They were removed in the minified build, but the code that made the comments necessary was still there (just minified). This commit updates the Terser config to preserve them.

The default value of Terser's `comments` option is [`/@preserve|@copyright|@lic|@cc_on|^\**!/i`](d528103b7c/lib/output.js (L178C12-L178C53)), however the only type of comment it was actually matching in our case is `@lic`, for the license header in minified files. Thus the new regexp is `/@lic|webpackIgnore|@vite-ignore/i`.
2025-05-13 12:52:29 +02:00
Jonas Jenwald
3f1ecc1ba9
Merge pull request #19915 from Snuffleupagus/OutputScale-capPixels
Reduce duplication when computing the maximum canvas pixels
2025-05-10 21:47:52 +02:00
Jonas Jenwald
d5c534fb83 Reduce duplication when computing the maximum canvas pixels
*This is something that occurred to me when reviewing the latest PDF.js update in mozilla-central.*

Currently we duplicate essentially the same code in both the `OutputScale.prototype.limitCanvas` and `PDFPageDetailView.prototype.update` methods, which seems unnecessary, and to avoid that we introduce a new `OutputScale.capPixels` method that is used to compute the maximum canvas pixels.
2025-05-10 20:12:38 +02:00
calixteman
ca05a0dbfc
Merge pull request #19911 from calixteman/issue19753
Decode appearance keys of checkboxes
2025-05-10 15:01:22 +02:00
Jonas Jenwald
5f4bfe1fb9
Merge pull request #19913 from Snuffleupagus/openAction-array-validate
Improve validation in the `Catalog.prototype.openAction` getter
2025-05-10 14:53:48 +02:00
Jonas Jenwald
f26f984fa0 Improve validation in the Catalog.prototype.openAction getter
When the /OpenAction data is an Array we're currently using it as-is which could theoretically cause problems in corrupt PDF documents, hence we ensure that a "raw" destination is actually valid. (This change is covered by existing unit-tests.)

*Note:* In the Dictionary case we're using the `Catalog.parseDestDictionary` method, which already handles all of the necessary validation.
2025-05-10 11:51:58 +02:00
Calixte Denizet
49a098cb5d Decode appearance keys of checkboxes 2025-05-09 21:46:17 +02:00
calixteman
293506ada7
Merge pull request #19903 from Snuffleupagus/shorten-fieldObjects-getter
Shorten the `PDFDocument.prototype.fieldObjects` getter slightly
2025-05-09 15:49:51 +02:00
calixteman
ff0d9b13a7
Merge pull request #19902 from Snuffleupagus/core-document-shorten
Shorten the code in the `src/core/document.js` file
2025-05-09 15:48:49 +02:00
calixteman
a806f00ea1
Merge pull request #19755 from calixteman/reduce_canvas_size
Add a pref in order to cap the canvas area to a factor of the window one (bug 1958015)
2025-05-09 15:47:42 +02:00
Calixte Denizet
1225c1e39a Add a pref in order to cap the canvas area to a factor of the window one (bug 1958015)
This way it helps to reduce the overall canvas dimensions and make the rendering faster.
The drawback is that when scrolling, the page can be blurry in waiting for the rendering.

The default value is 200% on desktop and will be 100% for GeckoView.
2025-05-09 13:57:16 +02:00
Jonas Jenwald
69595a2919
Merge pull request #19905 from Snuffleupagus/locales-update-repo
Update the Firefox repository used in `external/importL10n/locales.mjs`
2025-05-08 13:57:53 +02:00
Jonas Jenwald
360d287d55 Update l10n files 2025-05-08 13:52:58 +02:00
Jonas Jenwald
feea4007b5 Update the Firefox repository used in external/importL10n/locales.mjs
The https://github.com/mozilla/gecko-dev repository has been deprecated in favour of https://github.com/mozilla-firefox/firefox, hence we should tweak the l10n-update script accordingly.
2025-05-08 13:52:56 +02:00
Jonas Jenwald
1f7581b5c6 Shorten the PDFDocument.prototype.fieldObjects getter slightly
The effect is probably not even measurable, however this patch ever so slightly reduces the asynchronicity in the `fieldObjects` getter. These changes should be safe since:

 - We're inside of the `PDFDocument`-class and the `annotationGlobals`-getter, which will always return a (shadowed) Promise and won't throw `MissingDataException`s, can be accessed directly without going through the `BasePdfManager`-instance.

 - The `acroForm`-dictionary can be accessed through the `annotationGlobals`-data, removing the need to "manually" look it up and thus the need for using `Promise.all` here.

 - We can also lookup the /Fields-data, in the `acroForm`-dictionary, synchronously since the initial `formInfo.hasFields` check guarantees that it's available.
2025-05-07 17:47:09 +02:00
Jonas Jenwald
36fafbc05c Use object destructuring a bit more in the src/core/document.js file 2025-05-07 13:41:50 +02:00
Jonas Jenwald
92b065c87e Replace a number of semi-private fields with actual private ones in src/core/document.js
These are fields that can be moved out of their class constructors, and be initialized directly.
2025-05-07 13:41:44 +02:00
Jonas Jenwald
39803a9f25 Replace a number of semi-private methods with actual private ones in src/core/document.js
There's a few remaining cases that are used with either cached getters or `BasePdfManager.prototype.ensure`-methods, and those cannot be converted.
2025-05-07 13:41:36 +02:00
Jonas Jenwald
0ded85e9b3 Add a Page helper method to create a PartialEvaluator-instance
Currently we repeat the same identical code five times in the `Page`-class when creating a `PartialEvaluator`-instance, which given the number of parameters it needs seems like unnecessary duplication.
2025-05-07 13:41:29 +02:00
Jonas Jenwald
6f052312d6
Merge pull request #19895 from Snuffleupagus/ObjectLoader-improve
Unify method return values in the `ObjectLoader` class, and simplify how the `ObjectLoader` is used
2025-05-06 21:18:09 +02:00
Jonas Jenwald
384a09113c Run CI tests in Node.js version 24
Node.js version 24 was just released, see https://github.com/nodejs/release#release-schedule, hence we should run tests in that version in order to help catch any possible issues as soon as possible.
Also, since version 23 will reach EOL (end-of-life) in less than a month we stop running tests in that version.
2025-05-06 18:43:02 +02:00
Jonas Jenwald
62009ffa70 Simplify how the ObjectLoader is used
The `ObjectLoader.prototype.load` method has a fast-path, which avoids any lookup/parsing if the entire PDF document is already loaded.
However, we still need to create an `ObjectLoader`-instance which seems unnecessary in that case.

Hence we introduce a *static* `ObjectLoader.load` method, which will help avoid creating `ObjectLoader`-instances needlessly and also (slightly) shortens the call-sites.
To ensure that the new method will be used, we extend the `no-restricted-syntax` ESLint rule to "forbid" direct usage of `new ObjectLoader()`.
2025-05-06 15:49:59 +02:00
Jonas Jenwald
ef1ad675c2 Unify method return values in the ObjectLoader class
Given that all the methods are already asynchronous we can just use `await` more throughout this code, rather than having to explicitly return function-calls and `undefined`.
Note also how none of the `ObjectLoader.prototype.load` call-sites use the return value.
2025-05-06 15:43:00 +02:00
calixteman
04400c588f
Merge pull request #19893 from calixteman/issue19517
Downscale jpeg2000 images, if needed, while decoding them
2025-05-05 22:53:49 +02:00
Calixte Denizet
ac925f4f1b Downscale jpeg2000 images, if needed, while decoding them
It fixes #19517.
2025-05-05 22:39:59 +02:00
Tim van der Meij
06f44916c8
Merge pull request #19889 from Snuffleupagus/loadXfaResources
Slightly re-factor how we pre-load fonts and images in XFA documents
2025-05-04 14:28:11 +02:00
Jonas Jenwald
d9548b1c18 Slightly re-factor how we pre-load fonts and images in XFA documents
Rather than "manually" invoking the methods from the `src/core/worker.js` file we introduce a single `PDFDocument`-method that handles this for us, and make the current methods private.
Since this code is only invoked at most *once* per document, and only for XFA documents, we can use `BasePdfManager.prototype.ensureDoc` directly rather than needing a stand-alone method.
2025-05-04 13:44:33 +02:00
Jonas Jenwald
604153957a Reduce duplication when parsing fonts in loadXfaFonts
Currently we repeat virtually the same code when calling the `PartialEvaluator.prototype.handleSetFont` method, which we can avoid by introducing an inline helper function.
2025-05-04 13:42:17 +02:00
Jonas Jenwald
2979e23f3c Ensure that XFAFactory.prototype.isValid returns a boolean value
Considering the name of the method, and how it's actually being used, you'd expect it to return a boolean value.
Given how it's currently being used this inconsistency doesn't cause any issues, however we should still fix this.
2025-05-04 13:42:17 +02:00
Tim van der Meij
5ca57fbd4b
Merge pull request #19885 from Snuffleupagus/loadXfaImages-simplify
Simplify the `loadXfaImages` method and related code
2025-05-04 13:41:06 +02:00
Tim van der Meij
22cb3080ee
Merge pull request #19887 from Snuffleupagus/serializeXfaData-simplify
Simplify the `serializeXfaData` method and related code
2025-05-04 13:38:01 +02:00
Tim van der Meij
bd81d390c7
Merge pull request #19888 from Snuffleupagus/rm-BasePdfManager-catalog-getter
Remove the `BasePdfManager.prototype.catalog` getter
2025-05-04 13:33:16 +02:00
Jonas Jenwald
b3e16800f5 Remove the BasePdfManager.prototype.catalog getter
This is only invoked *once* and it can be trivially replaced by the `ensureCatalog`-method, since the code where it's used is already asynchronous.
2025-05-03 13:40:23 +02:00
Jonas Jenwald
b531720d9c Simplify the serializeXfaData method and related code
Rather than having a dedicated `BasePdfManager`-method for this one call-site we can instead change `PDFDocument.prototype.serializeXfaData` to a non-async method, that we invoke via `BasePdfManager.prototype.ensureDoc`.
2025-05-03 11:20:42 +02:00
Jonas Jenwald
122822a750 Simplify the loadXfaImages method and related code
Currently we create an intermediate `Dict` during parsing, however that seems unnecessary since (note especially the second point):
 - The `NameOrNumberTree.prototype.getAll` method will already resolve any references, as needed, during parsing.
 - The `Catalog.prototype.xfaImages` getter is invoked, via the `BasePdfManager`-instance, such that any `MissingDataException`s are already handled correctly.
2025-05-02 11:53:41 +02:00
calixteman
91bfe12f38
Merge pull request #19883 from gpanakkal/checkbutton-tostyle
Fix arguments in `toStyle` call in `CheckButton`
2025-05-01 22:08:03 +02:00
Gautam Panakkal
7bba3bd4ad Add missing this arg to toStyle in CheckButton.prototype.[$toHTML] 2025-05-01 10:19:28 -07:00
Jonas Jenwald
fc92e4059a
Merge pull request #19884 from Snuffleupagus/issue-19835-2
Allow to, optionally, keep Unicode escape sequences in  `stringToPDFString` (PR 17331 follow-up)
2025-05-01 11:39:13 +02:00
Jonas Jenwald
b629bafd1c Allow to, optionally, keep Unicode escape sequences in stringToPDFString (PR 17331 follow-up)
Currently *some* of the links[1] on page three of the `issue19835.pdf` test-case aren't clickable, since the destination (of the LinkAnnotation) becomes empty.
The reason is that these destinations include the character `\x1b`, which is interpreted as the start of a Unicode escape sequence specifying the language of the string; please refer to section [7.9.2.2 Text String Type](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#G6.1957385) in the PDF specification.

Hence it seems that we need a way to optionally disable that behaviour, to avoid a "badly" formatted string from becoming empty (or truncated), at least for cases where we are:
 - Parsing named destinations[2] and URLs.
 - Handling "strings" that are actually /Name-instances.
 - Building a lookup Object/Map based on some PDF data-structure.

*NOTE:* The issue that prompted this patch is obviously related to destinations, however I've gone through the `src/core/` folder and updated various other `stringToPDFString` call-sites that (directly or indirectly) fit the categories listed above.

---
[1] Try clicking on anything on the line containing "Item 7A. Quantitative and Qualitative Disclosures About Market Risk 27".

[2] Unfortunately just skipping `stringToPDFString` in this case would cause other issues, such as the named destination becoming "unusable" in the viewer; see e.g. issues 14847 and 14864.
2025-04-30 20:51:10 +02:00
Jonas Jenwald
254431df1e Avoid extra lookup/parsing when all destinations are already available
Whenever we cannot find a destination we'll fallback to checking all destinations, to account for e.g. out-of-order NameTrees, and in those cases any subsequent destination-lookups can be made a tiny bit more efficient by immediately checking the already cached destinations.
2025-04-30 15:26:00 +02:00
calixteman
b8de9a372f
Merge pull request #19856 from calixteman/bug1936605
Don't update the visible canvas at 60 fps (bug 1936605)
2025-04-29 22:31:02 +02:00
Jonas Jenwald
0922aa9e9d
Merge pull request #19880 from Snuffleupagus/numberToString-assert-number
Assert that `numberToString` is called with a number (issue 19877)
2025-04-29 20:35:32 +02:00
calixteman
262a1f9895
Merge pull request #19881 from calixteman/bug1963407
Fix the bbox when saving a rotated text field (bug 1963407)
2025-04-29 20:33:53 +02:00
Jonas Jenwald
f5faf86180 Assert that numberToString is called with a number (issue 19877)
*NOTE:* Given that this is an *internal* function, used only in the worker-thread, it's not clear to me that this is an entirely "necessary" change.
2025-04-29 20:31:24 +02:00
Calixte Denizet
7a251b206e Fix the bbox when saving a rotated text field (bug 1963407) 2025-04-29 18:49:07 +02:00
Calixte Denizet
ecc56a61e6 Don't update the visible canvas at 60 fps (bug 1936605)
Instead, we update the visible canvas every 500ms.
With large canvas, updating at 60fps lead to a lot gfx transactions and it can take a lot of time.
For example, with wuppertal_2012.pdf on Windows, displaying it at 150% takes around 14 min !!! without
this patch when it takes only around 14 sec with. Even at 30% it helps to improve the performance
by around 20%.
2025-04-29 18:35:21 +02:00
Jonas Jenwald
c1a398d932
Merge pull request #19876 from Snuffleupagus/Node-polyfill-navigator
Add a basic `navigator` polyfill for older Node.js versions
2025-04-29 10:04:19 +02:00
calixteman
2e10ff6dd4
Merge pull request #19855 from 1Jesper1/hotfix/useractivation-response
Add useractivation check for response function
2025-04-28 13:14:51 +02:00
Jonas Jenwald
3d4e8bb17e Add a basic navigator polyfill for older Node.js versions
Modern Node.js versions now include a `navigator` implementation, with a few basic properties, that's actually enough for the PDF.js use-cases; please see https://nodejs.org/api/globals.html#navigator
Unfortunately we still support Node.js version `20`, hence we add a basic polyfill since that allows simplifying the code slightly.
2025-04-28 13:07:12 +02:00
Tim van der Meij
b47b248e15
Merge pull request #19875 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2025-04-27 14:53:05 +02:00
Tim van der Meij
6d0e8d752d
Bump the stable version in pdfjs.config 2025-04-27 14:49:27 +02:00
Jesper
8af06a4c60 Add useractivation check for response function 2025-04-24 22:40:28 +02:00
975 changed files with 700027 additions and 33089 deletions

View File

@ -8,8 +8,6 @@ The issue tracking system is designed to record a single technical problem. A bu
If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem. If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.
Note that the translations for PDF.js in the `l10n` folder are imported from the Nightly channel of Mozilla Firefox, such that we don't have to maintain them ourselves. This means that we will not accept pull requests that add new languages and/or modify existing translations, unless the corresponding changes have been made in Mozilla Firefox first.
See also: See also:
- https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions - https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions
- https://github.com/mozilla/pdf.js/wiki/Contributing - https://github.com/mozilla/pdf.js/wiki/Contributing

View File

@ -6,3 +6,5 @@ updates:
interval: "weekly" interval: "weekly"
labels: labels:
- "dependencies" - "dependencies"
cooldown:
default-days: 7

1
.github/font_tests_requirements.txt vendored Normal file
View File

@ -0,0 +1 @@
fonttools==4.*

View File

@ -7,28 +7,59 @@ jobs:
test: test:
name: Test name: Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: code-coverage
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: [20, 22, 23] node-version: [22, 24, 26]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Restore cached PDF files
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
restore-keys: |
cached-pdf-files-
enableCrossOsArchive: true
- name: Run external tests - name: Run external tests
run: npx gulp externaltest run: npx gulp externaltest
- name: Run CLI unit tests - name: Run CLI unit tests with code coverage
run: npx gulp unittestcli run: npx gulp unittestcli --coverage --coverage-output build/coverage/unitcli
- name: Save cached PDF files
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
enableCrossOsArchive: true
- name: Upload results to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/coverage/unitcli/lcov.info
flags: unittestcli
name: codecov-umbrella
disable_search: true
disable_telem: true
verbose: true

View File

@ -18,18 +18,19 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
queries: security-and-quality queries: security-and-quality
- name: Autobuild CodeQL - name: Autobuild CodeQL
uses: github/codeql-action/autobuild@v3 uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
- name: Perform CodeQL analysis - name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2

View File

@ -0,0 +1,99 @@
name: Coverage (Browser tests)
on:
push:
paths:
- 'gulpfile.mjs'
- 'external/**'
- 'src/**'
- 'test/images/**'
- 'test/pdfs/**'
- 'test/resources/**'
- 'test/*.css'
- 'test/driver.js'
- 'test/test.mjs'
- 'test/test_manifest.json'
- 'test/test_slave.html'
- 'web/**'
- '.github/workflows/coverage_browser_tests.yml'
branches:
- master
pull_request:
paths:
- 'gulpfile.mjs'
- 'external/**'
- 'src/**'
- 'test/images/**'
- 'test/pdfs/**'
- 'test/resources/**'
- 'test/*.css'
- 'test/driver.js'
- 'test/test.mjs'
- 'test/test_manifest.json'
- 'test/test_slave.html'
- 'web/**'
- '.github/workflows/coverage_browser_tests.yml'
branches:
- master
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: ${{ matrix.os }} / firefox
strategy:
fail-fast: false
matrix:
node-version: [lts/*]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
environment: code-coverage
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Restore cached PDF files
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
restore-keys: |
cached-pdf-files-
enableCrossOsArchive: true
- name: Run browser tests with code coverage
run: npx gulp botbrowsertest --headless -j$(nproc) --coverage --coverage-output build/coverage/browser --noChrome
- name: Save cached PDF files
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
enableCrossOsArchive: true
- name: Upload results to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/coverage/browser/lcov.info
flags: browsertest
name: codecov-umbrella
disable_search: true
disable_telem: true
verbose: true

View File

@ -25,18 +25,19 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Use Python 3.13
uses: actions/setup-python@v5
with: with:
python-version: '3.13' persist-credentials: false
cache: 'pip'
- name: Install Fluent dependencies - name: Use Python 3.14
run: | uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
pip install -r .github/requirements.txt with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: '.github/fluent_linter_requirements.txt'
- name: Install requirements
run: pip install -r .github/fluent_linter_requirements.txt
- name: Lint Fluent reference files - name: Lint Fluent reference files
run: | run: moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml
moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml

View File

@ -3,6 +3,7 @@ on:
push: push:
paths: paths:
- 'gulpfile.mjs' - 'gulpfile.mjs'
- 'external/**'
- 'src/**' - 'src/**'
- 'test/test.mjs' - 'test/test.mjs'
- 'test/font/**' - 'test/font/**'
@ -12,6 +13,7 @@ on:
pull_request: pull_request:
paths: paths:
- 'gulpfile.mjs' - 'gulpfile.mjs'
- 'external/**'
- 'src/**' - 'src/**'
- 'test/test.mjs' - 'test/test.mjs'
- 'test/font/**' - 'test/font/**'
@ -24,38 +26,60 @@ permissions:
jobs: jobs:
test: test:
name: Test name: ${{ matrix.os }} / ${{ matrix.browser }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: [lts/*] node-version: [lts/*]
os: [windows-latest, ubuntu-latest] os: [windows-latest, ubuntu-latest]
browser: [firefox, chrome]
include:
- browser: firefox
skip: --noChrome
- browser: chrome
skip: --noFirefox
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
environment: code-coverage
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Use Python 3.13 - name: Use Python 3.14
uses: actions/setup-python@v5 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.0.2
with: with:
python-version: '3.13' python-version: '3.14'
cache: 'pip' cache: 'pip'
cache-dependency-path: '.github/font_tests_requirements.txt'
- name: Install Fonttools - name: Install requirements
run: pip install fonttools run: pip install -r .github/font_tests_requirements.txt
- name: Run font tests - name: Run font tests with code coverage
run: npx gulp fonttest --headless run: npx gulp fonttest --headless --coverage --coverage-output build/coverage/font ${{ matrix.skip }}
- name: Upload results to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/coverage/font/lcov.info
flags: fonttest
name: codecov-umbrella
disable_search: true
disable_telem: true
verbose: true

106
.github/workflows/integration_tests.yml vendored Normal file
View File

@ -0,0 +1,106 @@
name: Integration tests
on:
push:
paths:
- 'gulpfile.mjs'
- 'external/**'
- 'src/**'
- 'test/test.mjs'
- 'test/integration/**'
- 'web/**'
- '.github/workflows/integration_tests.yml'
branches:
- master
pull_request:
paths:
- 'gulpfile.mjs'
- 'external/**'
- 'src/**'
- 'test/test.mjs'
- 'test/integration/**'
- 'web/**'
- '.github/workflows/integration_tests.yml'
branches:
- master
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: ${{ matrix.os }} / ${{ matrix.browser }}
strategy:
fail-fast: false
matrix:
node-version: [lts/*]
os: [windows-latest, ubuntu-latest]
browser: [firefox, chrome]
include:
- browser: firefox
skip: --noChrome
- browser: chrome
skip: --noFirefox
runs-on: ${{ matrix.os }}
environment: code-coverage
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Restore cached PDF files
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
restore-keys: |
cached-pdf-files-
enableCrossOsArchive: true
# Note that the integration tests can't run in headless mode until bug
# 1878643 (tracked in #20918), and possibly others, have been fixed
# upstream, so we can't run with the `--headless` flag and thus have to
# configure a standard resolution for the headful browser windows.
- name: Update resolution (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Run integration tests with code coverage (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: npx gulp integrationtest --coverage --coverage-output build/coverage/integration ${{ matrix.skip }}
- name: Run integration tests with code coverage (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: xvfb-run -a --server-args="-screen 0, 1920x1080x24" npx gulp integrationtest --coverage --coverage-output build/coverage/integration ${{ matrix.skip }}
- name: Save cached PDF files
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
enableCrossOsArchive: true
- name: Upload results to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/coverage/integration/lcov.info
flags: integrationtest
name: codecov-umbrella
disable_search: true
disable_telem: true
verbose: true

View File

@ -15,14 +15,16 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@ -30,5 +32,5 @@ jobs:
- name: Run lint - name: Run lint
run: npx gulp lint run: npx gulp lint
- name: Run lint-chromium - name: Run lint-mozcentral
run: npx gulp lint-chromium run: npx gulp lint-mozcentral

77
.github/workflows/notify-pdf-sync.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: Notify PDF sync
on:
push:
branches: [master]
paths:
- "test/pdfs/*.pdf"
- "test/pdfs/*.pdf.link"
permissions:
contents: read
jobs:
notify:
runs-on: ubuntu-latest
environment: sync_pdfs
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 1
persist-credentials: false
- name: Check for added PDF files
id: check
run: |
git fetch --no-tags --depth=1 origin ${{ github.event.before }}
mapfile -t added < <(
git diff --diff-filter=A --name-only \
${{ github.event.before }} \
${{ github.sha }} \
-- \
':(glob)test/pdfs/*.pdf' \
':(glob)test/pdfs/*.pdf.link'
)
if [ "${#added[@]}" -gt 0 ]; then
echo "has_added=true" >> "$GITHUB_OUTPUT"
printf 'files_json=%s\n' "$(printf '%s\n' "${added[@]}" | jq -Rsc 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"
else
echo "has_added=false" >> "$GITHUB_OUTPUT"
echo 'files_json=[]' >> "$GITHUB_OUTPUT"
fi
- name: Generate app token
if: steps.check.outputs.has_added == 'true'
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: mozilla
repositories: pdf.js.pdfs
- name: Trigger sync
if: steps.check.outputs.has_added == 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
FILES_JSON: ${{ steps.check.outputs.files_json }}
run: |
payload=$(jq -nc \
--arg before "${{ github.event.before }}" \
--arg after "${{ github.sha }}" \
--argjson files "$FILES_JSON" \
'{
event_type: "pdf-added",
client_payload: {
before: $before,
after: $after,
files: $files
}
}')
gh api repos/mozilla/pdf.js.pdfs/dispatches \
--method POST \
--input - <<< "$payload"

33
.github/workflows/prefs_tests.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Prefs tests
on: [push, pull_request]
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [lts/*]
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run prefs tests
run: npx gulp prefstest

View File

@ -17,14 +17,16 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- name: Install dependencies - name: Install dependencies
@ -34,6 +36,4 @@ jobs:
run: npx gulp dist run: npx gulp dist
- name: Publish the `pdfjs-dist` library to NPM - name: Publish the `pdfjs-dist` library to NPM
run: npm publish ./build/dist --provenance run: npm publish ./build/dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -17,14 +17,16 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@ -49,7 +51,7 @@ jobs:
INPUT_PATH: build/gh-pages INPUT_PATH: build/gh-pages
- name: Upload the website - name: Upload the website
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: github-pages name: github-pages
path: ${{ runner.temp }}/website.tar path: ${{ runner.temp }}/website.tar
@ -66,4 +68,4 @@ jobs:
steps: steps:
- name: Deploy the website - name: Deploy the website
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

View File

@ -15,14 +15,16 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

93
.github/workflows/unit_tests.yml vendored Normal file
View File

@ -0,0 +1,93 @@
name: Unit tests
on:
push:
paths:
- 'gulpfile.mjs'
- 'external/**'
- 'src/**'
- 'test/test.mjs'
- 'test/unit/**'
- 'web/**'
- '.github/workflows/unit_tests.yml'
branches:
- master
pull_request:
paths:
- 'gulpfile.mjs'
- 'external/**'
- 'src/**'
- 'test/test.mjs'
- 'test/unit/**'
- 'web/**'
- '.github/workflows/unit_tests.yml'
branches:
- master
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: ${{ matrix.os }} / ${{ matrix.browser }}
strategy:
fail-fast: false
matrix:
node-version: [lts/*]
os: [windows-latest, ubuntu-latest]
browser: [firefox, chrome]
include:
- browser: firefox
skip: --noChrome
- browser: chrome
skip: --noFirefox
runs-on: ${{ matrix.os }}
environment: code-coverage
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Restore cached PDF files
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
restore-keys: |
cached-pdf-files-
enableCrossOsArchive: true
- name: Run unit tests with code coverage
run: npx gulp unittest --headless --coverage --coverage-output build/coverage/unit ${{ matrix.skip }}
- name: Save cached PDF files
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test/pdfs/*.pdf
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
enableCrossOsArchive: true
- name: Upload results to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/coverage/unit/lcov.info
flags: unittest
name: codecov-umbrella
disable_search: true
disable_telem: true
verbose: true

61
.github/workflows/update_locales.yml vendored Normal file
View File

@ -0,0 +1,61 @@
name: Update locales
on:
schedule:
- cron: "0 0 * * 5" # Every Friday at midnight UTC
workflow_dispatch: # Allow manual triggering
permissions:
contents: read
jobs:
update-locales:
name: Update locales
runs-on: ubuntu-latest
environment: sync_l10n
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
- name: Use Node.js LTS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Import translations from mozilla-central
run: npx gulp importl10n
- name: Create Pull Request
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
if [ -z "$(git status --porcelain l10n/)" ]; then
echo "No locale changes to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}"
git switch -C update-locales
git add l10n/
git commit -m "l10n: Update locale files"
git push --force origin update-locales
gh pr create \
--title "l10n: Update locale files" \
--body "Automated weekly update of locale files from mozilla-central." \
--label l10n || true

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ Makefile
node_modules/ node_modules/
examples/node/svgdump/ examples/node/svgdump/
examples/node/pdf2png/*.png examples/node/pdf2png/*.png
.vscode/

9
.mcp.json Normal file
View File

@ -0,0 +1,9 @@
{
"mcpServers": {
"firefox-devtools": {
"type": "stdio",
"command": "npx",
"args": ["@padenot/firefox-devtools-mcp"]
}
}
}

View File

@ -13,3 +13,6 @@ test/tmp/
test/pdfs/ test/pdfs/
web/locale/ web/locale/
*~/ *~/
.claude/
.codex/
.cursor/

View File

@ -9,10 +9,17 @@
"overrides": [ "overrides": [
{ {
files: ["tsconfig.json"], "files": ["tsconfig.json", ".prettierrc"],
options: { "options": {
parser: "json", "parser": "json"
}, }
}, },
{
"files": ["**/*.html"],
"options": {
"parser": "html",
"printWidth": 160
}
}
] ]
} }

View File

@ -1,9 +0,0 @@
{
"chrome": {
"skipDownload": false
},
"firefox": {
"skipDownload": false,
"version": "nightly"
}
}

13
.puppeteerrc.json Normal file
View File

@ -0,0 +1,13 @@
{
"chrome": {
"skipDownload": true,
"version": "stable"
},
"chrome-headless-shell": {
"skipDownload": true
},
"firefox": {
"skipDownload": true,
"version": "nightly"
}
}

View File

@ -13,13 +13,10 @@
"color-no-invalid-hex": true, "color-no-invalid-hex": true,
"declaration-block-no-duplicate-properties": true, "declaration-block-no-duplicate-properties": true,
"declaration-block-no-redundant-longhand-properties": true, "declaration-block-no-redundant-longhand-properties": true,
"declaration-property-value-disallowed-list": {
"float": ["inline-start", "inline-end"]
},
"length-zero-no-unit": [true, { "length-zero-no-unit": [true, {
ignore: ["custom-properties"] "ignore": ["custom-properties"]
}], }],
"selector-pseudo-element-colon-notation": "double", "selector-pseudo-element-colon-notation": "double",
"shorthand-property-no-redundant-values": true, "shorthand-property-no-redundant-values": true
}, }
} }

204
AGENTS.md Normal file
View File

@ -0,0 +1,204 @@
## Overview
PDF.js is a Portable Document Format (PDF) viewer built with JavaScript, HTML5 Canvas, and CSS. It's a Mozilla project that provides a general-purpose, web standards-based platform for parsing and rendering PDFs without requiring native code or plugins.
## Common Commands
### Development Server
```bash
npx gulp server
```
Then open http://localhost:8888/web/viewer.html to view the PDF viewer. Test PDFs are available at http://localhost:8888/test/pdfs/?frame
### Building
Build for modern browsers:
```bash
npx gulp generic
```
This generates `pdf.js` and `pdf.worker.js` in `build/generic/build/`.
Build for distribution (creates pdfjs-dist package):
```bash
npx gulp dist
npx gulp dist-install # Build and install locally
```
### Testing
Run all tests:
```bash
npx gulp test
```
Run unit tests only:
```bash
npx gulp unittest
```
Run integration tests (browser-based tests using Puppeteer):
```bash
npx gulp integrationtest
```
Run font tests:
```bash
npx gulp fonttest
```
Run a single test file by modifying test/test_manifest.json or using test runner options.
### Linting and Formatting
Lint JavaScript:
```bash
npx gulp lint
```
Format code (uses Prettier and ESLint):
```bash
npx eslint --fix <file>
```
### Type Checking
Run TypeScript type checking:
```bash
npx gulp typestest
```
## Architecture
### High-Level Structure
PDF.js has a multi-layer architecture that separates concerns between PDF parsing, rendering, and UI:
#### 1. Core Layer (`src/core/`)
The core layer handles PDF parsing and interpretation. Key responsibilities:
- **PDF parsing**: Parsing PDF structure, cross-reference tables, streams
- **Font handling**: CFF, TrueType, Type1 font parsing and conversion (`font.js`, `fonts.js`, `cff_*.js`, `type1_*.js`)
- **Image decoding**: JPEG, JBIG2, JPX/JPEG2000 decoders
- **Operators**: Processing PDF drawing operators (`operator_list.js`, `evaluator.js`)
- **XFA Forms**: XML Forms Architecture support (`src/core/xfa/`)
- **Color spaces**: ICC profiles, device color spaces (`colorspace.js`, `icc_colorspace.js`)
- Runs in a Web Worker for performance isolation
Entry point: `src/pdf.worker.js`
#### 2. Display Layer (`src/display/`)
The display layer provides the API for rendering PDFs to canvas and managing documents. Key components:
- **API**: Main public API (`api.js`) - `PDFDocumentProxy`, `PDFPageProxy`, `getDocument()`
- **Canvas rendering**: Renders PDF operations to HTML5 canvas (`canvas.js`)
- **Text layer**: Extracts and positions text for selection/search (`text_layer.js`)
- **Annotation layer**: Renders and handles PDF annotations (`annotation_layer.js`)
- **Editor layer**: Supports PDF editing (annotations, highlights, stamps) (`editor/`)
- **Metadata**: Parses XMP metadata (`metadata.js`)
- **Streams**: Handles PDF data fetching (fetch, network, node) (`fetch_stream.js`, `network.js`, `node_stream.js`)
Entry point: `src/pdf.js`
#### 3. Scripting Layer (`src/scripting_api/`)
Implements JavaScript execution for interactive PDFs (form calculations, validations, button actions).
- Sandboxed execution environment
- Implements Acrobat JavaScript API objects (App, Doc, Field, etc.)
Entry points: `src/pdf.scripting.js`, `src/pdf.sandbox.js`
#### 4. Web Viewer (`web/`)
The complete PDF viewer application with UI. Key components:
- **Main app**: Application orchestration (`app.js`)
- **Viewer**: Page rendering and layout (`pdf_viewer.js`, `pdf_page_view.js`)
- **Toolbar**: Zoom, page navigation, print, download controls
- **Sidebar**: Thumbnails, outlines, attachments (`pdf_sidebar.js`, `pdf_thumbnail_view.js`, `pdf_outline_viewer.js`)
- **Find controller**: Text search functionality (`pdf_find_controller.js`)
- **Annotation editors**: UI for creating/editing annotations (`annotation_editor_layer_builder.js`)
- **Presentation mode**: Full-screen presentation (`pdf_presentation_mode.js`)
Entry point: `web/viewer.html` + `web/viewer.mjs`
#### 5. Shared Utilities (`src/shared/`)
Common utilities used across layers:
- **Message handling**: Worker communication (`message_handler.js`)
- **Utilities**: Common functions and constants (`util.js`)
- **Image utilities**: Image processing helpers (`image_utils.js`)
### Worker Communication
PDF.js uses a Web Worker architecture:
- Main thread (`display` layer) communicates with worker thread (`core` layer) via `MessageHandler`
- Keeps PDF parsing off the main thread for better performance
- Messages include: page rendering requests, text content extraction, metadata queries
### Build System
- Uses **Gulp** for build orchestration (`gulpfile.mjs`)
- **Webpack** bundles modules into browser-compatible formats
- **Babel** transpiles for browser compatibility (configurable targets in gulpfile)
- Preprocessor replaces build-time constants (e.g., `typeof PDFJSDev !== "undefined"` checks)
- Multiple build targets: generic, components, minified, legacy (older browser support)
### External Dependencies
Located in `external/`:
- **bcmaps**: Binary CMaps for CJK fonts
- **standard_fonts**: Core 14 PDF fonts metrics
- **cmapscompress**: Tools for compressing CMaps
- **openjpeg**: JPEG2000 decoder (WASM)
- **quickjs**: JavaScript engine for sandboxed execution
### Translations
Translations in `l10n/` are imported from Mozilla Firefox Nightly. Only the file l10n/en-US/viewer.ftl can be updated.
## Development Notes
### Adding New Features
When adding features that span multiple layers:
1. Start with the `core` layer if parsing/interpretation changes are needed
2. Update the `display` layer API if new capabilities need exposure
3. Modify the `web` viewer if UI changes are required
4. Ensure worker communication handles new message types
### Preprocessor Directives
Code uses preprocessor checks for build-time conditionals:
```javascript
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC")) {
// Generic build-specific code
}
```
Common flags: `GENERIC`, `MOZCENTRAL`, `CHROME`, `MINIFIED`, `TESTING`, `LIB`, `SKIP_BABEL`, `IMAGE_DECODERS`
### Testing
- Unit tests use Jasmine framework (`test/unit/`)
- Integration tests use Puppeteer for browser automation (`test/integration/`)
- Test PDFs downloaded from manifest (`test/test_manifest.json`)
- Reference images for visual regression testing (`test/ref/`)
### Code Style
- Uses ESLint with custom configuration (`eslint.config.mjs`)
- Prettier for formatting
- Stylelint for CSS
- No semicolons required (ASI enabled)
- Single quotes for strings
### Pull Request Process
- Keep PRs focused on a single issue
- Provide a test PDF if the issue is PDF-specific
- Ensure tests pass (`npx gulp test`)
- Run linting (`npx gulp lint`)
- Follow existing code patterns
- Don't modify translations directly (they come from Firefox)
### Performance Considerations
- Core parsing runs in a Web Worker - keep main thread work minimal
- Canvas rendering can be expensive - use appropriate scale factors
- Text layer generation is separate from rendering - can be deferred
- Annotation layer is optional - only enable when needed

1
CLAUDE.md Normal file
View File

@ -0,0 +1 @@
@AGENTS.md

View File

@ -1,4 +1,4 @@
# PDF.js [![CI](https://github.com/mozilla/pdf.js/actions/workflows/ci.yml/badge.svg?query=branch%3Amaster)](https://github.com/mozilla/pdf.js/actions/workflows/ci.yml?query=branch%3Amaster) # PDF.js [![CI](https://github.com/mozilla/pdf.js/actions/workflows/ci.yml/badge.svg?query=branch%3Amaster)](https://github.com/mozilla/pdf.js/actions/workflows/ci.yml?query=branch%3Amaster) [![codecov](https://codecov.io/gh/mozilla/pdf.js/branch/master/graph/badge.svg)](https://codecov.io/gh/mozilla/pdf.js)
[PDF.js](https://mozilla.github.io/pdf.js/) is a Portable Document Format (PDF) viewer that is built with HTML5. [PDF.js](https://mozilla.github.io/pdf.js/) is a Portable Document Format (PDF) viewer that is built with HTML5.
@ -44,6 +44,10 @@ PDF.js is built into version 19+ of Firefox.
Chrome, go to `Tools > Extension` and load the (unpackaged) extension from the Chrome, go to `Tools > Extension` and load the (unpackaged) extension from the
directory `build/chromium`. directory `build/chromium`.
### PDF debugger
Browse the internal structure of a PDF document with https://mozilla.github.io/pdf.js/internal-viewer/web/debugger.html
## Getting the Code ## Getting the Code
To get a local copy of the current code, clone it using git: To get a local copy of the current code, clone it using git:
@ -87,6 +91,71 @@ This will generate `pdf.js` and `pdf.worker.js` in the `build/generic/build/` di
Both scripts are needed but only `pdf.js` needs to be included since `pdf.worker.js` will Both scripts are needed but only `pdf.js` needs to be included since `pdf.worker.js` will
be loaded by `pdf.js`. The PDF.js files are large and should be minified for production. be loaded by `pdf.js`. The PDF.js files are large and should be minified for production.
## Code coverage
We track how much of the code is exercised by the test suite on
[Codecov](https://codecov.io/gh/mozilla/pdf.js) (see the badge at the top of this
file).
### How it is collected
When coverage is enabled, the build instruments the bundled code with
[`babel-plugin-istanbul`](https://github.com/istanbuljs/babel-plugin-istanbul),
which adds counters that record every line, branch and function that runs:
+ For browser-based tests (unit, integration and reference tests) the
instrumented code runs in the browser, fills a global `window.__coverage__`
object, and the test runner collects it from each browser session, merges the
results, and writes the report.
+ For the Node-based unit tests (`unittestcli`) the raw data is written to
`build/tmp/unittestcli-coverage.json` and turned into a report afterwards.
### Collecting coverage locally
Add the `--coverage` flag to any of the test tasks, for example:
$ npx gulp unittest --coverage # browser unit tests
$ npx gulp unittestcli --coverage # Node unit tests
$ npx gulp integrationtest --coverage # Puppeteer integration tests
$ npx gulp botbrowsertest --coverage # reference tests
The following options control the output:
| Option | Description | Default |
| --- | --- | --- |
| `--coverage` | Enable coverage collection. | off |
| `--coverage-output <dir>` | Directory where the report is written. | `build/coverage` |
| `--coverage-formats <list>` | Comma-separated list of formats: `info`, `html`, `json`, `text`, `cobertura`, `clover`. | `info` |
| `--coverage-per-test` | Also build a per-test index (see below). | off |
By default the report is written to `build/coverage` in the `info` format, i.e.
an [LCOV](https://github.com/linux-test-project/lcov) `lcov.info` file (the same
format that is uploaded to Codecov). Use `--coverage-formats html` to get a
browsable HTML report instead, or pass several formats at once, e.g.
`--coverage-formats info,html`.
### Finding which tests cover a given line
Run a browser test task with `--coverage-per-test` to build an index
(`per-test-index.json`) in the coverage directory, then query it to list the
tests that exercised a specific source line or function:
$ npx gulp botbrowsertest --coverage-per-test
$ npx gulp coverage_search --code="canvas.js::205"
$ npx gulp coverage_search --code="canvas.js::drawImageAtIntegerCoords"
### Continuous integration
On every push and pull request three GitHub Actions workflows collect coverage
and upload it to Codecov, each tagged with its own Codecov *flag* so the test
types can be told apart:
| Workflow | Task | Codecov flag |
| --- | --- | --- |
| `unit_tests.yml` | `unittest` | `unittest` |
| `integration_tests.yml` | `integrationtest` | `integrationtest` |
| `coverage_browser_tests.yml` | `botbrowsertest` | `browsertest` |
## Using PDF.js in a web application ## Using PDF.js in a web application
To use PDF.js in a web application you can choose to use a pre-built version of the library To use PDF.js in a web application you can choose to use a pre-built version of the library

3
codecov.yml Normal file
View File

@ -0,0 +1,3 @@
flag_management:
default_rules:
carryforward: true

View File

@ -18,13 +18,13 @@ This tutorial shows how PDF.js can be used as a library in a web browser.
The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document: The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document:
```js ```js
pdfjsLib.getDocument('helloworld.pdf') pdfjsLib.getDocument({ url: "helloworld.pdf" })
``` ```
Remember though that PDF.js uses promises, and the above will return a `PDFDocumentLoadingTask` instance that has a `promise` property which is resolved with the document object. Remember though that PDF.js uses promises, and the above will return a `PDFDocumentLoadingTask` instance that has a `promise` property which is resolved with the document object.
```js ```js
var loadingTask = pdfjsLib.getDocument('helloworld.pdf'); var loadingTask = pdfjsLib.getDocument({ url: "helloworld.pdf" });
loadingTask.promise.then(function(pdf) { loadingTask.promise.then(function(pdf) {
// you can now use *pdf* here // you can now use *pdf* here
}); });
@ -48,8 +48,8 @@ var viewport = page.getViewport({ scale: scale, });
// Support HiDPI-screens. // Support HiDPI-screens.
var outputScale = window.devicePixelRatio || 1; var outputScale = window.devicePixelRatio || 1;
var canvas = document.getElementById('the-canvas'); var canvas = document.getElementById("the-canvas");
var context = canvas.getContext('2d'); var context = canvas.getContext("2d");
canvas.width = Math.floor(viewport.width * outputScale); canvas.width = Math.floor(viewport.width * outputScale);
canvas.height = Math.floor(viewport.height * outputScale); canvas.height = Math.floor(viewport.height * outputScale);

View File

@ -1,11 +1,13 @@
import globals from "globals"; import globals from "globals";
import import_ from "eslint-plugin-import"; import import_ from "eslint-plugin-import-x";
import jasmine from "eslint-plugin-jasmine"; import jasmine from "eslint-plugin-jasmine";
import json from "eslint-plugin-json"; import json from "@eslint/json";
import noUnsanitized from "eslint-plugin-no-unsanitized"; import noUnsanitized from "eslint-plugin-no-unsanitized";
import perfectionist from "eslint-plugin-perfectionist"; import perfectionist from "eslint-plugin-perfectionist";
import preferMathClamp from "./external/eslint_plugins/prefer-math-clamp.mjs";
import prettierRecommended from "eslint-plugin-prettier/recommended"; import prettierRecommended from "eslint-plugin-prettier/recommended";
import regexpPlugin from "eslint-plugin-regexp";
import unicorn from "eslint-plugin-unicorn"; import unicorn from "eslint-plugin-unicorn";
const jsFiles = folder => { const jsFiles = folder => {
@ -26,15 +28,18 @@ const chromiumExtensionServiceWorkerFiles = [
export default [ export default [
{ {
ignores: [ ignores: [
"package-lock.json",
"**/build/", "**/build/",
"**/l10n/", "**/l10n/",
"**/docs/", "**/docs/",
"**/node_modules/", "**/node_modules/",
"external/bcmaps/", "external/bcmaps/",
"external/brotli/",
"external/builder/fixtures/", "external/builder/fixtures/",
"external/builder/fixtures_babel/", "external/builder/fixtures_babel/",
"external/openjpeg/", "external/openjpeg/",
"external/qcms/", "external/qcms/",
"external/jbig2/",
"external/quickjs/", "external/quickjs/",
"test/stats/results/", "test/stats/results/",
"test/tmp/", "test/tmp/",
@ -42,6 +47,7 @@ export default [
"web/locale/", "web/locale/",
"web/wasm/", "web/wasm/",
"**/*~/", "**/*~/",
".{claude,codex,cursor}/",
], ],
}, },
@ -51,7 +57,16 @@ export default [
prettierRecommended, prettierRecommended,
{ {
files: ["**/*.json"], files: jsFiles("."),
plugins: regexpPlugin.configs["flat/recommended"].plugins,
rules: {
...regexpPlugin.configs["flat/recommended"].rules,
"regexp/no-legacy-features": "off",
},
},
{
files: ["**/*.json", "**/.*.json"],
language: "json/json",
...json.configs.recommended, ...json.configs.recommended,
}, },
{ {
@ -65,18 +80,24 @@ export default [
files: jsFiles("."), files: jsFiles("."),
plugins: { plugins: {
import: import_.flatConfigs.recommended.plugins.import, import: import_.flatConfigs.recommended.plugins["import-x"],
json, json,
"no-unsanitized": noUnsanitized, "no-unsanitized": noUnsanitized,
perfectionist, perfectionist,
"prefer-math-clamp": preferMathClamp,
unicorn, unicorn,
}, },
settings: {
"import-x/resolver-next": [import_.createNodeResolver()],
},
languageOptions: { languageOptions: {
globals: { globals: {
...globals.worker, ...globals.worker,
PDFJSDev: "readonly", PDFJSDev: "readonly",
__raw_import__: "readonly", __raw_import__: "readonly",
__eager_import__: "readonly",
}, },
ecmaVersion: 2025, ecmaVersion: 2025,
@ -114,8 +135,13 @@ export default [
"pdfjs-lib", "pdfjs-lib",
"pdfjs-web", "pdfjs-web",
"web", "web",
"@csstools/postcss-light-dark-function",
"fluent-bundle", "fluent-bundle",
"fluent-dom", "fluent-dom",
"postcss-dir-pseudo-class",
"postcss-nesting",
"postcss-values-parser",
"stylelint",
// See https://github.com/firebase/firebase-admin-node/discussions/1359. // See https://github.com/firebase/firebase-admin-node/discussions/1359.
"eslint-plugin-perfectionist", "eslint-plugin-perfectionist",
], ],
@ -126,7 +152,6 @@ export default [
"perfectionist/sort-exports": "error", "perfectionist/sort-exports": "error",
"perfectionist/sort-named-exports": "error", "perfectionist/sort-named-exports": "error",
"unicorn/no-abusive-eslint-disable": "error", "unicorn/no-abusive-eslint-disable": "error",
"unicorn/no-array-push-push": "error",
"unicorn/no-array-reduce": ["error", { allowSimpleOperations: true }], "unicorn/no-array-reduce": ["error", { allowSimpleOperations: true }],
"unicorn/no-console-spaces": "error", "unicorn/no-console-spaces": "error",
"unicorn/no-instanceof-builtins": "error", "unicorn/no-instanceof-builtins": "error",
@ -134,6 +159,10 @@ export default [
"unicorn/no-new-buffer": "error", "unicorn/no-new-buffer": "error",
"unicorn/no-single-promise-in-promise-methods": "error", "unicorn/no-single-promise-in-promise-methods": "error",
"unicorn/no-typeof-undefined": ["error", { checkGlobalVariables: false }], "unicorn/no-typeof-undefined": ["error", { checkGlobalVariables: false }],
"unicorn/no-unnecessary-array-flat-depth": "error",
"unicorn/no-unnecessary-array-splice-count": "error",
"unicorn/no-unnecessary-slice-end": "error",
"unicorn/no-useless-collection-argument": "error",
"unicorn/no-useless-promise-resolve-reject": "error", "unicorn/no-useless-promise-resolve-reject": "error",
"unicorn/no-useless-spread": "error", "unicorn/no-useless-spread": "error",
"unicorn/prefer-array-find": "error", "unicorn/prefer-array-find": "error",
@ -142,9 +171,12 @@ export default [
"unicorn/prefer-array-index-of": "error", "unicorn/prefer-array-index-of": "error",
"unicorn/prefer-array-some": "error", "unicorn/prefer-array-some": "error",
"unicorn/prefer-at": "error", "unicorn/prefer-at": "error",
"unicorn/prefer-class-fields": "error",
"unicorn/prefer-classlist-toggle": "error",
"unicorn/prefer-date-now": "error", "unicorn/prefer-date-now": "error",
"unicorn/prefer-dom-node-append": "error", "unicorn/prefer-dom-node-append": "error",
"unicorn/prefer-dom-node-remove": "error", "unicorn/prefer-dom-node-remove": "error",
"unicorn/prefer-import-meta-properties": "error",
"unicorn/prefer-includes": "error", "unicorn/prefer-includes": "error",
"unicorn/prefer-logical-operator-over-ternary": "error", "unicorn/prefer-logical-operator-over-ternary": "error",
"unicorn/prefer-modern-dom-apis": "error", "unicorn/prefer-modern-dom-apis": "error",
@ -152,11 +184,14 @@ export default [
"unicorn/prefer-negative-index": "error", "unicorn/prefer-negative-index": "error",
"unicorn/prefer-optional-catch-binding": "error", "unicorn/prefer-optional-catch-binding": "error",
"unicorn/prefer-regexp-test": "error", "unicorn/prefer-regexp-test": "error",
"unicorn/prefer-single-call": "error",
"unicorn/prefer-string-replace-all": "error", "unicorn/prefer-string-replace-all": "error",
"unicorn/prefer-string-starts-ends-with": "error", "unicorn/prefer-string-starts-ends-with": "error",
"unicorn/prefer-ternary": ["error", "only-single-line"], "unicorn/prefer-ternary": ["error", "only-single-line"],
"unicorn/throw-new-error": "error", "unicorn/throw-new-error": "error",
"prefer-math-clamp/prefer-math-clamp": "error",
// Possible errors // Possible errors
"for-direction": "error", "for-direction": "error",
"getter-return": "error", "getter-return": "error",
@ -240,8 +275,10 @@ export default [
"no-useless-concat": "error", "no-useless-concat": "error",
"no-useless-escape": "error", "no-useless-escape": "error",
"no-useless-return": "error", "no-useless-return": "error",
"prefer-object-has-own": "error",
"prefer-promise-reject-errors": "error", "prefer-promise-reject-errors": "error",
"prefer-spread": "error", "prefer-spread": "error",
radix: "error",
"wrap-iife": ["error", "any"], "wrap-iife": ["error", "any"],
yoda: ["error", "never", { exceptRange: true }], yoda: ["error", "never", { exceptRange: true }],
@ -276,6 +313,11 @@ export default [
"BinaryExpression[operator='instanceof'][right.name='Object']", "BinaryExpression[operator='instanceof'][right.name='Object']",
message: "Use `typeof` rather than `instanceof Object`.", message: "Use `typeof` rather than `instanceof Object`.",
}, },
{
selector: "MemberExpression[property.name='hasOwnProperty']",
message:
"Use `Object.hasOwn` rather than `Object.prototype.hasOwnProperty`.",
},
{ {
selector: "CallExpression[callee.name='assert'][arguments.length!=2]", selector: "CallExpression[callee.name='assert'][arguments.length!=2]",
message: "`assert()` must always be invoked with two arguments.", message: "`assert()` must always be invoked with two arguments.",
@ -303,6 +345,11 @@ export default [
selector: "NewExpression[callee.name='Name']", selector: "NewExpression[callee.name='Name']",
message: "Use `Name.get()` rather than `new Name()`.", message: "Use `Name.get()` rather than `new Name()`.",
}, },
{
selector: "NewExpression[callee.name='ObjectLoader']",
message:
"Use `ObjectLoader.load()` rather than `new ObjectLoader()`.",
},
{ {
selector: "NewExpression[callee.name='Ref']", selector: "NewExpression[callee.name='Ref']",
message: "Use `Ref.get()` rather than `new Ref()`.", message: "Use `Ref.get()` rather than `new Ref()`.",

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<!-- <!--
Copyright 2014 Mozilla Foundation Copyright 2014 Mozilla Foundation
@ -15,10 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<html dir="ltr" mozdisallowselectionprint> <html dir="ltr" mozdisallowselectionprint>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="google" content="notranslate"> <meta name="google" content="notranslate" />
<title>PDF.js page viewer using built components</title> <title>PDF.js page viewer using built components</title>
<style> <style>
@ -29,15 +29,15 @@ limitations under the License.
} }
</style> </style>
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css"> <link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
</head> </head>
<body tabindex="1"> <body tabindex="1">
<div id="pageContainer" class="pdfViewer singlePageView"></div> <div id="pageContainer" class="pdfViewer singlePageView"></div>
<script src="pageviewer.mjs" type="module"></script> <script src="pageviewer.mjs" type="module"></script>
</body> </body>
</html> </html>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<!-- <!--
Copyright 2014 Mozilla Foundation Copyright 2014 Mozilla Foundation
@ -15,10 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<html dir="ltr" mozdisallowselectionprint> <html dir="ltr" mozdisallowselectionprint>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="google" content="notranslate"> <meta name="google" content="notranslate" />
<title>PDF.js viewer using built components</title> <title>PDF.js viewer using built components</title>
<style> <style>
@ -35,17 +35,17 @@ limitations under the License.
} }
</style> </style>
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css"> <link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
</head> </head>
<body tabindex="1"> <body tabindex="1">
<div id="viewerContainer"> <div id="viewerContainer">
<div id="viewer" class="pdfViewer"></div> <div id="viewer" class="pdfViewer"></div>
</div> </div>
<script src="simpleviewer.mjs" type="module"></script> <script src="simpleviewer.mjs" type="module"></script>
</body> </body>
</html> </html>

View File

@ -40,6 +40,8 @@ const SANDBOX_BUNDLE_SRC = new URL(
window.location window.location
); );
const WASM_URL = "../../node_modules/pdfjs-dist/build/wasm/";
const container = document.getElementById("viewerContainer"); const container = document.getElementById("viewerContainer");
const eventBus = new pdfjsViewer.EventBus(); const eventBus = new pdfjsViewer.EventBus();
@ -59,6 +61,7 @@ const pdfFindController = new pdfjsViewer.PDFFindController({
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({ const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
eventBus, eventBus,
sandboxBundleSrc: SANDBOX_BUNDLE_SRC, sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
wasmUrl: WASM_URL,
}); });
const pdfViewer = new pdfjsViewer.PDFViewer({ const pdfViewer = new pdfjsViewer.PDFViewer({

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<!-- <!--
Copyright 2014 Mozilla Foundation Copyright 2014 Mozilla Foundation
@ -15,10 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<html dir="ltr" mozdisallowselectionprint> <html dir="ltr" mozdisallowselectionprint>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="google" content="notranslate"> <meta name="google" content="notranslate" />
<title>PDF.js Single Page Viewer using built components</title> <title>PDF.js Single Page Viewer using built components</title>
<style> <style>
@ -35,17 +35,17 @@ limitations under the License.
} }
</style> </style>
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css"> <link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
</head> </head>
<body tabindex="1"> <body tabindex="1">
<div id="viewerContainer"> <div id="viewerContainer">
<div id="viewer" class="pdfViewer"></div> <div id="viewer" class="pdfViewer"></div>
</div> </div>
<script src="singlepageviewer.mjs" type="module"></script> <script src="singlepageviewer.mjs" type="module"></script>
</body> </body>
</html> </html>

View File

@ -40,6 +40,8 @@ const SANDBOX_BUNDLE_SRC = new URL(
window.location window.location
); );
const WASM_URL = "../../node_modules/pdfjs-dist/build/wasm/";
const container = document.getElementById("viewerContainer"); const container = document.getElementById("viewerContainer");
const eventBus = new pdfjsViewer.EventBus(); const eventBus = new pdfjsViewer.EventBus();
@ -59,6 +61,7 @@ const pdfFindController = new pdfjsViewer.PDFFindController({
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({ const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
eventBus, eventBus,
sandboxBundleSrc: SANDBOX_BUNDLE_SRC, sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
wasmUrl: WASM_URL,
}); });
const pdfSinglePageViewer = new pdfjsViewer.PDFSinglePageViewer({ const pdfSinglePageViewer = new pdfjsViewer.PDFSinglePageViewer({

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<!-- <!--
Copyright 2018 Mozilla Foundation Copyright 2018 Mozilla Foundation
@ -15,10 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<html dir="ltr" mozdisallowselectionprint> <html dir="ltr" mozdisallowselectionprint>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="google" content="notranslate"> <meta name="google" content="notranslate" />
<title>PDF.js standalone JpegImage parser</title> <title>PDF.js standalone JpegImage parser</title>
<style> <style>
@ -30,11 +30,11 @@ limitations under the License.
</style> </style>
<script src="../../node_modules/pdfjs-dist/image_decoders/pdf.image_decoders.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/image_decoders/pdf.image_decoders.mjs" type="module"></script>
</head> </head>
<body tabindex="1"> <body tabindex="1">
<canvas id="jpegCanvas" width="0" height="0"></canvas> <canvas id="jpegCanvas" width="0" height="0"></canvas>
<script src="jpeg_viewer.mjs" type="module"></script> <script src="jpeg_viewer.mjs" type="module"></script>
</body> </body>
</html> </html>

View File

@ -29,7 +29,7 @@ const response = await fetch(JPEG_IMAGE);
if (!response.ok) { if (!response.ok) {
throw new Error(response.statusText); throw new Error(response.statusText);
} }
const typedArrayImage = new Uint8Array(await response.arrayBuffer()); const typedArrayImage = await response.bytes();
// Parse the image data using `JpegImage`. // Parse the image data using `JpegImage`.
// //

View File

@ -1,34 +1,32 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title>'Hello, world!' example</title> <title>'Hello, world!' example</title>
</head> </head>
<body> <body>
<h1>'Hello, world!' example</h1>
<h1>'Hello, world!' example</h1> <canvas id="the-canvas" style="border: 1px solid black; direction: ltr"></canvas>
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr;"></canvas> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script id="script" type="module">
<script id="script" type="module">
// //
// If absolute URL from the remote server is provided, configure the CORS // If absolute URL from the remote server is provided, configure the CORS
// header on that server. // header on that server.
// //
const url = './helloworld.pdf'; const url = "./helloworld.pdf";
// //
// The workerSrc property shall be specified. // The workerSrc property shall be specified.
// //
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsLib.GlobalWorkerOptions.workerSrc = "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
'../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
// //
// Asynchronous download PDF // Asynchronous download PDF
// //
const loadingTask = pdfjsLib.getDocument(url); const loadingTask = pdfjsLib.getDocument({ url });
const pdf = await loadingTask.promise; const pdf = await loadingTask.promise;
// //
// Fetch the first page // Fetch the first page
@ -50,9 +48,7 @@
canvas.style.width = Math.floor(viewport.width) + "px"; canvas.style.width = Math.floor(viewport.width) + "px";
canvas.style.height = Math.floor(viewport.height) + "px"; canvas.style.height = Math.floor(viewport.height) + "px";
const transform = outputScale !== 1 const transform = outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null;
? [outputScale, 0, 0, outputScale, 0, 0]
: null;
// //
// Render PDF page into canvas context // Render PDF page into canvas context
@ -63,14 +59,13 @@
viewport, viewport,
}; };
page.render(renderContext); page.render(renderContext);
</script> </script>
<hr> <hr />
<h2>JavaScript code:</h2> <h2>JavaScript code:</h2>
<pre id="code"></pre> <pre id="code"></pre>
<script> <script>
document.getElementById('code').textContent = document.getElementById("code").textContent = document.getElementById("script").text;
document.getElementById('script').text; </script>
</script> </body>
</body>
</html> </html>

View File

@ -1,65 +1,62 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title>'Hello, world!' base64 example</title> <title>'Hello, world!' base64 example</title>
</head> </head>
<body> <body>
<h1>'Hello, world!' example</h1>
<h1>'Hello, world!' example</h1> <canvas id="the-canvas" style="border: 1px solid black; direction: ltr"></canvas>
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr;"></canvas> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script id="script" type="module">
<script id="script" type="module">
// atob() is used to convert base64 encoded PDF to binary-like data. // atob() is used to convert base64 encoded PDF to binary-like data.
// (See also https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/ // (See also https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/
// Base64_encoding_and_decoding.) // Base64_encoding_and_decoding.)
var pdfData = atob( var pdfData = atob(
'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' + "JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog" +
'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' + "IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv" +
'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' + "TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K" +
'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' + "Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg" +
'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' + "L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+" +
'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' + "PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u" +
'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' + "dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq" +
'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' + "Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU" +
'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' + "CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu" +
'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' + "ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g" +
'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' + "CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw" +
'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' + "MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v" +
'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G'); "dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G"
);
// //
// The workerSrc property shall be specified. // The workerSrc property shall be specified.
// //
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsLib.GlobalWorkerOptions.workerSrc = "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
'../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
// Opening PDF by passing its binary data as a string. It is still preferable // Opening PDF by passing its binary data as a string. It is still preferable
// to use Uint8Array, but string or array-like structure will work too. // to use Uint8Array, but string or array-like structure will work too.
var loadingTask = pdfjsLib.getDocument({ data: pdfData, }); var loadingTask = pdfjsLib.getDocument({ data: pdfData });
var pdf = await loadingTask.promise; var pdf = await loadingTask.promise;
// Fetch the first page. // Fetch the first page.
var page = await pdf.getPage(1); var page = await pdf.getPage(1);
var scale = 1.5; var scale = 1.5;
var viewport = page.getViewport({ scale: scale, }); var viewport = page.getViewport({ scale: scale });
// Support HiDPI-screens. // Support HiDPI-screens.
var outputScale = window.devicePixelRatio || 1; var outputScale = window.devicePixelRatio || 1;
// Prepare canvas using PDF page dimensions. // Prepare canvas using PDF page dimensions.
var canvas = document.getElementById('the-canvas'); var canvas = document.getElementById("the-canvas");
var context = canvas.getContext('2d'); var context = canvas.getContext("2d");
canvas.width = Math.floor(viewport.width * outputScale); canvas.width = Math.floor(viewport.width * outputScale);
canvas.height = Math.floor(viewport.height * outputScale); canvas.height = Math.floor(viewport.height * outputScale);
canvas.style.width = Math.floor(viewport.width) + "px"; canvas.style.width = Math.floor(viewport.width) + "px";
canvas.style.height = Math.floor(viewport.height) + "px"; canvas.style.height = Math.floor(viewport.height) + "px";
var transform = outputScale !== 1 var transform = outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null;
? [outputScale, 0, 0, outputScale, 0, 0]
: null;
// Render PDF page into canvas context. // Render PDF page into canvas context.
var renderContext = { var renderContext = {
@ -68,14 +65,13 @@
viewport, viewport,
}; };
page.render(renderContext); page.render(renderContext);
</script> </script>
<hr> <hr />
<h2>JavaScript code:</h2> <h2>JavaScript code:</h2>
<pre id="code"></pre> <pre id="code"></pre>
<script> <script>
document.getElementById('code').textContent = document.getElementById("code").textContent = document.getElementById("script").text;
document.getElementById('script').text; </script>
</script> </body>
</body>
</html> </html>

View File

@ -1,48 +1,46 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title>Previous/Next example</title> <title>Previous/Next example</title>
</head> </head>
<body> <body>
<h1>'Previous/Next' example</h1>
<h1>'Previous/Next' example</h1> <div>
<div>
<button id="prev" type="button">Previous</button> <button id="prev" type="button">Previous</button>
<button id="next" type="button">Next</button> <button id="next" type="button">Next</button>
&nbsp; &nbsp; &nbsp; &nbsp;
<span>Page: <span id="page_num"></span> / <span id="page_count"></span></span> <span>Page: <span id="page_num"></span> / <span id="page_count"></span></span>
</div> </div>
<div> <div>
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr;"></canvas> <canvas id="the-canvas" style="border: 1px solid black; direction: ltr"></canvas>
</div> </div>
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script id="script" type="module"> <script id="script" type="module">
// //
// If absolute URL from the remote server is provided, configure the CORS // If absolute URL from the remote server is provided, configure the CORS
// header on that server. // header on that server.
// //
var url = '../../web/compressed.tracemonkey-pldi-09.pdf'; var url = "../../web/compressed.tracemonkey-pldi-09.pdf";
// //
// In cases when the pdf.worker.js is located at the different folder than the // In cases when the pdf.worker.js is located at the different folder than the
// PDF.js's one, or the PDF.js is executed via eval(), the workerSrc property // PDF.js's one, or the PDF.js is executed via eval(), the workerSrc property
// shall be specified. // shall be specified.
// //
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsLib.GlobalWorkerOptions.workerSrc = "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
'../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
var pdfDoc = null, var pdfDoc = null,
pageNum = 1, pageNum = 1,
pageRendering = false, pageRendering = false,
pageNumPending = null, pageNumPending = null,
scale = 0.8, scale = 0.8,
canvas = document.getElementById('the-canvas'), canvas = document.getElementById("the-canvas"),
ctx = canvas.getContext('2d'); ctx = canvas.getContext("2d");
/** /**
* Get page info from document, resize canvas accordingly, and render page. * Get page info from document, resize canvas accordingly, and render page.
@ -51,8 +49,8 @@
function renderPage(num) { function renderPage(num) {
pageRendering = true; pageRendering = true;
// Using promise to fetch the page // Using promise to fetch the page
pdfDoc.getPage(num).then(function(page) { pdfDoc.getPage(num).then(function (page) {
var viewport = page.getViewport({ scale: scale, }); var viewport = page.getViewport({ scale: scale });
// Support HiDPI-screens. // Support HiDPI-screens.
var outputScale = window.devicePixelRatio || 1; var outputScale = window.devicePixelRatio || 1;
@ -61,9 +59,7 @@
canvas.style.width = Math.floor(viewport.width) + "px"; canvas.style.width = Math.floor(viewport.width) + "px";
canvas.style.height = Math.floor(viewport.height) + "px"; canvas.style.height = Math.floor(viewport.height) + "px";
var transform = outputScale !== 1 var transform = outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null;
? [outputScale, 0, 0, outputScale, 0, 0]
: null;
// Render PDF page into canvas context // Render PDF page into canvas context
var renderContext = { var renderContext = {
@ -85,7 +81,7 @@
}); });
// Update page counters // Update page counters
document.getElementById('page_num').textContent = num; document.getElementById("page_num").textContent = num;
} }
/** /**
@ -110,7 +106,7 @@
pageNum--; pageNum--;
queueRenderPage(pageNum); queueRenderPage(pageNum);
} }
document.getElementById('prev').addEventListener('click', onPrevPage); document.getElementById("prev").addEventListener("click", onPrevPage);
/** /**
* Displays next page. * Displays next page.
@ -122,18 +118,17 @@
pageNum++; pageNum++;
queueRenderPage(pageNum); queueRenderPage(pageNum);
} }
document.getElementById('next').addEventListener('click', onNextPage); document.getElementById("next").addEventListener("click", onNextPage);
/** /**
* Asynchronously downloads PDF. * Asynchronously downloads PDF.
*/ */
var loadingTask = pdfjsLib.getDocument(url); var loadingTask = pdfjsLib.getDocument({ url });
pdfDoc = await loadingTask.promise; pdfDoc = await loadingTask.promise;
document.getElementById('page_count').textContent = pdfDoc.numPages; document.getElementById("page_count").textContent = pdfDoc.numPages;
// Initial/first page rendering // Initial/first page rendering
renderPage(pageNum); renderPage(pageNum);
</script> </script>
</body>
</body>
</html> </html>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<!-- <!--
Copyright 2016 Mozilla Foundation Copyright 2016 Mozilla Foundation
@ -16,13 +16,13 @@ limitations under the License.
--> -->
<html dir="ltr"> <html dir="ltr">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>PDF.js viewer</title> <title>PDF.js viewer</title>
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css"> <link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
<link rel="stylesheet" type="text/css" href="viewer.css"> <link rel="stylesheet" type="text/css" href="viewer.css" />
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
@ -46,7 +46,7 @@ limitations under the License.
<button class="toolbarButton pageUp" title="Previous Page" id="previous" type="button"></button> <button class="toolbarButton pageUp" title="Previous Page" id="previous" type="button"></button>
<button class="toolbarButton pageDown" title="Next Page" id="next" type="button"></button> <button class="toolbarButton pageDown" title="Next Page" id="next" type="button"></button>
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1"> <input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1" />
<button class="toolbarButton zoomOut" title="Zoom Out" id="zoomOut" type="button"></button> <button class="toolbarButton zoomOut" title="Zoom Out" id="zoomOut" type="button"></button>
<button class="toolbarButton zoomIn" title="Zoom In" id="zoomIn" type="button"></button> <button class="toolbarButton zoomIn" title="Zoom In" id="zoomIn" type="button"></button>

View File

@ -46,19 +46,13 @@ const PDFViewerApplication = {
* @returns {Promise} - Returns the promise, which is resolved when document * @returns {Promise} - Returns the promise, which is resolved when document
* is opened. * is opened.
*/ */
open(params) { async open(params) {
if (this.pdfLoadingTask) { if (this.pdfLoadingTask) {
// We need to destroy already opened document // We need to destroy already opened document.
return this.close().then( await this.close();
function () {
// ... and repeat the open() call.
return this.open(params);
}.bind(this)
);
} }
const url = params.url; const { url } = params;
const self = this;
this.setTitleUsingUrl(url); this.setTitleUsingUrl(url);
// Loading document. // Loading document.
@ -70,24 +64,22 @@ const PDFViewerApplication = {
}); });
this.pdfLoadingTask = loadingTask; this.pdfLoadingTask = loadingTask;
loadingTask.onProgress = function (progressData) { loadingTask.onProgress = evt => this.progress(evt.percent);
self.progress(progressData.loaded / progressData.total);
};
return loadingTask.promise.then( return loadingTask.promise.then(
function (pdfDocument) { pdfDocument => {
// Document loaded, specifying document for the viewer. // Document loaded, specifying document for the viewer.
self.pdfDocument = pdfDocument; this.pdfDocument = pdfDocument;
self.pdfViewer.setDocument(pdfDocument); this.pdfViewer.setDocument(pdfDocument);
self.pdfLinkService.setDocument(pdfDocument); this.pdfLinkService.setDocument(pdfDocument);
self.pdfHistory.initialize({ this.pdfHistory.initialize({
fingerprint: pdfDocument.fingerprints[0], fingerprint: pdfDocument.fingerprints[0],
}); });
self.loadingBar.hide(); this.loadingBar.hide();
self.setTitleUsingMetadata(pdfDocument); this.setTitleUsingMetadata(pdfDocument);
}, },
function (reason) { reason => {
let key = "pdfjs-loading-error"; let key = "pdfjs-loading-error";
if (reason instanceof pdfjsLib.InvalidPDFException) { if (reason instanceof pdfjsLib.InvalidPDFException) {
key = "pdfjs-invalid-file-error"; key = "pdfjs-invalid-file-error";
@ -96,10 +88,10 @@ const PDFViewerApplication = {
? "pdfjs-missing-file-error" ? "pdfjs-missing-file-error"
: "pdfjs-unexpected-response-error"; : "pdfjs-unexpected-response-error";
} }
self.l10n.get(key).then(msg => { this.l10n.get(key).then(msg => {
self.error(msg, { message: reason?.message }); this.error(msg, { message: reason.message });
}); });
self.loadingBar.hide(); this.loadingBar.hide();
} }
); );
}, },
@ -109,9 +101,9 @@ const PDFViewerApplication = {
* @returns {Promise} - Returns the promise, which is resolved when all * @returns {Promise} - Returns the promise, which is resolved when all
* destruction is completed. * destruction is completed.
*/ */
close() { async close() {
if (!this.pdfLoadingTask) { if (!this.pdfLoadingTask) {
return Promise.resolve(); return;
} }
const promise = this.pdfLoadingTask.destroy(); const promise = this.pdfLoadingTask.destroy();
@ -128,7 +120,7 @@ const PDFViewerApplication = {
} }
} }
return promise; await promise;
}, },
get loadingBar() { get loadingBar() {
@ -152,32 +144,21 @@ const PDFViewerApplication = {
this.setTitle(title); this.setTitle(title);
}, },
setTitleUsingMetadata(pdfDocument) { async setTitleUsingMetadata(pdfDocument) {
const self = this; const { info, metadata } = await pdfDocument.getMetadata();
pdfDocument.getMetadata().then(function (data) { this.documentInfo = info;
const info = data.info, this.metadata = metadata;
metadata = data.metadata;
self.documentInfo = info;
self.metadata = metadata;
// Provides some basic debug information // Provides some basic debug information
console.log( console.log(
"PDF " + `PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +
pdfDocument.fingerprints[0] + `${(metadata?.get("pdf:producer") || info.Producer || "-").trim()} / ` +
" [" + `${(metadata?.get("xmp:creatortool") || info.Creator || "-").trim()}` +
info.PDFFormatVersion + `] (PDF.js: ${pdfjsLib.version || "?"} [${pdfjsLib.build || "?"}])`
" " +
(info.Producer || "-").trim() +
" / " +
(info.Creator || "-").trim() +
"]" +
" (PDF.js: " +
(pdfjsLib.version || "-") +
")"
); );
let pdfTitle; let pdfTitle;
if (metadata && metadata.has("dc:title")) { if (metadata?.has("dc:title")) {
const title = metadata.get("dc:title"); const title = metadata.get("dc:title");
// Ghostscript sometimes returns 'Untitled', so prevent setting the // Ghostscript sometimes returns 'Untitled', so prevent setting the
// title to 'Untitled. // title to 'Untitled.
@ -185,15 +166,11 @@ const PDFViewerApplication = {
pdfTitle = title; pdfTitle = title;
} }
} }
pdfTitle ||= info?.Title;
if (!pdfTitle && info && info.Title) {
pdfTitle = info.Title;
}
if (pdfTitle) { if (pdfTitle) {
self.setTitle(pdfTitle + " - " + document.title); this.setTitle(pdfTitle + " - " + document.title);
} }
});
}, },
setTitle: function pdfViewSetTitle(title) { setTitle: function pdfViewSetTitle(title) {
@ -223,8 +200,7 @@ const PDFViewerApplication = {
console.error(`${message}\n\n${moreInfoText.join("\n")}`); console.error(`${message}\n\n${moreInfoText.join("\n")}`);
}, },
progress: function pdfViewProgress(level) { progress(percent) {
const percent = Math.round(level * 100);
// Updating the bar if value increases. // Updating the bar if value increases.
if (percent > this.loadingBar.percent || isNaN(percent)) { if (percent > this.loadingBar.percent || isNaN(percent)) {
this.loadingBar.percent = percent; this.loadingBar.percent = percent;

View File

@ -14,7 +14,7 @@ const pdfPath =
// Will be using promises to load document, pages and misc data instead of // Will be using promises to load document, pages and misc data instead of
// callback. // callback.
const loadingTask = getDocument(pdfPath); const loadingTask = getDocument({ url: pdfPath });
loadingTask.promise loadingTask.promise
.then(function (doc) { .then(function (doc) {
const numPages = doc.numPages; const numPages = doc.numPages;

View File

@ -1,14 +1,13 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title>Text-only PDF.js example</title> <title>Text-only PDF.js example</title>
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script> <script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
<script src="pdf2svg.mjs" type="module"></script> <script src="pdf2svg.mjs" type="module"></script>
</head> </head>
<body> <body>
<p>Text-only PDF.js example</p> <p>Text-only PDF.js example</p>
<div id="pageContainer" style="display: inline-block; border: solid 1px black;"> <div id="pageContainer" style="display: inline-block; border: solid 1px black"></div>
</div> </body>
</body>
</html> </html>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title>webpack example</title> <title>webpack example</title>
<script src="../../build/webpack/main.bundle.js"></script> <script src="../../build/webpack/main.bundle.js"></script>
</head> </head>
<body> <body>
<canvas id="theCanvas"></canvas> <canvas id="theCanvas"></canvas>
</body> </body>
</html> </html>

View File

@ -45,7 +45,7 @@ function watchObjectOrEmbed(elem) {
// <embed src> <object data> // <embed src> <object data>
var srcAttribute = "src" in elem ? "src" : "data"; var srcAttribute = "src" in elem ? "src" : "data";
var path = elem[srcAttribute]; var path = elem[srcAttribute];
if (!mimeType && !/\.pdf($|[?#])/i.test(path)) { if (!mimeType && !/\.pdf(?:$|[?#])/i.test(path)) {
return; return;
} }

View File

@ -15,41 +15,41 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<title>PDF.js viewer options</title> <title>PDF.js viewer options</title>
<style> <style>
body { body {
min-width: 400px; /* a page at the settings page is at least 400px wide */ min-width: 400px; /* a page at the settings page is at least 400px wide */
margin: 14px 17px; /* already added by default in Chrome 40.0.2212.0 */ margin: 14px 17px; /* already added by default in Chrome 40.0.2212.0 */
} }
.settings-row { .settings-row {
margin: 1em 0; margin: 1em 0;
} }
.checkbox label { .checkbox label {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
} }
.checkbox label input { .checkbox label input {
flex-shrink: 0; flex-shrink: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="settings-boxes"></div> <div id="settings-boxes"></div>
<button id="reset-button" type="button">Restore default settings</button> <button id="reset-button" type="button">Restore default settings</button>
<template id="checkbox-template"> <template id="checkbox-template">
<div class="settings-row checkbox"> <div class="settings-row checkbox">
<label> <label>
<input type="checkbox"> <input type="checkbox" />
<span></span> <span></span>
</label> </label>
</div> </div>
</template> </template>
<template id="viewerCssTheme-template"> <template id="viewerCssTheme-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -58,11 +58,11 @@ body {
<option value="2">Dark theme</option> <option value="2">Dark theme</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="viewOnLoad-template"> <template id="viewOnLoad-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -71,11 +71,11 @@ body {
<option value="1">Show initial position</option> <option value="1">Show initial position</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="defaultZoomValue-template"> <template id="defaultZoomValue-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -94,11 +94,11 @@ body {
<option value="400">400%</option> <option value="400">400%</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="sidebarViewOnLoad-template"> <template id="sidebarViewOnLoad-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -109,11 +109,11 @@ body {
<option value="3">Show attachments in sidebar</option> <option value="3">Show attachments in sidebar</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="cursorToolOnLoad-template"> <template id="cursorToolOnLoad-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -121,11 +121,11 @@ body {
<option value="1">Hand tool</option> <option value="1">Hand tool</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="textLayerMode-template"> <template id="textLayerMode-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -133,11 +133,11 @@ body {
<option value="1">Enable text selection</option> <option value="1">Enable text selection</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="externalLinkTarget-template"> <template id="externalLinkTarget-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -148,11 +148,11 @@ body {
<option value="4">Top window/tab</option> <option value="4">Top window/tab</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="scrollModeOnLoad-template"> <template id="scrollModeOnLoad-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -163,11 +163,11 @@ body {
<option value="2">Wrapped scrolling</option> <option value="2">Wrapped scrolling</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<template id="spreadModeOnLoad-template"> <template id="spreadModeOnLoad-template">
<div class="settings-row"> <div class="settings-row">
<label> <label>
<span></span> <span></span>
<select> <select>
@ -177,9 +177,9 @@ body {
<option value="2">Even spreads</option> <option value="2">Even spreads</option>
</select> </select>
</label> </label>
</div> </div>
</template> </template>
<script src="options.js"></script> <script src="options.js"></script>
</body> </body>
</html> </html>

View File

@ -168,7 +168,7 @@ function renderEnumPref(shortDescription, prefName) {
var select = wrapper.querySelector("select"); var select = wrapper.querySelector("select");
select.onchange = function () { select.onchange = function () {
var pref = {}; var pref = {};
pref[prefName] = parseInt(this.value); pref[prefName] = parseInt(this.value, 10);
storageArea.set(pref); storageArea.set(pref);
}; };
wrapper.querySelector("span").textContent = shortDescription; wrapper.querySelector("span").textContent = shortDescription;

View File

@ -69,7 +69,7 @@ async function registerPdfRedirectRule() {
}, },
}; };
// Rules in order of prority (highest priority rule first). // Rules in order of priority (highest priority rule first).
// The required "id" fields will be auto-generated later. // The required "id" fields will be auto-generated later.
const addRules = [ const addRules = [
{ {

View File

@ -1,234 +0,0 @@
{
"type": "object",
"properties": {
"viewerCssTheme": {
"title": "Theme",
"description": "The theme to use.\n0 = Use system theme.\n1 = Light theme.\n2 = Dark theme.",
"type": "integer",
"enum": [0, 1, 2],
"default": 2
},
"showPreviousViewOnLoad": {
"description": "DEPRECATED. Set viewOnLoad to 1 to disable showing the last page/position on load.",
"type": "boolean",
"default": true
},
"viewOnLoad": {
"title": "View position on load",
"description": "The position in the document upon load.\n -1 = Default (uses OpenAction if available, otherwise equal to `viewOnLoad = 0`).\n 0 = The last viewed page/position.\n 1 = The initial page/position.",
"type": "integer",
"enum": [-1, 0, 1],
"default": 0
},
"defaultZoomDelay": {
"title": "Default zoom delay",
"description": "Delay (in ms) to wait before redrawing the canvas.",
"type": "integer",
"default": 400
},
"defaultZoomValue": {
"title": "Default zoom level",
"description": "Default zoom level of the viewer. Accepted values: 'auto', 'page-actual', 'page-width', 'page-height', 'page-fit', or a zoom level in percents.",
"type": "string",
"pattern": "|auto|page-actual|page-width|page-height|page-fit|[0-9]+\\.?[0-9]*(,[0-9]+\\.?[0-9]*){0,2}",
"default": ""
},
"sidebarViewOnLoad": {
"title": "Sidebar state on load",
"description": "Controls the state of the sidebar upon load.\n -1 = Default (uses PageMode if available, otherwise the last position if available/enabled).\n 0 = Do not show sidebar.\n 1 = Show thumbnails in sidebar.\n 2 = Show document outline in sidebar.\n 3 = Show attachments in sidebar.",
"type": "integer",
"enum": [-1, 0, 1, 2, 3],
"default": -1
},
"enableHandToolOnLoad": {
"description": "DEPRECATED. Set cursorToolOnLoad to 1 to enable the hand tool by default.",
"type": "boolean",
"default": false
},
"enableHWA": {
"title": "Enable hardware acceleration",
"description": "Whether to enable hardware acceleration.",
"type": "boolean",
"default": true
},
"enableAltText": {
"type": "boolean",
"default": false
},
"enableGuessAltText": {
"type": "boolean",
"default": true
},
"enableAltTextModelDownload": {
"type": "boolean",
"default": true
},
"enableNewAltTextWhenAddingImage": {
"type": "boolean",
"default": true
},
"altTextLearnMoreUrl": {
"type": "string",
"default": ""
},
"enableSignatureEditor": {
"type": "boolean",
"default": false
},
"enableUpdatedAddImage": {
"type": "boolean",
"default": false
},
"cursorToolOnLoad": {
"title": "Cursor tool on load",
"description": "The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.",
"type": "integer",
"enum": [0, 1],
"default": 0
},
"pdfBugEnabled": {
"title": "Enable debugging tools",
"description": "Whether to enable debugging tools.",
"type": "boolean",
"default": false
},
"enableScripting": {
"title": "Enable active content (JavaScript) in PDFs",
"type": "boolean",
"description": "Whether to allow execution of active content (JavaScript) by PDF files.",
"default": false
},
"enableHighlightFloatingButton": {
"type": "boolean",
"default": false
},
"highlightEditorColors": {
"type": "string",
"default": "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F"
},
"disableRange": {
"title": "Disable range requests",
"description": "Whether to disable range requests (not recommended).",
"type": "boolean",
"default": false
},
"disableStream": {
"title": "Disable streaming for requests",
"description": "Whether to disable streaming for requests (not recommended).",
"type": "boolean",
"default": false
},
"disableAutoFetch": {
"type": "boolean",
"default": false
},
"disableFontFace": {
"title": "Disable @font-face",
"description": "Whether to disable @font-face and fall back to canvas rendering (this is more resource-intensive).",
"type": "boolean",
"default": false
},
"disableTextLayer": {
"description": "DEPRECATED. Set textLayerMode to 0 to disable the text selection layer by default.",
"type": "boolean",
"default": false
},
"textLayerMode": {
"title": "Text layer mode",
"description": "Controls if the text layer is enabled, and the selection mode that is used.\n 0 = Disabled.\n 1 = Enabled.",
"type": "integer",
"enum": [0, 1],
"default": 1
},
"externalLinkTarget": {
"title": "External links target window",
"description": "Controls how external links will be opened.\n 0 = default.\n 1 = replaces current window.\n 2 = new window/tab.\n 3 = parent.\n 4 = in top window.",
"type": "integer",
"enum": [0, 1, 2, 3, 4],
"default": 0
},
"disablePageLabels": {
"type": "boolean",
"default": false
},
"disablePageMode": {
"description": "DEPRECATED.",
"type": "boolean",
"default": false
},
"disableTelemetry": {
"title": "Disable telemetry",
"type": "boolean",
"description": "Whether to prevent the extension from reporting the extension and browser version to the extension developers.",
"default": false
},
"annotationMode": {
"type": "integer",
"enum": [0, 1, 2, 3],
"default": 2
},
"annotationEditorMode": {
"type": "integer",
"enum": [-1, 0, 3, 15],
"default": 0
},
"enablePermissions": {
"type": "boolean",
"default": false
},
"enableXfa": {
"type": "boolean",
"default": true
},
"historyUpdateUrl": {
"type": "boolean",
"default": false
},
"ignoreDestinationZoom": {
"title": "Ignore the zoom argument in destinations",
"description": "When enabled it will maintain the currently active zoom level, rather than letting the PDF document modify it, when navigating to internal destinations.",
"type": "boolean",
"default": false
},
"enablePrintAutoRotate": {
"title": "Automatically rotate printed pages",
"description": "When enabled, landscape pages are rotated when printed.",
"type": "boolean",
"default": true
},
"scrollModeOnLoad": {
"title": "Scroll mode on load",
"description": "Controls how the viewer scrolls upon load.\n -1 = Default (uses the last position if available/enabled).\n 3 = Page scrolling.\n 0 = Vertical scrolling.\n 1 = Horizontal scrolling.\n 2 = Wrapped scrolling.",
"type": "integer",
"enum": [-1, 0, 1, 2, 3],
"default": -1
},
"spreadModeOnLoad": {
"title": "Spread mode on load",
"description": "Whether the viewer should join pages into spreads upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = No spreads.\n 1 = Odd spreads.\n 2 = Even spreads.",
"type": "integer",
"enum": [-1, 0, 1, 2],
"default": -1
},
"forcePageColors": {
"description": "When enabled, the pdf rendering will use the high contrast mode colors",
"type": "boolean",
"default": false
},
"pageColorsBackground": {
"description": "The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
"type": "string",
"default": "Canvas"
},
"pageColorsForeground": {
"description": "The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
"type": "string",
"default": "CanvasText"
},
"enableAutoLinking": {
"description": "Enable creation of hyperlinks from text that look like URLs.",
"type": "boolean",
"default": true
}
}
}

View File

@ -96,7 +96,7 @@ limitations under the License.
chrome.storage.local.get(localStorage, items => { chrome.storage.local.get(localStorage, items => {
Object.assign(localStorage, items); Object.assign(localStorage, items);
var lastTime = parseInt(localStorage.telemetryLastTime) || 0; var lastTime = parseInt(localStorage.telemetryLastTime, 10) || 0;
var wasUpdated = didUpdateSinceLastCheck(); var wasUpdated = didUpdateSinceLastCheck();
if (!wasUpdated && Date.now() - lastTime < MINIMUM_TIME_BETWEEN_PING) { if (!wasUpdated && Date.now() - lastTime < MINIMUM_TIME_BETWEEN_PING) {
return; return;

19
external/brotli/LICENSE_BROTLI vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

8
external/brotli/README.md vendored Normal file
View File

@ -0,0 +1,8 @@
## Release
In order to get the file `decoder.js`:
* `gulp release-brotli --hash` followed by the git hash of the revision.
## Licensing
[brotli](https://github.com/google/brotli/) is under [MIT License](https://github.com/google/brotli/blob/master/LICENSE)

2466
external/brotli/decode.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,25 @@ function handlePreprocessorAction(ctx, actionName, args, path) {
} }
function babelPluginPDFJSPreprocessor(babel, ctx) { function babelPluginPDFJSPreprocessor(babel, ctx) {
function removeUnusedFunctions(path) {
let removed;
do {
removed = false;
path.scope.crawl();
for (const name in path.scope.bindings) {
const binding = path.scope.bindings[name];
if (!binding.referenced) {
const { path: bindingPath } = binding;
if (bindingPath.isFunctionDeclaration()) {
bindingPath.remove();
removed = true;
}
}
}
// If we removed some functions, there might be new unused ones
} while (removed);
}
return { return {
name: "babel-plugin-pdfjs-preprocessor", name: "babel-plugin-pdfjs-preprocessor",
manipulateOptions({ parserOpts }) { manipulateOptions({ parserOpts }) {
@ -171,36 +190,19 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
}, },
]; ];
path.replaceWith(t.importExpression(source)); path.replaceWith(t.importExpression(source));
} else if (t.isIdentifier(node.callee, { name: "__eager_import__" })) {
if (node.arguments.length !== 1) {
throw new Error("Invalid `__eager_import__` usage.");
} }
}, // Replace it with a standard `import`-call and inline the module.
NewExpression(path) { const source = node.arguments[0];
const { node } = path; source.leadingComments = [
if (
t.isIdentifier(node.callee, { name: "URL" }) &&
node.arguments.length === 2
) {
const [arg1, arg2] = node.arguments;
if (
arg1.type === "StringLiteral" &&
arg1.value.endsWith(".wasm") &&
arg2.type === "MemberExpression"
) {
// This statement is generated by the Emscripten Compiler (emcc),
// however we're manually loading wasm-files and we want to ensure
// that bundlers will leave it alone; this *must* include Webpack.
arg1.leadingComments = [
{ {
type: "CommentBlock", type: "CommentBlock",
value: "webpackIgnore: true", value: "webpackMode: 'eager'",
},
{
type: "CommentBlock",
value: "@vite-ignore",
}, },
]; ];
} path.replaceWith(t.importExpression(source));
} }
}, },
"BlockStatement|StaticBlock": { "BlockStatement|StaticBlock": {
@ -255,6 +257,8 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
// Function body ends with return without arg -- removing it. // Function body ends with return without arg -- removing it.
body.pop(); body.pop();
} }
removeUnusedFunctions(path);
}, },
}, },
ClassMethod: { ClassMethod: {
@ -277,6 +281,40 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
} }
}, },
}, },
Program: {
exit(path) {
if (path.node.sourceType === "module") {
removeUnusedFunctions(path);
}
},
},
MemberExpression(path) {
// The Emscripten Compiler (emcc) generates code that allows the caller
// to provide the Wasm module (thorugh Module.instantiateWasm), with
// a fallback in case .instantiateWasm is not provided.
// We always define instantiateWasm, so we can hard-code the check
// and let our dead code elimination logic remove the unused fallback.
if (
path.parentPath.isIfStatement({ test: path.node }) &&
path.matchesPattern("Module.instantiateWasm")
) {
path.replaceWith(t.booleanLiteral(true));
}
},
},
};
}
function babelPluginStripSrcPath() {
return {
name: "babel-plugin-strip-src-path",
visitor: {
"ImportDeclaration|ExportNamedDeclaration|ExportAllDeclaration":
function ({ node }) {
if (node.source?.value.includes("/src/")) {
node.source.value = node.source.value.replace("/src/", "/");
}
},
}, },
}; };
} }
@ -288,4 +326,8 @@ function preprocessPDFJSCode(ctx, content) {
}).code; }).code;
} }
export { babelPluginPDFJSPreprocessor, preprocessPDFJSCode }; export {
babelPluginPDFJSPreprocessor,
babelPluginStripSrcPath,
preprocessPDFJSCode,
};

View File

@ -39,15 +39,22 @@ function preprocess(inFilename, outFilename, defines) {
} }
function expandCssImports(content, baseUrl) { function expandCssImports(content, baseUrl) {
if (defines.GECKOVIEW) {
// In Geckoview, we don't need some styles.
const startComment = "/* Ignored in GECKOVIEW: begin */";
const endComment = "/* Ignored in GECKOVIEW: end */";
const beginIndex = content.indexOf(startComment);
const endIndex = content.indexOf(endComment);
if (beginIndex >= 0 && endIndex > beginIndex) {
content =
content.substring(0, beginIndex) +
content.substring(endIndex + endComment.length);
}
}
return content.replaceAll( return content.replaceAll(
/^\s*@import\s+url\(([^)]+)\);\s*$/gm, /^\s*@import\s+url\(([^)]+)\);\s*$/gm,
function (all, url) { function (all, url) {
if (defines.GECKOVIEW) {
switch (url) {
case "annotation_editor_layer_builder.css":
return "";
}
}
const file = path.join(path.dirname(baseUrl), url); const file = path.join(path.dirname(baseUrl), url);
const imported = fs.readFileSync(file, "utf8").toString(); const imported = fs.readFileSync(file, "utf8").toString();
return expandCssImports(imported, file); return expandCssImports(imported, file);
@ -125,7 +132,7 @@ function preprocess(inFilename, outFilename, defines) {
} }
} }
function expand(line) { function expand(line) {
line = line.replaceAll(/__[\w]+__/g, function (variable) { line = line.replaceAll(/__\w+__/g, function (variable) {
variable = variable.substring(2, variable.length - 2); variable = variable.substring(2, variable.length - 2);
if (variable in defines) { if (variable in defines) {
return defines[variable]; return defines[variable];
@ -151,7 +158,8 @@ function preprocess(inFilename, outFilename, defines) {
let state = STATE_NONE; let state = STATE_NONE;
const stack = []; const stack = [];
const control = const control =
/^(?:\/\/|\s*\/\*|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:\*\/|-->)?$)?/; // eslint-disable-next-line regexp/no-super-linear-backtracking
/^(?:\/\/|\s*\/\*|\s*<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:\*\/|-->)?$)?/;
while ((line = readLine()) !== null) { while ((line = readLine()) !== null) {
++lineNumber; ++lineNumber;
@ -213,7 +221,7 @@ function preprocess(inFilename, outFilename, defines) {
) { ) {
writeLine( writeLine(
line line
.replaceAll(/^\/\/|^<!--/g, " ") .replaceAll(/^\/\/|^\s*<!--/g, " ")
.replaceAll(/(^\s*)\/\*/g, "$1 ") .replaceAll(/(^\s*)\/\*/g, "$1 ")
.replaceAll(/\*\/$|-->$/g, "") .replaceAll(/\*\/$|-->$/g, "")
); );

View File

@ -8,3 +8,4 @@ function test() {
} }
"4"; "4";
} }
test();

View File

@ -17,3 +17,4 @@ function test() {
"4"; "4";
} }
} }
test();

View File

@ -2,10 +2,12 @@ function f1() {
"1"; "1";
"2"; "2";
} }
f1();
function f2() { function f2() {
"1"; "1";
"2"; "2";
} }
f2();
function f3() { function f3() {
if ("1") { if ("1") {
"1"; "1";
@ -15,3 +17,4 @@ function f3() {
"4"; "4";
} }
} }
f3();

View File

@ -6,6 +6,7 @@ function f1() {
"2"; "2";
/* tail */ /* tail */
} }
f1();
function f2() { function f2() {
// head // head
@ -14,6 +15,7 @@ function f2() {
"2"; "2";
// tail // tail
} }
f2();
function f3() { function f3() {
if ("1") { // begin block if ("1") { // begin block
@ -24,3 +26,4 @@ function f3() {
"4"; "4";
} }
} }
f3();

View File

@ -1,14 +1,18 @@
function f1() {} function f1() {}
f1();
function f2() { function f2() {
return 1; return 1;
} }
f2();
function f3() { function f3() {
var i = 0; var i = 0;
throw "test"; throw "test";
} }
f3();
function f4() { function f4() {
var i = 0; var i = 0;
} }
f4();
var obj = { var obj = {
method1() {}, method1() {},
method2() {} method2() {}

View File

@ -2,17 +2,20 @@ function f1() {
return; return;
var i = 0; var i = 0;
} }
f1();
function f2() { function f2() {
return 1; return 1;
var i = 0; var i = 0;
} }
f2();
function f3() { function f3() {
var i = 0; var i = 0;
throw "test"; throw "test";
var j = 0; var j = 0;
} }
f3();
function f4() { function f4() {
var i = 0; var i = 0;
@ -22,6 +25,7 @@ function f4() {
throw "test"; throw "test";
var j = 0; var j = 0;
} }
f4();
var obj = { var obj = {
method1() { return; var i = 0; }, method1() { return; var i = 0; },

View File

@ -16,3 +16,4 @@ if ('1') {
function f1() { function f1() {
"1"; "1";
} }
f1();

View File

@ -32,3 +32,4 @@ function f1() {
"2"; "2";
} }
} }
f1();

View File

@ -1,4 +0,0 @@
const wasmUrl = new URL(
/*webpackIgnore: true*/
/*@vite-ignore*/
"qwerty.wasm", import.meta.url);

View File

@ -1 +0,0 @@
const wasmUrl = new URL("qwerty.wasm" , import.meta.url);

View File

@ -0,0 +1,5 @@
function usedByUsed() {}
function used() {
usedByUsed();
}
used();

View File

@ -0,0 +1,14 @@
function usedByUsed() {}
function usedByUnused() {}
function usedByRemovedCode() {}
function used() {
usedByUsed();
return;
usedByRemovedCode();
}
function unused() {
usedByUnused();
}
used();

View File

@ -1,9 +1,8 @@
import * as builder from "./builder.mjs"; import * as builder from "./builder.mjs";
import { fileURLToPath } from "url";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = import.meta.dirname;
let errors = 0; let errors = 0;

View File

@ -1,9 +1,8 @@
import { fileURLToPath } from "url";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { preprocessPDFJSCode } from "./babel-plugin-pdfjs-preprocessor.mjs"; import { preprocessPDFJSCode } from "./babel-plugin-pdfjs-preprocessor.mjs";
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = import.meta.dirname;
let errors = 0; let errors = 0;

40
external/ccov/coverage_format.mjs vendored Normal file
View File

@ -0,0 +1,40 @@
/* Copyright 2026 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const COVERAGE_FORMAT_TO_REPORTER = {
info: "lcovonly",
html: "html",
json: "json",
text: "text",
cobertura: "cobertura",
clover: "clover",
};
function parseCoverageFormats(str) {
const formats = new Set();
for (const fmt of (str ?? "").split(",")) {
const name = fmt.trim();
if (name && COVERAGE_FORMAT_TO_REPORTER[name]) {
formats.add(name);
} else if (name) {
console.warn(
`### Unknown coverage format "${name}", valid values: ${Object.keys(COVERAGE_FORMAT_TO_REPORTER).join(", ")}`
);
}
}
return formats.size > 0 ? formats : new Set(["info"]);
}
export { COVERAGE_FORMAT_TO_REPORTER, parseCoverageFormats };

110
external/ccov/coverage_search.mjs vendored Normal file
View File

@ -0,0 +1,110 @@
/* Copyright 2026 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fs from "fs";
import { parseArgs } from "node:util";
import path from "path";
const __dirname = import.meta.dirname;
const PROJECT_ROOT = path.join(__dirname, "../..");
const { values } = parseArgs({
args: process.argv.slice(2),
options: {
code: { type: "string" },
"coverage-dir": { type: "string", default: "build/coverage" },
help: { type: "boolean", short: "h", default: false },
},
});
if (values.help || !values.code) {
console.log(
"Usage: coverage_search.mjs --code=<file>::<line|function> [--coverage-dir=<path>]\n\n" +
" --code Source file and line number or function name to search for.\n" +
" Examples:\n" +
" --code=canvas.js::205\n" +
" --code=canvas.js::drawImageAtIntegerCoords\n" +
" --coverage-dir Coverage directory containing per-test-index.json [build/coverage]\n\n" +
"Prints to stdout the IDs of tests whose coverage includes the given line or\n" +
"function (one ID per line).\n" +
"Run browsertest with --coverage-per-test first to generate the index."
);
process.exit(values.help ? 0 : 1);
}
const sep = values.code.indexOf("::");
if (sep === -1) {
console.error(
"Error: --code must be in format 'file.js::line_or_function', e.g. canvas.js::205"
);
process.exit(1);
}
const fileName = values.code.slice(0, sep);
const location = values.code.slice(sep + 2);
const isLine = /^\d+$/.test(location);
const lineNum = isLine ? parseInt(location, 10) : null;
const funcName = isLine ? null : location;
const coverageDir = path.isAbsolute(values["coverage-dir"])
? values["coverage-dir"]
: path.join(PROJECT_ROOT, values["coverage-dir"]);
const indexPath = path.join(coverageDir, "per-test-index.json");
if (!fs.existsSync(indexPath)) {
console.error(`Error: index file not found: ${indexPath}`);
console.error("Run browsertest with --coverage-per-test first.");
process.exit(1);
}
const { ids, files } = JSON.parse(fs.readFileSync(indexPath, "utf8"));
// Find the file entry whose path matches fileName.
let fileEntry = null;
for (const [filePath, entry] of Object.entries(files)) {
if (
filePath === fileName ||
filePath.endsWith(`/${fileName}`) ||
filePath.endsWith(`\\${fileName}`)
) {
fileEntry = entry;
break;
}
}
if (!fileEntry) {
process.exit(0);
}
let testIndices = null;
if (lineNum !== null) {
// Direct line lookup.
testIndices = fileEntry.l?.[lineNum];
// If no hit, check whether lineNum is a function declaration start and
// redirect to that function's coverage.
if (!testIndices && fileEntry.fstarts?.[lineNum]) {
testIndices = fileEntry.f?.[fileEntry.fstarts[lineNum]];
}
} else {
testIndices = fileEntry.f?.[funcName];
}
if (testIndices) {
for (const idx of testIndices) {
console.log(ids[idx]);
}
}

190
external/check_l10n/check_l10n.mjs vendored Normal file
View File

@ -0,0 +1,190 @@
#!/usr/bin/env node
/* Copyright 2026 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Checks that every message ID defined in l10n/en-US/viewer.ftl is referenced
* in at least one HTML or JS/MJS file under the web/ directory.
*
* Usage: node external/check_l10n/check_l10n.mjs
*/
import { extname, join } from "path";
import { readdirSync, readFileSync, statSync } from "fs";
const ROOT = join(import.meta.dirname, "..", "..");
const FTL_PATH = join(ROOT, "l10n", "en-US", "viewer.ftl");
const SEARCH_DIRS = ["web", "src"];
const SEARCH_EXTENSIONS = new Set([".html", ".js", ".mjs"]);
// Minimum number of characters a prefix or suffix fragment must have to be
// considered a meaningful match when detecting dynamically-built IDs.
const MIN_FRAGMENT_LENGTH = 6;
/**
* Extract all message IDs from a Fluent (.ftl) file.
* A message ID is an identifier at the start of a line followed by " =".
* @param {string} ftlPath - Absolute path to the .ftl file.
* @returns {string[]} Ordered list of message IDs.
*/
function extractFtlIds(ftlPath) {
const lines = readFileSync(ftlPath, "utf8").split("\n");
const ids = [];
for (const line of lines) {
const match = line.match(/^([a-z][a-z0-9-]*)\s*=/i);
if (match) {
ids.push(match[1]);
}
}
return ids;
}
/**
* Recursively collect all files with matching extensions under a directory.
* @param {string} dir - Directory to walk.
* @param {Set<string>} extensions - Allowed file extensions (e.g. `".js"`).
* @returns {string[]} Absolute paths of matching files.
*/
function collectFiles(dir, extensions) {
const results = [];
for (const entry of readdirSync(dir)) {
const fullPath = join(dir, entry);
const stat = statSync(fullPath);
if (stat.isDirectory()) {
results.push(...collectFiles(fullPath, extensions));
} else if (extensions.has(extname(entry))) {
results.push(fullPath);
}
}
return results;
}
/**
* Load the contents of all source files found under the given directories.
* @param {string[]} dirs - Directory names relative to ROOT.
* @param {Set<string>} extensions - Allowed file extensions.
* @returns {{ path: string, content: string }[]}
*/
function loadSources(dirs, extensions) {
const files = dirs.flatMap(d => collectFiles(join(ROOT, d), extensions));
return files.map(f => ({ path: f, content: readFileSync(f, "utf8") }));
}
/**
* Check whether a message ID appears as a quoted string literal in any source
* file. Handles double quotes, single quotes, and backticks, covering:
* - `data-l10n-id="pdfjs-foo"` (HTML attribute)
* - `"pdfjs-foo"` / `'pdfjs-foo'` / `` `pdfjs-foo` `` (JS string literals,
* `setAttribute`, `l10n.get`, )
* @param {string} id - Message ID to look up.
* @param {{ path: string, content: string }[]} sources
* @returns {boolean}
*/
function isUsed(id, sources) {
const dq = `"${id}"`;
const sq = `'${id}'`;
const bt = `\`${id}\``;
return sources.some(
({ content }) =>
content.includes(dq) || content.includes(sq) || content.includes(bt)
);
}
/**
* For IDs not found as complete literals, check whether the ID is likely
* constructed dynamically via a template literal such as:
* `pdfjs-editor-${editorType}-added-alert`
*
* Strategy: try every (prefix, suffix) pair obtained by splitting the ID's
* dash-separated components, leaving one or more components as the "variable"
* gap. The prefix must appear immediately followed by `${` in a template
* literal; the suffix (if non-empty) must also appear in the same file.
* Minimum length guards prevent matches on trivially short fragments.
*
* @param {string} id - Message ID to test.
* @param {{ path: string, content: string }[]} sources
* @returns {{ path: string, line: number } | null} Location of the first
* matching template literal, or `null` if none found.
*/
function findDynamicLocation(id, sources) {
const parts = id.split("-");
// i = end of prefix (exclusive), j = start of suffix (inclusive)
for (let i = 1; i < parts.length; i++) {
for (let j = i + 1; j <= parts.length; j++) {
const prefix = parts.slice(0, i).join("-") + "-"; // e.g. "pdfjs-editor-"
const suffix = j < parts.length ? "-" + parts.slice(j).join("-") : ""; // e.g. "-added-alert"
if (prefix.length < MIN_FRAGMENT_LENGTH) {
continue;
}
if (suffix !== "" && suffix.length < MIN_FRAGMENT_LENGTH) {
continue;
}
// The prefix must be immediately followed by "${" in a template literal.
const prefixWithVar = prefix + "${";
for (const { path, content } of sources) {
if (
content.includes(prefixWithVar) &&
(suffix === "" || content.includes(suffix))
) {
const idx = content.indexOf(prefixWithVar);
const line = content.slice(0, idx).split("\n").length;
return { path, line };
}
}
}
}
return null;
}
function main() {
const ids = extractFtlIds(FTL_PATH);
console.log(`Found ${ids.length} message IDs in viewer.ftl\n`);
const sources = loadSources(SEARCH_DIRS, SEARCH_EXTENSIONS);
console.log(
`Searching in ${sources.length} files under: ${SEARCH_DIRS.join(", ")}\n`
);
const notFound = ids.filter(id => !isUsed(id, sources));
const dynamicEntries = notFound
.map(id => ({ id, loc: findDynamicLocation(id, sources) }))
.filter(({ loc }) => loc !== null);
const dynamicIds = new Set(dynamicEntries.map(({ id }) => id));
const unused = notFound.filter(id => !dynamicIds.has(id));
if (dynamicEntries.length > 0) {
console.log(
`~ ${dynamicEntries.length} ID(s) likely built dynamically (template literals):\n`
);
for (const { id, loc } of dynamicEntries) {
const rel = loc.path.replace(ROOT + "/", "").replace(ROOT + "\\", "");
console.log(` ${id}`);
console.log(`${rel}:${loc.line}`);
}
console.log();
}
if (unused.length === 0) {
console.log("✓ All remaining message IDs are used.");
} else {
console.log(`${unused.length} unused message ID(s):\n`);
for (const id of unused) {
console.log(` ${id}`);
}
process.exitCode = 1;
}
}
main();

270
external/chromium/prefs.mjs vendored Normal file
View File

@ -0,0 +1,270 @@
/* Copyright 2026 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const prefsMetadata = {
annotationEditorMode: {
enum: [-1, 0, 3, 15],
},
annotationMode: {
enum: [0, 1, 2, 3],
},
cursorToolOnLoad: {
title: "Cursor tool on load",
description:
"The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.",
enum: [0, 1],
},
defaultZoomDelay: {
title: "Default zoom delay",
description: "Delay (in ms) to wait before redrawing the canvas.",
},
defaultZoomValue: {
title: "Default zoom level",
description:
"Default zoom level of the viewer. Accepted values: 'auto', 'page-actual', 'page-width', 'page-height', 'page-fit', or a zoom level in percents.",
pattern:
"|auto|page-actual|page-width|page-height|page-fit|[0-9]+\\.?[0-9]*(,[0-9]+\\.?[0-9]*){0,2}",
},
disableFontFace: {
title: "Disable @font-face",
description:
"Whether to disable @font-face and fall back to canvas rendering (this is more resource-intensive).",
},
disableRange: {
title: "Disable range requests",
description: "Whether to disable range requests (not recommended).",
},
disableStream: {
title: "Disable streaming for requests",
description: "Whether to disable streaming for requests (not recommended).",
},
disableTelemetry: {
title: "Disable telemetry",
description:
"Whether to prevent the extension from reporting the extension and browser version to the extension developers.",
},
enableAutoLinking: {
description: "Enable creation of hyperlinks from text that look like URLs.",
},
enableComment: {
description: "Enable creation of comment annotations.",
},
enableHWA: {
title: "Enable hardware acceleration",
description: "Whether to enable hardware acceleration.",
},
enableOptimizedPartialRendering: {
description:
"Enable tracking of PDF operations to optimize partial rendering.",
},
enablePrintAutoRotate: {
title: "Automatically rotate printed pages",
description: "When enabled, landscape pages are rotated when printed.",
},
enableScripting: {
title: "Enable active content (JavaScript) in PDFs",
description:
"Whether to allow execution of active content (JavaScript) by PDF files.",
},
externalLinkTarget: {
title: "External links target window",
description:
"Controls how external links will be opened.\n 0 = default.\n 1 = replaces current window.\n 2 = new window/tab.\n 3 = parent.\n 4 = in top window.",
enum: [0, 1, 2, 3, 4],
},
forcePageColors: {
description:
"When enabled, the pdf rendering will use the high contrast mode colors",
},
ignoreDestinationZoom: {
title: "Ignore the zoom argument in destinations",
description:
"When enabled it will maintain the currently active zoom level, rather than letting the PDF document modify it, when navigating to internal destinations.",
},
pageColorsBackground: {
description:
"The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
},
pageColorsForeground: {
description:
"The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
},
pdfBugEnabled: {
title: "Enable debugging tools",
description: "Whether to enable debugging tools.",
},
scrollModeOnLoad: {
title: "Scroll mode on load",
description:
"Controls how the viewer scrolls upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = Vertical scrolling.\n 1 = Horizontal scrolling.\n 2 = Wrapped scrolling.\n 3 = Page scrolling.",
enum: [-1, 0, 1, 2, 3],
},
sidebarViewOnLoad: {
title: "Sidebar state on load",
description:
"Controls the state of the sidebar upon load.\n -1 = Default (uses PageMode if available, otherwise the last position if available/enabled).\n 0 = Do not show sidebar.\n 1 = Show thumbnails in sidebar.\n 2 = Show document outline in sidebar.\n 3 = Show attachments in sidebar.",
enum: [-1, 0, 1, 2, 3],
},
spreadModeOnLoad: {
title: "Spread mode on load",
description:
"Whether the viewer should join pages into spreads upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = No spreads.\n 1 = Odd spreads.\n 2 = Even spreads.",
enum: [-1, 0, 1, 2],
},
textLayerMode: {
title: "Text layer mode",
description:
"Controls if the text layer is enabled, and the selection mode that is used.\n 0 = Disabled.\n 1 = Enabled.",
enum: [0, 1],
},
viewerCssTheme: {
title: "Theme",
description:
"The theme to use.\n0 = Use system theme.\n1 = Light theme.\n2 = Dark theme.",
enum: [0, 1, 2],
},
viewOnLoad: {
title: "View position on load",
description:
"The position in the document upon load.\n -1 = Default (uses OpenAction if available, otherwise equal to `viewOnLoad = 0`).\n 0 = The last viewed page/position.\n 1 = The initial page/position.",
enum: [-1, 0, 1],
},
};
// Deprecated keys are allowed in the managed preferences file.
// The code maintainer is responsible for adding migration logic to
// extensions/chromium/options/migration.js and web/chromecom.js .
const deprecatedPrefs = {
disablePageMode: {
description: "DEPRECATED.",
type: "boolean",
default: false,
},
disableTextLayer: {
description:
"DEPRECATED. Set textLayerMode to 0 to disable the text selection layer by default.",
type: "boolean",
default: false,
},
enableHandToolOnLoad: {
description:
"DEPRECATED. Set cursorToolOnLoad to 1 to enable the hand tool by default.",
type: "boolean",
default: false,
},
showPreviousViewOnLoad: {
description:
"DEPRECATED. Set viewOnLoad to 1 to disable showing the last page/position on load.",
type: "boolean",
default: true,
},
};
function buildPrefsSchema(prefs) {
const properties = Object.create(null);
for (const name in prefs) {
const pref = prefs[name];
let type = typeof pref;
switch (type) {
case "boolean":
case "string":
break;
case "number":
type = "integer";
break;
default:
throw new Error(`Invalid type (${type}) for "${name}"-preference.`);
}
const metadata = prefsMetadata[name];
if (metadata) {
let numMetadataKeys = 0;
// Do some (very basic) validation of the metadata.
for (const key in metadata) {
const entry = metadata[key];
switch (key) {
case "default":
case "type":
throw new Error(
`Invalid key (${key}) in metadata for "${name}"-preference.`
);
case "description":
if (entry.startsWith("DEPRECATED.")) {
throw new Error(
`The \`description\` of the "${name}"-preference cannot begin with "DEPRECATED."`
);
}
break;
}
numMetadataKeys++;
}
if (numMetadataKeys === 0) {
throw new Error(
`No metadata for "${name}"-preference, remove the entry.`
);
}
}
properties[name] = {
type,
default: pref,
...metadata,
};
}
for (const name in prefsMetadata) {
if (!properties[name]) {
// Do *not* throw here, since keeping the metadata up-to-date should be
// the responsibility of the CHROMIUM-addon maintainer.
console.error(
`The "${name}"-preference was removed, add it to \`deprecatedPrefs\` instead.\n`
);
}
}
for (const name in deprecatedPrefs) {
const entry = deprecatedPrefs[name];
if (properties[name]) {
throw new Error(
`The "${name}"-preference should not be listed as deprecated.`
);
}
if (!entry.description?.startsWith("DEPRECATED.")) {
throw new Error(
`The \`description\` of the deprecated "${name}"-preference must begin with "DEPRECATED."`
);
}
for (const key of ["default", "type"]) {
if (key in entry) {
continue;
}
throw new Error(
`A \`${key}\` entry must be provided for the deprecated "${name}"-preference.`
);
}
properties[name] = entry;
}
return {
type: "object",
properties,
};
}
export { buildPrefsSchema };

View File

@ -14,7 +14,7 @@
*/ */
function parseAdobeCMap(content) { function parseAdobeCMap(content) {
let m = /(\bbegincmap\b[\s\S]*?)\bendcmap\b/.exec(content); let m = /(\bbegincmap\b[\s\S]+?)\bendcmap\b/.exec(content);
if (!m) { if (!m) {
throw new Error("cmap was not found"); throw new Error("cmap was not found");
} }
@ -37,7 +37,7 @@ function parseAdobeCMap(content) {
result.usecmap = m[1]; result.usecmap = m[1];
} }
const re = const re =
/(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g; /(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(?:endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
while ((m = re.exec(body))) { while ((m = re.exec(body))) {
const lines = m[3].toLowerCase().split("\n"); const lines = m[3].toLowerCase().split("\n");

View File

@ -0,0 +1,118 @@
/**
* ESLint rule to prefer `MathClamp(v, min, max)` over nested
* `Math.min(Math.max(...), ...)` / `Math.max(Math.min(...), ...)` patterns.
*
* Detected patterns and their fixes:
* Math.min(Math.max(A, B), C) MathClamp(A, B, C)
* Math.min(C, Math.max(A, B)) MathClamp(A, B, C)
* Math.max(Math.min(A, B), C) MathClamp(A, C, B)
* Math.max(C, Math.min(A, B)) MathClamp(A, C, B)
*/
function isMathCall(node, method) {
return (
node.type === "CallExpression" &&
node.callee.type === "MemberExpression" &&
!node.callee.computed &&
node.callee.object.type === "Identifier" &&
node.callee.object.name === "Math" &&
node.callee.property.type === "Identifier" &&
node.callee.property.name === method &&
node.arguments.length === 2 &&
node.arguments.every(a => a.type !== "SpreadElement")
);
}
// Returns true if node is a Math.min or Math.max call.
function isMathMinMax(node) {
return isMathCall(node, "min") || isMathCall(node, "max");
}
const preferMathClampRule = {
meta: {
type: "suggestion",
fixable: "code",
docs: {
description:
"Prefer MathClamp(v, min, max) over nested Math.min/Math.max",
},
messages: {
useClamp:
"Use MathClamp(v, min, max) instead of nested Math.min/Math.max.",
},
schema: [],
},
create(context) {
const src = context.sourceCode ?? context.getSourceCode();
return {
CallExpression(node) {
// Pattern: Math.min(Math.max(A, B), C) or Math.min(C, Math.max(A, B)).
// Fix as MathClamp(A, B, C) where A,B are inner args, C is outer arg.
if (isMathCall(node, "min")) {
const [arg0, arg1] = node.arguments;
let outerArg, innerNode;
// Math.max(Math.min(A, B), Math.min(C, D)) isn't a clamp pattern, so
// require the outer arg to not be a min/max call.
if (isMathCall(arg0, "max") && !isMathMinMax(arg1)) {
innerNode = arg0;
outerArg = arg1;
} else if (isMathCall(arg1, "max") && !isMathMinMax(arg0)) {
innerNode = arg1;
outerArg = arg0;
} else {
return;
}
const v = src.getText(innerNode.arguments[0]);
const min = src.getText(innerNode.arguments[1]);
const max = src.getText(outerArg);
context.report({
node,
messageId: "useClamp",
fix(fixer) {
return fixer.replaceText(node, `MathClamp(${v}, ${min}, ${max})`);
},
});
}
// Pattern: Math.max(Math.min(A, B), C) or Math.max(C, Math.min(A, B)).
// Fix as MathClamp(A, C, B) where A,B are inner args, C is outer arg.
if (isMathCall(node, "max")) {
const [arg0, arg1] = node.arguments;
let outerArg, innerNode;
if (isMathCall(arg0, "min") && !isMathMinMax(arg1)) {
innerNode = arg0;
outerArg = arg1;
} else if (isMathCall(arg1, "min") && !isMathMinMax(arg0)) {
innerNode = arg1;
outerArg = arg0;
} else {
return;
}
const v = src.getText(innerNode.arguments[0]);
const max = src.getText(innerNode.arguments[1]);
const min = src.getText(outerArg);
context.report({
node,
messageId: "useClamp",
fix(fixer) {
return fixer.replaceText(node, `MathClamp(${v}, ${min}, ${max})`);
},
});
}
},
};
},
};
export default {
rules: {
"prefer-math-clamp": preferMathClampRule,
},
};

0
external/iccs/CGATS001Compat-v2-micro.icc vendored Executable file → Normal file
View File

View File

@ -31,7 +31,7 @@ async function downloadLanguageCodes() {
console.log("Downloading language codes...\n"); console.log("Downloading language codes...\n");
const ALL_LOCALES = const ALL_LOCALES =
"https://raw.githubusercontent.com/mozilla/gecko-dev/master/browser/locales/all-locales"; "https://raw.githubusercontent.com/mozilla-firefox/firefox/main/browser/locales/all-locales";
const response = await fetch(ALL_LOCALES); const response = await fetch(ALL_LOCALES);
if (!response.ok) { if (!response.ok) {
@ -91,7 +91,7 @@ async function downloadL10n(root) {
await downloadLanguageFiles(root, langCode); await downloadLanguageFiles(root, langCode);
} }
const removeCodes = []; const rmCodes = [];
for (const entry of fs.readdirSync(root)) { for (const entry of fs.readdirSync(root)) {
const dirPath = path.join(root, entry), const dirPath = path.join(root, entry),
stat = fs.lstatSync(dirPath); stat = fs.lstatSync(dirPath);
@ -101,14 +101,13 @@ async function downloadL10n(root) {
entry !== DEFAULT_LOCALE && entry !== DEFAULT_LOCALE &&
!langCodes.includes(entry) !langCodes.includes(entry)
) { ) {
removeCodes.push(entry); fs.rmSync(dirPath, { recursive: true, force: true });
rmCodes.push(entry);
} }
} }
if (removeCodes.length) { if (rmCodes.length) {
console.log( console.log(
"\nConsider removing the following unmaintained locales:\n" + `\nRemoved the following unmaintained locales: ${rmCodes.join(", ")}\n`
removeCodes.join(", ") +
"\n"
); );
} }
} }

196
external/jbig2/LICENSE_JBIG2 vendored Normal file
View File

@ -0,0 +1,196 @@
// Copyright 2014 The PDFium Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

13
external/jbig2/LICENSE_PDFJS_JBIG2 vendored Normal file
View File

@ -0,0 +1,13 @@
Copyright 2026 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

12
external/jbig2/README.md vendored Normal file
View File

@ -0,0 +1,12 @@
## Build
In order to generate the file `jbig2.js`:
* git clone https://github.com/mozilla/pdf.js.jbig2/
* the build requires to have a [Docker](https://www.docker.com/) setup and then:
* `node build.js -C` to build the Docker image
* `node build.js -co /pdf.js/external/jbig2/` to compile the decoder
## Licensing
[PDFium](https://pdfium.googlesource.com/pdfium/) is under [Apache-2.0](https://pdfium.googlesource.com/pdfium/+/main/LICENSE)
and [pdf.js.jbig2](https://github.com/mozilla/pdf.js.jbig2/) is released under [Apache-2.0](https://github.com/mozilla/pdf.js.jbig2/blob/main/LICENSE) license so `jbig2.js` is released under [Apache-2.0](https://github.com/mozilla/pdf.js.jbig2/blob/main/LICENSE) license too.

3
external/jbig2/jbig2.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
external/jbig2/jbig2.wasm vendored Normal file

Binary file not shown.

15
external/jbig2/jbig2_nowasm_fallback.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

300
external/qcms/qcms.js vendored
View File

@ -1,34 +1,29 @@
/* THIS FILE IS GENERATED - DO NOT EDIT */ /* THIS FILE IS GENERATED - DO NOT EDIT */
import { copy_result, copy_rgb } from './qcms_utils.js'; import { copy_result, copy_rgb, make_cssRGB } from './qcms_utils.js';
let wasm;
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); /**
* @enum {0 | 1 | 2 | 3 | 4 | 5}
*/
export const DataType = Object.freeze({
RGB8: 0, "0": "RGB8",
RGBA8: 1, "1": "RGBA8",
BGRA8: 2, "2": "BGRA8",
Gray8: 3, "3": "Gray8",
GrayA8: 4, "4": "GrayA8",
CMYK: 5, "5": "CMYK",
});
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; /**
* @enum {0 | 1 | 2 | 3}
*/
export const Intent = Object.freeze({
Perceptual: 0, "0": "Perceptual",
RelativeColorimetric: 1, "1": "RelativeColorimetric",
Saturation: 2, "2": "Saturation",
AbsoluteColorimetric: 3, "3": "AbsoluteColorimetric",
});
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
let WASM_VECTOR_LEN = 0;
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/** /**
* # Safety * # Safety
* *
@ -42,30 +37,6 @@ export function qcms_convert_array(transformer, src) {
wasm.qcms_convert_array(transformer, ptr0, len0); wasm.qcms_convert_array(transformer, ptr0, len0);
} }
/**
* # Safety
*
* This function is called directly from JavaScript.
* @param {number} transformer
* @param {number} src
*/
export function qcms_convert_one(transformer, src) {
wasm.qcms_convert_one(transformer, src);
}
/**
* # Safety
*
* This function is called directly from JavaScript.
* @param {number} transformer
* @param {number} src1
* @param {number} src2
* @param {number} src3
*/
export function qcms_convert_three(transformer, src1, src2, src3) {
wasm.qcms_convert_three(transformer, src1, src2, src3);
}
/** /**
* # Safety * # Safety
* *
@ -75,9 +46,46 @@ export function qcms_convert_three(transformer, src1, src2, src3) {
* @param {number} src2 * @param {number} src2
* @param {number} src3 * @param {number} src3
* @param {number} src4 * @param {number} src4
* @param {boolean} css
*/ */
export function qcms_convert_four(transformer, src1, src2, src3, src4) { export function qcms_convert_four(transformer, src1, src2, src3, src4, css) {
wasm.qcms_convert_four(transformer, src1, src2, src3, src4); wasm.qcms_convert_four(transformer, src1, src2, src3, src4, css);
}
/**
* # Safety
*
* This function is called directly from JavaScript.
* @param {number} transformer
* @param {number} src
* @param {boolean} css
*/
export function qcms_convert_one(transformer, src, css) {
wasm.qcms_convert_one(transformer, src, css);
}
/**
* # Safety
*
* This function is called directly from JavaScript.
* @param {number} transformer
* @param {number} src1
* @param {number} src2
* @param {number} src3
* @param {boolean} css
*/
export function qcms_convert_three(transformer, src1, src2, src3, css) {
wasm.qcms_convert_three(transformer, src1, src2, src3, css);
}
/**
* # Safety
*
* This function is called directly from JavaScript.
* @param {number} transformer
*/
export function qcms_drop_transformer(transformer) {
wasm.qcms_drop_transformer(transformer);
} }
/** /**
@ -95,114 +103,122 @@ export function qcms_transformer_from_memory(mem, in_type, intent) {
const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent); const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent);
return ret >>> 0; return ret >>> 0;
} }
/**
* # Safety
*
* This function is called directly from JavaScript.
* @param {number} transformer
*/
export function qcms_drop_transformer(transformer) {
wasm.qcms_drop_transformer(transformer);
}
/**
* @enum {0 | 1 | 2 | 3 | 4 | 5}
*/
export const DataType = Object.freeze({
RGB8: 0, "0": "RGB8",
RGBA8: 1, "1": "RGBA8",
BGRA8: 2, "2": "BGRA8",
Gray8: 3, "3": "Gray8",
GrayA8: 4, "4": "GrayA8",
CMYK: 5, "5": "CMYK",
});
/**
* @enum {0 | 1 | 2 | 3}
*/
export const Intent = Object.freeze({
Perceptual: 0, "0": "Perceptual",
RelativeColorimetric: 1, "1": "RelativeColorimetric",
Saturation: 2, "2": "Saturation",
AbsoluteColorimetric: 3, "3": "AbsoluteColorimetric",
});
async function __wbg_load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
if (module.headers.get('Content-Type') != 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else {
throw e;
}
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
}
function __wbg_get_imports() { function __wbg_get_imports() {
const imports = {}; const import0 = {
imports.wbg = {}; __proto__: null,
imports.wbg.__wbg_copyresult_b08ee7d273f295dd = function(arg0, arg1) { __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
},
__wbg_copy_result_0d15f3bf9d9012ae: function(arg0, arg1) {
copy_result(arg0 >>> 0, arg1 >>> 0); copy_result(arg0 >>> 0, arg1 >>> 0);
}; },
imports.wbg.__wbg_copyrgb_d60ce17bb05d9b67 = function(arg0) { __wbg_copy_rgb_0106d9d9464fce43: function(arg0) {
copy_rgb(arg0 >>> 0); copy_rgb(arg0 >>> 0);
}; },
imports.wbg.__wbindgen_init_externref_table = function() { __wbg_make_cssRGB_8e24b34f71f5363e: function(arg0) {
const table = wasm.__wbindgen_export_0; make_cssRGB(arg0 >>> 0);
},
__wbindgen_init_externref_table: function() {
const table = wasm.__wbindgen_externrefs;
const offset = table.grow(4); const offset = table.grow(4);
table.set(0, undefined); table.set(0, undefined);
table.set(offset + 0, undefined); table.set(offset + 0, undefined);
table.set(offset + 1, null); table.set(offset + 1, null);
table.set(offset + 2, true); table.set(offset + 2, true);
table.set(offset + 3, false); table.set(offset + 3, false);
; },
}; };
imports.wbg.__wbindgen_throw = function(arg0, arg1) { return {
throw new Error(getStringFromWasm0(arg0, arg1)); __proto__: null,
"./qcms_bg.js": import0,
}; };
return imports;
} }
function __wbg_init_memory(imports, memory) { function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return decodeText(ptr, len);
} }
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
const MAX_SAFARI_DECODE_BYTES = 2146435072;
let numBytesDecoded = 0;
function decodeText(ptr, len) {
numBytesDecoded += len;
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
numBytesDecoded = len;
}
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
let WASM_VECTOR_LEN = 0;
let wasmModule, wasm;
function __wbg_finalize_init(instance, module) { function __wbg_finalize_init(instance, module) {
wasm = instance.exports; wasm = instance.exports;
__wbg_init.__wbindgen_wasm_module = module; wasmModule = module;
cachedUint8ArrayMemory0 = null; cachedUint8ArrayMemory0 = null;
wasm.__wbindgen_start(); wasm.__wbindgen_start();
return wasm; return wasm;
} }
async function __wbg_load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
const validResponse = module.ok && expectedResponseType(module.type);
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else { throw e; }
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
function expectedResponseType(type) {
switch (type) {
case 'basic': case 'cors': case 'default': return true;
}
return false;
}
}
function initSync(module) { function initSync(module) {
if (wasm !== undefined) return wasm; if (wasm !== undefined) return wasm;
if (typeof module !== 'undefined') { if (module !== undefined) {
if (Object.getPrototypeOf(module) === Object.prototype) { if (Object.getPrototypeOf(module) === Object.prototype) {
({module} = module) ({module} = module)
} else { } else {
@ -211,15 +227,10 @@ function initSync(module) {
} }
const imports = __wbg_get_imports(); const imports = __wbg_get_imports();
__wbg_init_memory(imports);
if (!(module instanceof WebAssembly.Module)) { if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module); module = new WebAssembly.Module(module);
} }
const instance = new WebAssembly.Instance(module, imports); const instance = new WebAssembly.Instance(module, imports);
return __wbg_finalize_init(instance, module); return __wbg_finalize_init(instance, module);
} }
@ -227,7 +238,7 @@ async function __wbg_init(module_or_path) {
if (wasm !== undefined) return wasm; if (wasm !== undefined) return wasm;
if (typeof module_or_path !== 'undefined') { if (module_or_path !== undefined) {
if (Object.getPrototypeOf(module_or_path) === Object.prototype) { if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
({module_or_path} = module_or_path) ({module_or_path} = module_or_path)
} else { } else {
@ -235,21 +246,16 @@ async function __wbg_init(module_or_path) {
} }
} }
if (typeof module_or_path === 'undefined') {
module_or_path = new URL('qcms_bg.wasm', import.meta.url);
}
const imports = __wbg_get_imports(); const imports = __wbg_get_imports();
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
module_or_path = fetch(module_or_path); module_or_path = fetch(module_or_path);
} }
__wbg_init_memory(imports);
const { instance, module } = await __wbg_load(await module_or_path, imports); const { instance, module } = await __wbg_load(await module_or_path, imports);
return __wbg_finalize_init(instance, module); return __wbg_finalize_init(instance, module);
} }
export { initSync }; export { initSync, __wbg_init as default };
export default __wbg_init;

Binary file not shown.

View File

@ -14,41 +14,71 @@
*/ */
class QCMS { class QCMS {
static _module = null; static #memoryArray = null;
static _memory = null;
static _mustAddAlpha = false; static _mustAddAlpha = false;
static _destBuffer = null; static _destBuffer = null;
static _destOffset = 0;
static _destLength = 0;
static _cssColor = "";
static _makeHexColor = null;
static get _memoryArray() {
const array = this.#memoryArray;
if (array?.byteLength) {
return array;
}
return (this.#memoryArray = new Uint8Array(this._memory.buffer));
}
} }
function copy_result(ptr, len) { function copy_result(ptr, len) {
// This function is called from the wasm module (it's an external // This function is called from the wasm module (it's an external
// "C" function). Its goal is to copy the result from the wasm memory // "C" function). Its goal is to copy the result from the wasm memory
// to the destination buffer without any intermediate copies. // to the destination buffer without any intermediate copies.
const { _module, _mustAddAlpha, _destBuffer } = QCMS; const { _mustAddAlpha, _destBuffer, _destOffset, _destLength, _memoryArray } =
const result = new Uint8Array(_module.memory.buffer, ptr, len); QCMS;
if (result.length === _destBuffer.length) { if (len === _destLength) {
_destBuffer.set(result); _destBuffer.set(_memoryArray.subarray(ptr, ptr + len), _destOffset);
return; return;
} }
if (_mustAddAlpha) { if (_mustAddAlpha) {
for (let i = 0, j = 0, ii = result.length; i < ii; i += 3, j += 4) { for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
_destBuffer[j] = result[i]; _destBuffer[j] = _memoryArray[i];
_destBuffer[j + 1] = result[i + 1]; _destBuffer[j + 1] = _memoryArray[i + 1];
_destBuffer[j + 2] = result[i + 2]; _destBuffer[j + 2] = _memoryArray[i + 2];
_destBuffer[j + 3] = 255; _destBuffer[j + 3] = 255;
} }
} else { } else {
for (let i = 0, j = 0, ii = result.length; i < ii; i += 3, j += 4) { for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
_destBuffer[j] = result[i]; _destBuffer[j] = _memoryArray[i];
_destBuffer[j + 1] = result[i + 1]; _destBuffer[j + 1] = _memoryArray[i + 1];
_destBuffer[j + 2] = result[i + 2]; _destBuffer[j + 2] = _memoryArray[i + 2];
} }
} }
} }
function copy_rgb(ptr) { function copy_rgb(ptr) {
QCMS._destBuffer.set(new Uint8Array(QCMS._module.memory.buffer, ptr, 3)); const { _destBuffer, _destOffset, _memoryArray } = QCMS;
_destBuffer[_destOffset] = _memoryArray[ptr];
_destBuffer[_destOffset + 1] = _memoryArray[ptr + 1];
_destBuffer[_destOffset + 2] = _memoryArray[ptr + 2];
} }
export { copy_result, copy_rgb, QCMS }; function make_cssRGB(ptr) {
const { _memoryArray } = QCMS;
QCMS._cssColor = QCMS._makeHexColor(
_memoryArray[ptr],
_memoryArray[ptr + 1],
_memoryArray[ptr + 2]
);
}
export { copy_result, copy_rgb, make_cssRGB, QCMS };

File diff suppressed because one or more lines are too long

BIN
external/quickjs/quickjs-eval.wasm vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,108 @@
/* Copyright 2025 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { parse, registerWalkers, Root } from "postcss-values-parser";
import { isString } from "stylelint/lib/utils/validateTypes.mjs";
import stylelint from "stylelint";
const {
createPlugin,
utils: { report, validateOptions },
} = stylelint;
registerWalkers(Root);
const ruleName = "pdfjs/no-unused-custom-properties";
// It's a very basic linter: we don't take into account scopes.
// But it should be enough for our use case.
/** @type {import('stylelint').Plugin} */
const ruleFunction =
(enabled, { ignoreList = [] } = {}, context = {}) =>
(root, result) => {
const validOptions = validateOptions(
result,
ruleName,
{
actual: enabled,
possible: [true],
},
{
actual: ignoreList,
possible: [isString],
optional: true,
}
);
if (!validOptions) {
return;
}
ignoreList = ignoreList.map(s => (s.startsWith("--") ? s : `--${s}`));
const usedCustomProperties = new Set(ignoreList);
const definedCustomProperties = new Set();
const usedBy = new Map();
root.walkDecls(decl => {
let definingProperty = null;
if (decl.prop.startsWith("--")) {
// This is a custom property definition.
definingProperty = decl.prop;
definedCustomProperties.add(definingProperty);
}
// Parse the declaration value to find var() usages.
const parsedValue = parse(decl.value);
parsedValue.walkFuncs(node => {
if (!node.isVar || node.nodes.length === 0) {
return;
}
// This is a var() function; get the custom property name.
const property = node.nodes[0].value;
if (!definingProperty) {
// This is a usage of a custom property but not in a definition.
// width: var(--foo);
usedCustomProperties.add(property);
return;
}
let usages = usedBy.get(property);
if (!usages) {
usages = [];
usedBy.set(property, usages);
}
// Record that this custom property is used by the defining property.
// --foo: var(--bar);
// bar is really used only if foo is.
usages.push(definingProperty);
});
});
const isUsed = p =>
usedCustomProperties.has(p) || (usedBy.get(p) || []).some(isUsed);
for (const customProperty of definedCustomProperties) {
if (isUsed(customProperty)) {
continue;
}
report({
message: `Custom property "${customProperty}" is defined but never used.`,
node: root,
result,
ruleName,
});
}
};
ruleFunction.ruleName = ruleName;
export default createPlugin(ruleName, ruleFunction);

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
Most of the files in this folder (except for the `en-US` folder) have been + Only the translations for the `en-US` locale are maintained here.
imported from the Firefox Nightly branch;
please see https://hg.mozilla.org/l10n-central. Some of the files are + The translations for all other locales are imported automatically from Firefox. Please see https://mozilla-l10n.github.io/introduction/ for information about contributing.
licensed under the MPL license. You can obtain a copy of the license at
https://mozilla.org/MPL/2.0.

View File

@ -71,24 +71,12 @@ pdfjs-document-properties-button =
pdfjs-document-properties-button-label = Jami me gin acoya… pdfjs-document-properties-button-label = Jami me gin acoya…
pdfjs-document-properties-file-name = Nying pwail: pdfjs-document-properties-file-name = Nying pwail:
pdfjs-document-properties-file-size = Dit pa pwail: pdfjs-document-properties-file-size = Dit pa pwail:
# Variables:
# $size_kb (Number) - the PDF file size in kilobytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-kb = { $size_kb } KB ({ $size_b } bytes)
# Variables:
# $size_mb (Number) - the PDF file size in megabytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-mb = { $size_mb } MB ({ $size_b } bytes)
pdfjs-document-properties-title = Wiye: pdfjs-document-properties-title = Wiye:
pdfjs-document-properties-author = Ngat mucoyo: pdfjs-document-properties-author = Ngat mucoyo:
pdfjs-document-properties-subject = Subjek: pdfjs-document-properties-subject = Subjek:
pdfjs-document-properties-keywords = Lok mapire tek: pdfjs-document-properties-keywords = Lok mapire tek:
pdfjs-document-properties-creation-date = Nino dwe me cwec: pdfjs-document-properties-creation-date = Nino dwe me cwec:
pdfjs-document-properties-modification-date = Nino dwe me yub: pdfjs-document-properties-modification-date = Nino dwe me yub:
# Variables:
# $date (Date) - the creation/modification date of the PDF file
# $time (Time) - the creation/modification time of the PDF file
pdfjs-document-properties-date-string = { $date }, { $time }
pdfjs-document-properties-creator = Lacwec: pdfjs-document-properties-creator = Lacwec:
pdfjs-document-properties-producer = Layub PDF: pdfjs-document-properties-producer = Layub PDF:
pdfjs-document-properties-version = Kit PDF: pdfjs-document-properties-version = Kit PDF:
@ -185,9 +173,6 @@ pdfjs-page-scale-actual = Dite kikome
# $scale (Number) - percent value for page scale # $scale (Number) - percent value for page scale
pdfjs-page-scale-percent = { $scale }% pdfjs-page-scale-percent = { $scale }%
## PDF page
## Loading indicator messages ## Loading indicator messages
pdfjs-loading-error = Bal otime kun cano PDF. pdfjs-loading-error = Bal otime kun cano PDF.
@ -213,63 +198,3 @@ pdfjs-password-invalid = Mung me donyo pe atir. Tim ber i tem doki.
pdfjs-password-ok-button = OK pdfjs-password-ok-button = OK
pdfjs-password-cancel-button = Juki pdfjs-password-cancel-button = Juki
pdfjs-web-fonts-disabled = Kijuko dit pa coc me kakube woko: pe romo tic ki dit pa coc me PDF ma kiketo i kine. pdfjs-web-fonts-disabled = Kijuko dit pa coc me kakube woko: pe romo tic ki dit pa coc me PDF ma kiketo i kine.
## Editing
## Default editor aria labels
## Remove button for the various kind of editor.
##
## Alt-text dialog
## Editor resizers
## This is used in an aria label to help to understand the role of the resizer.
## Color picker
## Show all highlights
## This is a toggle button to show/hide all the highlights.
## New alt-text dialog
## Group note for entire feature: Alternative text (alt text) helps when people can't see the image. This feature includes a tool to create alt text automatically using an AI model that works locally on the user's device to preserve privacy.
## Image alt-text settings
## "Annotations removed" bar
## Add a signature dialog
## Tab names
## Tab panels
## Controls
## Dialog buttons
## Main menu for adding/removing signatures
## Editor toolbar
## Edit signature description dialog

View File

@ -71,37 +71,17 @@ pdfjs-document-properties-button =
pdfjs-document-properties-button-label = Dokumenteienskappe… pdfjs-document-properties-button-label = Dokumenteienskappe…
pdfjs-document-properties-file-name = Lêernaam: pdfjs-document-properties-file-name = Lêernaam:
pdfjs-document-properties-file-size = Lêergrootte: pdfjs-document-properties-file-size = Lêergrootte:
# Variables:
# $size_kb (Number) - the PDF file size in kilobytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-kb = { $size_kb } kG ({ $size_b } grepe)
# Variables:
# $size_mb (Number) - the PDF file size in megabytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-mb = { $size_mb } MG ({ $size_b } grepe)
pdfjs-document-properties-title = Titel: pdfjs-document-properties-title = Titel:
pdfjs-document-properties-author = Outeur: pdfjs-document-properties-author = Outeur:
pdfjs-document-properties-subject = Onderwerp: pdfjs-document-properties-subject = Onderwerp:
pdfjs-document-properties-keywords = Sleutelwoorde: pdfjs-document-properties-keywords = Sleutelwoorde:
pdfjs-document-properties-creation-date = Skeppingsdatum: pdfjs-document-properties-creation-date = Skeppingsdatum:
pdfjs-document-properties-modification-date = Wysigingsdatum: pdfjs-document-properties-modification-date = Wysigingsdatum:
# Variables:
# $date (Date) - the creation/modification date of the PDF file
# $time (Time) - the creation/modification time of the PDF file
pdfjs-document-properties-date-string = { $date }, { $time }
pdfjs-document-properties-creator = Skepper: pdfjs-document-properties-creator = Skepper:
pdfjs-document-properties-producer = PDF-vervaardiger: pdfjs-document-properties-producer = PDF-vervaardiger:
pdfjs-document-properties-version = PDF-weergawe: pdfjs-document-properties-version = PDF-weergawe:
pdfjs-document-properties-page-count = Aantal bladsye: pdfjs-document-properties-page-count = Aantal bladsye:
## Variables:
## $width (Number) - the width of the (current) page
## $height (Number) - the height of the (current) page
## $unit (String) - the unit of measurement of the (current) page
## $name (String) - the name of the (current) page
## $orientation (String) - the orientation of the (current) page
## ##
pdfjs-document-properties-close-button = Sluit pdfjs-document-properties-close-button = Sluit
@ -172,9 +152,6 @@ pdfjs-page-scale-actual = Werklike grootte
# $scale (Number) - percent value for page scale # $scale (Number) - percent value for page scale
pdfjs-page-scale-percent = { $scale }% pdfjs-page-scale-percent = { $scale }%
## PDF page
## Loading indicator messages ## Loading indicator messages
pdfjs-loading-error = 'n Fout het voorgekom met die laai van die PDF. pdfjs-loading-error = 'n Fout het voorgekom met die laai van die PDF.
@ -200,63 +177,3 @@ pdfjs-password-invalid = Ongeldige wagwoord. Probeer gerus weer.
pdfjs-password-ok-button = OK pdfjs-password-ok-button = OK
pdfjs-password-cancel-button = Kanselleer pdfjs-password-cancel-button = Kanselleer
pdfjs-web-fonts-disabled = Webfonte is gedeaktiveer: kan nie PDF-fonte wat ingebed is, gebruik nie. pdfjs-web-fonts-disabled = Webfonte is gedeaktiveer: kan nie PDF-fonte wat ingebed is, gebruik nie.
## Editing
## Default editor aria labels
## Remove button for the various kind of editor.
##
## Alt-text dialog
## Editor resizers
## This is used in an aria label to help to understand the role of the resizer.
## Color picker
## Show all highlights
## This is a toggle button to show/hide all the highlights.
## New alt-text dialog
## Group note for entire feature: Alternative text (alt text) helps when people can't see the image. This feature includes a tool to create alt text automatically using an AI model that works locally on the user's device to preserve privacy.
## Image alt-text settings
## "Annotations removed" bar
## Add a signature dialog
## Tab names
## Tab panels
## Controls
## Dialog buttons
## Main menu for adding/removing signatures
## Editor toolbar
## Edit signature description dialog

View File

@ -89,24 +89,12 @@ pdfjs-document-properties-button =
pdfjs-document-properties-button-label = Propiedatz d'o documento... pdfjs-document-properties-button-label = Propiedatz d'o documento...
pdfjs-document-properties-file-name = Nombre de fichero: pdfjs-document-properties-file-name = Nombre de fichero:
pdfjs-document-properties-file-size = Grandaria d'o fichero: pdfjs-document-properties-file-size = Grandaria d'o fichero:
# Variables:
# $size_kb (Number) - the PDF file size in kilobytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-kb = { $size_kb } KB ({ $size_b } bytes)
# Variables:
# $size_mb (Number) - the PDF file size in megabytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-mb = { $size_mb } MB ({ $size_b } bytes)
pdfjs-document-properties-title = Titol: pdfjs-document-properties-title = Titol:
pdfjs-document-properties-author = Autor: pdfjs-document-properties-author = Autor:
pdfjs-document-properties-subject = Afer: pdfjs-document-properties-subject = Afer:
pdfjs-document-properties-keywords = Parolas clau: pdfjs-document-properties-keywords = Parolas clau:
pdfjs-document-properties-creation-date = Calendata de creyación: pdfjs-document-properties-creation-date = Calendata de creyación:
pdfjs-document-properties-modification-date = Calendata de modificación: pdfjs-document-properties-modification-date = Calendata de modificación:
# Variables:
# $date (Date) - the creation/modification date of the PDF file
# $time (Time) - the creation/modification time of the PDF file
pdfjs-document-properties-date-string = { $date }, { $time }
pdfjs-document-properties-creator = Creyador: pdfjs-document-properties-creator = Creyador:
pdfjs-document-properties-producer = Creyador de PDF: pdfjs-document-properties-producer = Creyador de PDF:
pdfjs-document-properties-version = Versión de PDF: pdfjs-document-properties-version = Versión de PDF:
@ -213,9 +201,6 @@ pdfjs-page-scale-actual = Grandaria actual
# $scale (Number) - percent value for page scale # $scale (Number) - percent value for page scale
pdfjs-page-scale-percent = { $scale }% pdfjs-page-scale-percent = { $scale }%
## PDF page
## Loading indicator messages ## Loading indicator messages
pdfjs-loading-error = S'ha produciu una error en cargar o PDF. pdfjs-loading-error = S'ha produciu una error en cargar o PDF.
@ -226,10 +211,6 @@ pdfjs-rendering-error = Ha ocurriu una error en renderizar a pachina.
## Annotations ## Annotations
# Variables:
# $date (Date) - the modification date of the annotation
# $time (Time) - the modification time of the annotation
pdfjs-annotation-date-string = { $date }, { $time }
# .alt: This is used as a tooltip. # .alt: This is used as a tooltip.
# Variables: # Variables:
# $type (String) - an annotation type from a list defined in the PDF spec # $type (String) - an annotation type from a list defined in the PDF spec
@ -245,63 +226,3 @@ pdfjs-password-invalid = Clau invalida. Torna a intentar-lo.
pdfjs-password-ok-button = Acceptar pdfjs-password-ok-button = Acceptar
pdfjs-password-cancel-button = Cancelar pdfjs-password-cancel-button = Cancelar
pdfjs-web-fonts-disabled = As fuents web son desactivadas: no se puet incrustar fichers PDF. pdfjs-web-fonts-disabled = As fuents web son desactivadas: no se puet incrustar fichers PDF.
## Editing
## Default editor aria labels
## Remove button for the various kind of editor.
##
## Alt-text dialog
## Editor resizers
## This is used in an aria label to help to understand the role of the resizer.
## Color picker
## Show all highlights
## This is a toggle button to show/hide all the highlights.
## New alt-text dialog
## Group note for entire feature: Alternative text (alt text) helps when people can't see the image. This feature includes a tool to create alt text automatically using an AI model that works locally on the user's device to preserve privacy.
## Image alt-text settings
## "Annotations removed" bar
## Add a signature dialog
## Tab names
## Tab panels
## Controls
## Dialog buttons
## Main menu for adding/removing signatures
## Editor toolbar
## Edit signature description dialog

View File

@ -112,14 +112,6 @@ pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) }
# $mb (Number) - the PDF file size in megabytes # $mb (Number) - the PDF file size in megabytes
# $b (Number) - the PDF file size in bytes # $b (Number) - the PDF file size in bytes
pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } م.بايت ({ $b } بايتات) pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } م.بايت ({ $b } بايتات)
# Variables:
# $size_kb (Number) - the PDF file size in kilobytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-kb = { $size_kb } ك.بايت ({ $size_b } بايت)
# Variables:
# $size_mb (Number) - the PDF file size in megabytes
# $size_b (Number) - the PDF file size in bytes
pdfjs-document-properties-mb = { $size_mb } م.بايت ({ $size_b } بايت)
pdfjs-document-properties-title = العنوان: pdfjs-document-properties-title = العنوان:
pdfjs-document-properties-author = المؤلف: pdfjs-document-properties-author = المؤلف:
pdfjs-document-properties-subject = الموضوع: pdfjs-document-properties-subject = الموضوع:
@ -129,10 +121,6 @@ pdfjs-document-properties-modification-date = تاريخ التعديل:
# Variables: # Variables:
# $dateObj (Date) - the creation/modification date and time of the PDF file # $dateObj (Date) - the creation/modification date and time of the PDF file
pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") } pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
# Variables:
# $date (Date) - the creation/modification date of the PDF file
# $time (Time) - the creation/modification time of the PDF file
pdfjs-document-properties-date-string = { $date }، { $time }
pdfjs-document-properties-creator = المنشئ: pdfjs-document-properties-creator = المنشئ:
pdfjs-document-properties-producer = منتج PDF: pdfjs-document-properties-producer = منتج PDF:
pdfjs-document-properties-version = إصدارة PDF: pdfjs-document-properties-version = إصدارة PDF:
@ -213,6 +201,15 @@ pdfjs-thumb-page-title =
# $page (Number) - the page number # $page (Number) - the page number
pdfjs-thumb-page-canvas = pdfjs-thumb-page-canvas =
.aria-label = مصغّرة صفحة { $page } .aria-label = مصغّرة صفحة { $page }
# Variables:
# $page (Number) - the page number
pdfjs-thumb-page-checkbox1 =
.title = حدّد الصفحة { $page }
# Variables:
# $page (Number) - the page number
# $total (Number) - the number of pages
pdfjs-thumb-page-title1 =
.title = الصفحة { $page } من { $total }
## Find panel button title and messages ## Find panel button title and messages
@ -283,10 +280,6 @@ pdfjs-rendering-error = حدث خطأ أثناء عرض الصفحة.
## Annotations ## Annotations
# Variables:
# $date (Date) - the modification date of the annotation
# $time (Time) - the modification time of the annotation
pdfjs-annotation-date-string = { $date }، { $time }
# .alt: This is used as a tooltip. # .alt: This is used as a tooltip.
# Variables: # Variables:
# $type (String) - an annotation type from a list defined in the PDF spec # $type (String) - an annotation type from a list defined in the PDF spec
@ -302,7 +295,7 @@ pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", tim
pdfjs-password-label = أدخل لكلمة السر لفتح هذا الملف. pdfjs-password-label = أدخل لكلمة السر لفتح هذا الملف.
pdfjs-password-invalid = كلمة سر خطأ. من فضلك أعد المحاولة. pdfjs-password-invalid = كلمة سر خطأ. من فضلك أعد المحاولة.
pdfjs-password-ok-button = حسنا pdfjs-password-ok-button = حسنًا
pdfjs-password-cancel-button = ألغِ pdfjs-password-cancel-button = ألغِ
pdfjs-web-fonts-disabled = خطوط الوب مُعطّلة: تعذّر استخدام خطوط PDF المُضمّنة. pdfjs-web-fonts-disabled = خطوط الوب مُعطّلة: تعذّر استخدام خطوط PDF المُضمّنة.
@ -310,9 +303,13 @@ pdfjs-web-fonts-disabled = خطوط الوب مُعطّلة: تعذّر استخ
pdfjs-editor-free-text-button = pdfjs-editor-free-text-button =
.title = نص .title = نص
pdfjs-editor-color-picker-free-text-input =
.title = غيِّر لون النص
pdfjs-editor-free-text-button-label = نص pdfjs-editor-free-text-button-label = نص
pdfjs-editor-ink-button = pdfjs-editor-ink-button =
.title = ارسم .title = ارسم
pdfjs-editor-color-picker-ink-input =
.title = غيِّر لون الرسم
pdfjs-editor-ink-button-label = ارسم pdfjs-editor-ink-button-label = ارسم
pdfjs-editor-stamp-button = pdfjs-editor-stamp-button =
.title = أضِف أو حرّر الصور .title = أضِف أو حرّر الصور
@ -324,9 +321,33 @@ pdfjs-highlight-floating-button1 =
.title = أبرِز .title = أبرِز
.aria-label = أبرِز .aria-label = أبرِز
pdfjs-highlight-floating-button-label = أبرِز pdfjs-highlight-floating-button-label = أبرِز
pdfjs-comment-floating-button =
.title = علق
.aria-label = علق
pdfjs-comment-floating-button-label = علق
pdfjs-editor-comment-button =
.title = علق
.aria-label = علق
pdfjs-editor-comment-button-label = التعليق
pdfjs-editor-signature-button =
.title = أضِف توقيع
pdfjs-editor-signature-button-label = أضِف توقيع
## Default editor aria labels ## Default editor aria labels
# “Highlight” is a noun, the string is used on the editor for highlights.
pdfjs-editor-highlight-editor =
.aria-label = محرِّر الإبراز
# “Drawing” is a noun, the string is used on the editor for drawings.
pdfjs-editor-ink-editor =
.aria-label = محرِّر الرسم
# Used when a signature editor is selected/hovered.
# Variables:
# $description (String) - a string describing/labeling the signature.
pdfjs-editor-signature-editor1 =
.aria-description = محرِّر التوقيع: { $description }
pdfjs-editor-stamp-editor =
.aria-label = محرِّر الصور
## Remove button for the various kind of editor. ## Remove button for the various kind of editor.
@ -356,24 +377,45 @@ pdfjs-editor-stamp-add-image-button-label = أضِف صورة
pdfjs-editor-free-highlight-thickness-input = السماكة pdfjs-editor-free-highlight-thickness-input = السماكة
pdfjs-editor-free-highlight-thickness-title = pdfjs-editor-free-highlight-thickness-title =
.title = غيّر السُمك عند إبراز عناصر أُخرى غير النص .title = غيّر السُمك عند إبراز عناصر أُخرى غير النص
pdfjs-editor-add-signature-container =
.aria-label = عناصر التحكم في التوقيع والتوقيعات المحفوظة
pdfjs-editor-signature-add-signature-button =
.title = أضِف توقيع جديد
pdfjs-editor-signature-add-signature-button-label = أضِف توقيع جديد
# Used on the button to use an already saved signature.
# Variables:
# $description (String) - a string describing/labeling the signature.
pdfjs-editor-add-saved-signature-button =
.title = التوقيع المحفوظ: { $description }
# .default-content is used as a placeholder in an empty text editor. # .default-content is used as a placeholder in an empty text editor.
pdfjs-free-text2 = pdfjs-free-text2 =
.aria-label = محرِّر النص .aria-label = محرِّر النص
.default-content = ابدأ في كتابة… .default-content = ابدأ في كتابة…
pdfjs-free-text = # Used to show how many comments are present in the pdf file.
.aria-label = محرِّر النص # Variables:
pdfjs-free-text-default-content = ابدأ الكتابة… # $count (Number) - the number of comments.
pdfjs-ink = pdfjs-editor-comments-sidebar-title =
.aria-label = محرِّر الرسم { $count ->
pdfjs-ink-canvas = [zero] تعليق
.aria-label = صورة أنشأها المستخدم [one] تعليق
[two] تعليقات
[few] تعليقات
[many] تعليقات
*[other] تعليقات
}
pdfjs-editor-comments-sidebar-close-button =
.title = أغلِق الشريط الجانبي
.aria-label = أغلِق الشريط الجانبي
pdfjs-editor-comments-sidebar-close-button-label = أغلِق الشريط الجانبي
# Instructional copy to add a comment by selecting text or an annotations.
pdfjs-editor-comments-sidebar-no-comments1 = هل رأيت شيئاً جديرًا بالملاحظة؟ ابرزه واترك تعليقًا.
pdfjs-editor-comments-sidebar-no-comments-link = اطّلع على المزيد
## Alt-text dialog ## Alt-text dialog
pdfjs-editor-alt-text-button-label = نص بديل pdfjs-editor-alt-text-button-label = نص بديل
pdfjs-editor-alt-text-edit-button = pdfjs-editor-alt-text-edit-button =
.aria-label = حرّر النص البديل .aria-label = حرّر النص البديل
pdfjs-editor-alt-text-edit-button-label = تحرير النص البديل
pdfjs-editor-alt-text-dialog-label = اختر خيار pdfjs-editor-alt-text-dialog-label = اختر خيار
pdfjs-editor-alt-text-dialog-description = يساعد النص البديل عندما لا يتمكن الأشخاص من رؤية الصورة أو عندما لا يتم تحميلها. pdfjs-editor-alt-text-dialog-description = يساعد النص البديل عندما لا يتمكن الأشخاص من رؤية الصورة أو عندما لا يتم تحميلها.
pdfjs-editor-alt-text-add-description-label = أضِف وصف pdfjs-editor-alt-text-add-description-label = أضِف وصف
@ -393,14 +435,6 @@ pdfjs-editor-alt-text-button =
## Editor resizers ## Editor resizers
## This is used in an aria label to help to understand the role of the resizer. ## This is used in an aria label to help to understand the role of the resizer.
pdfjs-editor-resizer-label-top-left = الزاوية اليُسرى العُليا — غيّر الحجم
pdfjs-editor-resizer-label-top-middle = أعلى الوسط - غيّر الحجم
pdfjs-editor-resizer-label-top-right = الزاوية اليُمنى العُليا - غيّر الحجم
pdfjs-editor-resizer-label-middle-right = اليمين الأوسط - غيّر الحجم
pdfjs-editor-resizer-label-bottom-right = الزاوية اليُمنى السُفلى - غيّر الحجم
pdfjs-editor-resizer-label-bottom-middle = أسفل الوسط - غيّر الحجم
pdfjs-editor-resizer-label-bottom-left = الزاوية اليُسرى السُفلية - غيّر الحجم
pdfjs-editor-resizer-label-middle-left = مُنتصف اليسار - غيّر الحجم
pdfjs-editor-resizer-top-left = pdfjs-editor-resizer-top-left =
.aria-label = الزاوية اليُسرى العُليا — غيّر الحجم .aria-label = الزاوية اليُسرى العُليا — غيّر الحجم
pdfjs-editor-resizer-top-middle = pdfjs-editor-resizer-top-middle =
@ -506,6 +540,14 @@ pdfjs-editor-alt-text-settings-show-dialog-button-label = أظهِر مُحرّ
pdfjs-editor-alt-text-settings-show-dialog-description = يساعدك على التأكد من أن جميع صورك تحتوي على نص بديل. pdfjs-editor-alt-text-settings-show-dialog-description = يساعدك على التأكد من أن جميع صورك تحتوي على نص بديل.
pdfjs-editor-alt-text-settings-close-button = أغلق pdfjs-editor-alt-text-settings-close-button = أغلق
## Accessibility labels (announced by screen readers) for objects added to the editor.
pdfjs-editor-highlight-added-alert = أُضيف إبراز
pdfjs-editor-freetext-added-alert = أُضيف النص
pdfjs-editor-ink-added-alert = أُضيف رسم
pdfjs-editor-stamp-added-alert = أُضيف صورة
pdfjs-editor-signature-added-alert = أُضيف توقيع
## "Annotations removed" bar ## "Annotations removed" bar
pdfjs-editor-undo-bar-message-highlight = أُزِيل البرز pdfjs-editor-undo-bar-message-highlight = أُزِيل البرز
@ -513,6 +555,7 @@ pdfjs-editor-undo-bar-message-freetext = أُزيل النص
pdfjs-editor-undo-bar-message-ink = أُزِيلت الرسمة pdfjs-editor-undo-bar-message-ink = أُزِيلت الرسمة
pdfjs-editor-undo-bar-message-stamp = أُزيلت الصورة pdfjs-editor-undo-bar-message-stamp = أُزيلت الصورة
pdfjs-editor-undo-bar-message-signature = أُزيل التوقيع pdfjs-editor-undo-bar-message-signature = أُزيل التوقيع
pdfjs-editor-undo-bar-message-comment = أُزيل التعليق
# Variables: # Variables:
# $count (Number) - the number of removed annotations. # $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple = pdfjs-editor-undo-bar-message-multiple =
@ -534,7 +577,7 @@ pdfjs-editor-undo-bar-close-button-label = أغلق
## Add a signature dialog ## Add a signature dialog
pdfjs-editor-add-signature-dialog-label = يتيح هذا النموذج للمستخدم إنشاء توقيع لإضافته إلى مستند PDF. ويمكن للمستخدم تحرير الاسم (الذي يعمل أيضًا كنص بديل)، وحفظ التوقيع بشكل اختياري للاستخدام المتكرر. pdfjs-editor-add-signature-dialog-label = يتيح هذا النموذج للمستخدم إنشاء توقيع لإضافته إلى مستند PDF. ويمكن للمستخدم تحرير الاسم (الذي يعمل أيضًا كنص بديل)، وحفظ التوقيع بشكل اختياري للاستخدام المتكرر.
pdfjs-editor-add-signature-dialog-title = أضِف توقيعا pdfjs-editor-add-signature-dialog-title = أضِف توقيعًا
## Tab names ## Tab names
@ -578,18 +621,159 @@ pdfjs-editor-add-signature-save-checkbox = احفظ التوقيع
pdfjs-editor-add-signature-save-warning-message = لقد وصلت إلى الحد الأقصى وهو 5 توقيعات محفوظة. أزِل توقيع واحد لحفظ المزيد. pdfjs-editor-add-signature-save-warning-message = لقد وصلت إلى الحد الأقصى وهو 5 توقيعات محفوظة. أزِل توقيع واحد لحفظ المزيد.
pdfjs-editor-add-signature-image-upload-error-title = تعذر رفع الصورة. pdfjs-editor-add-signature-image-upload-error-title = تعذر رفع الصورة.
pdfjs-editor-add-signature-image-upload-error-description = تحقق من اتصال الشبكة لديك أو جرّب صورة أخرى. pdfjs-editor-add-signature-image-upload-error-description = تحقق من اتصال الشبكة لديك أو جرّب صورة أخرى.
pdfjs-editor-add-signature-image-no-data-error-title = لا يمكن تحويل هذه الصورة إلى توقيع
pdfjs-editor-add-signature-image-no-data-error-description = من فضلك حاول رفع صورة أخرى.
pdfjs-editor-add-signature-error-close-button = أغلق pdfjs-editor-add-signature-error-close-button = أغلق
## Dialog buttons ## Dialog buttons
pdfjs-editor-add-signature-cancel-button = ألغِ pdfjs-editor-add-signature-cancel-button = ألغِ
pdfjs-editor-add-signature-add-button = أضِف pdfjs-editor-add-signature-add-button = أضِف
pdfjs-editor-edit-signature-update-button = حدّث
## Comment popup
pdfjs-editor-edit-comment-popup-button-label = حرّر التعليق
pdfjs-editor-edit-comment-popup-button =
.title = حرّر التعليق
pdfjs-editor-delete-comment-popup-button-label = أزِل التعليق
pdfjs-editor-delete-comment-popup-button =
.title = أزِل التعليق
pdfjs-show-comment-button =
.title = أظهر التعليق
## Edit a comment dialog
# An existing comment is edited
pdfjs-editor-edit-comment-dialog-title-when-editing = حرّر التعليق
pdfjs-editor-edit-comment-dialog-save-button-when-editing = حدّث
# No existing comment
pdfjs-editor-edit-comment-dialog-title-when-adding = أضِف تعليقًا
pdfjs-editor-edit-comment-dialog-save-button-when-adding = أضف
pdfjs-editor-edit-comment-dialog-text-input =
.placeholder = ابدأ الكتابة…
pdfjs-editor-edit-comment-dialog-cancel-button = ألغِ
## Edit a comment button in the editor toolbar
pdfjs-editor-add-comment-button =
.title = أضف التعليق
## The view manager is a sidebar displaying different views:
## - thumbnails;
## - outline;
## - attachments;
## - layers.
## The thumbnails view is used to edit the pdf: remove/insert pages, ...
pdfjs-toggle-views-manager-notification-button =
.title = تبديل الشريط الجانبي (يحتوي المستند على صور مصغرة/مخطط تفصيلي/مرفقات/طبقات)
pdfjs-toggle-views-manager-button1-label = أدِر الصفحات
pdfjs-views-manager-sidebar =
.aria-label = الشريط الجانبي
pdfjs-views-manager-sidebar-resizer =
.aria-label = أداة تغيير حجم الشريط الجانبي
pdfjs-views-manager-view-selector-button =
.title = المناظير
pdfjs-views-manager-view-selector-button-label = المناظير
pdfjs-views-manager-pages-title = الصفحات
pdfjs-views-manager-outlines-title1 = مخطط المستند
.title = مخطط المستند (انقر نقرًا مزدوجًا لتوسيع/طي كافة العناصر)
pdfjs-views-manager-attachments-title = المرفقات
pdfjs-views-manager-layers-title1 = ‏‏طبقات
.title = الطبقات (انقر نقرًا مزدوجًا لإعادة تعيين كافة الطبقات إلى الحالة المبدئية)
pdfjs-views-manager-pages-option-label = الصفحات
pdfjs-views-manager-outlines-option-label = مخطط المستند
pdfjs-views-manager-attachments-option-label = المرفقات
pdfjs-views-manager-layers-option-label = ‏‏الطبقات
pdfjs-views-manager-add-file-button =
.title = أضف ملف
pdfjs-views-manager-add-file-button-label = أضف ملف
# Variables:
# $count (Number) - the number of selected pages.
pdfjs-views-manager-pages-status-action-label =
{ $count ->
[zero] { $count } محدّد
[one] { $count } محدّد
[two] { $count } محدّدان
[few] { $count } محدّد
[many] { $count } محدّد
*[other] { $count } محدّد
}
pdfjs-views-manager-pages-status-none-action-label = حدّد الصفحات
pdfjs-views-manager-pages-status-action-button-label = أدِر
pdfjs-views-manager-pages-status-copy-button-label = انسخ
pdfjs-views-manager-pages-status-cut-button-label = قصّ
pdfjs-views-manager-pages-status-delete-button-label = احذف
pdfjs-views-manager-pages-status-export-selected-button-label = حُدِّد التصدير…
# Variables:
# $count (Number) - the number of selected pages to be cut.
pdfjs-views-manager-status-undo-cut-label =
{ $count ->
[zero] لا صفحات قُصت
[one] صفحة قُصت
[two] { $count } صفحتان قُصت
[few] { $count } صفحات قُصت
[many] { $count } صفحةً قُصت
*[other] { $count } صفحة قُصت
}
# Variables:
# $count (Number) - the number of selected pages to be copied.
pdfjs-views-manager-pages-status-undo-copy-label =
{ $count ->
[zero] لا صفحة منسوخة
[one] صفحة منسوخة
[two] صفحتان منسوختان
[few] { $count } صفحات منسوخة
[many] { $count } صفحةً منسوخةً
*[other] { $count } صفحة منسوخة
}
# Variables:
# $count (Number) - the number of selected pages to be deleted.
pdfjs-views-manager-pages-status-undo-delete-label =
{ $count ->
[zero] لا صفحات محذوفة
[one] حُذف صفحة
[two] حُذف صفحتان
[few] حُذف { $count } صفحات
[many] حُذف { $count } صفحةً
*[other] حُذف { $count } صفحة
}
pdfjs-views-manager-pages-status-waiting-ready-label = يجهز ملفك…
pdfjs-views-manager-pages-status-waiting-uploading-label = يرفع ملف…
pdfjs-views-manager-status-warning-cut-label = تعذّر القص. أنعش الصفحة وحاول مجددًا.
pdfjs-views-manager-status-warning-copy-label = تعذّر النسخ. أنعش الصفحة وحاول مجددًا.
pdfjs-views-manager-status-warning-delete-label = تعذّر الحذف. حدِّث الصفحة وحاول مجددًا.
pdfjs-views-manager-status-warning-save-label = تعذّر الحفظ. أنعش الصفحة وحاول مجددًا.
pdfjs-views-manager-status-undo-button-label = تراجع
pdfjs-views-manager-status-done-button-label = تمّ
pdfjs-views-manager-status-close-button =
.title = أغلق
pdfjs-views-manager-status-close-button-label = أغلق
pdfjs-views-manager-paste-button-label = ألصق
pdfjs-views-manager-paste-button-before =
.title = ألصق قبل الصفحة الأولى
# Variables:
# $page (Number) - the page number after which the paste button is.
pdfjs-views-manager-paste-button-after =
.title = ألصق بعد الصفحة { $page }
# Badge used to promote a new feature in the UI, keep it as short as possible.
# It's spelled uppercase for English, but it can be translated as usual.
pdfjs-new-badge-content = جديد
pdfjs-views-manager-waiting-for-file = يرفع ملف…
pdfjs-toggle-views-manager-button1 =
.title = أدِر الصفحات
## Main menu for adding/removing signatures ## Main menu for adding/removing signatures
pdfjs-editor-delete-signature-button1 =
.title = أزِل التوقيع المحفوظ
pdfjs-editor-delete-signature-button-label1 = أزِل التوقيع المحفوظ
## Editor toolbar ## Editor toolbar
pdfjs-editor-add-signature-edit-button-label = عدّل الوصف
## Edit signature description dialog ## Edit signature description dialog
pdfjs-editor-edit-signature-dialog-title = عدّل الوصف

Some files were not shown because too many files have changed in this diff Show More