22721 Commits

Author SHA1 Message Date
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
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
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