20766 Commits

Author SHA1 Message Date
Jonas Jenwald
abc9522886 Avoid (most) string parsing when removing/replacing the hash property of a URL 2025-04-25 23:13:05 +02:00
calixteman
efc5c3c231
Merge pull request #19862 from calixteman/bug1961423
Fix 'print to pdf' on Mac with a cid font (bug 1961423)
2025-04-25 15:11:55 +02:00
Jonas Jenwald
312c85bfd6
Merge pull request #19815 from Snuffleupagus/getMergedResources-size
Ensure that "local" /Contents stream-dict /Resources aren't empty (PR 19803 follow-up)
2025-04-25 10:46:04 +02:00
Jonas Jenwald
1a5c9e90dd
Merge pull request #19861 from Snuffleupagus/debugger-fix-light-dark-fallout
Fix the debugger CSS when using the dark theme (PR 19819 follow-up)
2025-04-25 10:44:55 +02:00
Calixte Denizet
785991a97c Fix 'print to pdf' on Mac with a cid font (bug 1961423) 2025-04-24 20:19:12 +02:00
Jonas Jenwald
6b76bdac3a Fix the debugger CSS when using the dark theme (PR 19819 follow-up)
Perhaps we should update the debugger CSS to properly account for the light/dark theme, however since that's not UI that end-users ever see we simply force using the light theme for now.
2025-04-24 17:34:29 +02:00
calixteman
91175dc67d
Merge pull request #19854 from calixteman/fix_find_in_tests
Fix errors when running the integration tests
2025-04-24 11:27:03 +02:00
Calixte Denizet
8630822a63 Fix errors when running the integration tests
JavaScript error: http://127.0.0.1:42301/build/generic/web/viewer.mjs, line 5822: TypeError: this[#state] is null
JavaScript error: http://127.0.0.1:42301/build/generic/web/viewer.mjs, line 6001: TypeError: can't access property "getPage", this._pdfDocument is null
2025-04-23 23:04:24 +02:00
Jonas Jenwald
de2a44a558
Merge pull request #19849 from Snuffleupagus/issue-19848
Ensure that the /Form XObject /Resources-entry is actually a dictionary (issue 19848)
2025-04-23 16:48:06 +02:00
Jonas Jenwald
01c1c6e60f
Merge pull request #19819 from Snuffleupagus/CSS-light-dark
Use the `light-dark` CSS function in the viewer (issue 17780)
2025-04-23 16:30:03 +02:00
calixteman
627a935baf
Merge pull request #19853 from calixteman/issue19850
Disable userActivation before executing a setTimeout/setInterval callback
2025-04-23 16:11:59 +02:00
Jonas Jenwald
ae1cbc6a9e Use the light-dark CSS function in the viewer (issue 17780)
This removes the need for (most) separate `@media (prefers-color-scheme: dark)` blocks when defining colors values, and also provides a simple way of forcing use of either the light or dark theme.

Please refer to https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark and https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme

*NOTE:* To support this in older browsers, we utilize a [PostCSS plugin](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function).
2025-04-23 15:31:39 +02:00
Calixte Denizet
05a45346a5 Disable userActivation before executing a setTimeout/setInterval callback
Fixes issue #19850.
2025-04-23 15:25:12 +02:00
Jonas Jenwald
64007e777e Ensure that the /Form XObject /Resources-entry is actually a dictionary (issue 19848) 2025-04-23 10:19:20 +02:00
Jonas Jenwald
63e6566597
Merge pull request #19816 from Snuffleupagus/bug-1957401
Add a "supportsPrinting" viewer-option (bug 1957401)
2025-04-22 15:25:20 +02:00
Jonas Jenwald
213d51d7e9
Merge pull request #19823 from Snuffleupagus/rm-duplicate-secondaryToolbar-mask-image
Remove duplicate secondaryToolbar button `mask-image` definitions (PR 18385 follow-up)
2025-04-22 15:14:47 +02:00
Jonas Jenwald
c8ed291cf9
Merge pull request #19836 from Snuffleupagus/issue-19835
Always fallback to checking all destinations, when lookup fails (issue 19835)
2025-04-22 15:14:05 +02:00
Jonas Jenwald
c63c51e016
Merge pull request #19841 from Snuffleupagus/issue-19840
Fix printing of XFA documents, by calling `XfaLayerBuilder.prototype.render` correctly (issue 19840)
2025-04-22 15:12:46 +02:00
Jonas Jenwald
b4626a77a2 Fix printing of XFA documents, by calling XfaLayerBuilder.prototype.render correctly (issue 19840)
When changing the format of various `render`-methods in PR 19365 I forgot to update the code used to print XFA documents, sorry about that.
2025-04-22 09:15:52 +02:00
Jonas Jenwald
adc9eb5a5a Always fallback to checking all destinations, when lookup fails (issue 19835)
In the referenced PDF document the keys, in the /Dests dictionary, need to account for PDFDocEncoding.
To improve destination handling in general we'll now unconditionally fallback to always checking all destinations.
2025-04-20 14:53:10 +02:00
calixteman
d8d3e0abf5
Merge pull request #19829 from calixteman/info_icon
Replace the info icon in the undo bar by the right one (bug 1960523)
2025-04-18 14:16:56 +02:00
Calixte Denizet
75e9f2a0e8 Replace the info icon in the undo bar by the right one (bug 1960523) 2025-04-18 14:13:02 +02:00
Jonas Jenwald
87a143dbbc
Merge pull request #19828 from Snuffleupagus/worker-check-Object-prototype
Check that the `Object.prototype` hasn't been incorrectly extended (PR 11582 follow-up)
2025-04-18 13:59:07 +02:00
Jonas Jenwald
91ba147317 Check that the Object.prototype hasn't been incorrectly extended (PR 11582 follow-up)
This complements, and extends, the existing check of the `Array.prototype` in the worker-thread.
To simplify the implementation we'll now abort immediately, rather than collecting all "bad" properties.
2025-04-18 12:19:29 +02:00
calixteman
4b1875c8c0
Merge pull request #19825 from calixteman/bug1961107
Avoid to create any subarrays when optimizing 'save, transform, constructPath, restore' (bug 1961107)
2025-04-17 19:42:28 +02:00
Calixte Denizet
d7cbda6cb5 Avoid to create any subarrays when optimizing 'save, transform, constructPath, restore' (bug 1961107)
Removing those `subarray`calls helps to improve performance by a factor 6 on Linux and by a factor of 3
on Windows 11.
2025-04-17 19:14:01 +02:00
Jonas Jenwald
f1e20cd668
Merge pull request #19824 from Snuffleupagus/getStructTree-catch-errors
Improve error handling when parsing page-structTrees
2025-04-17 15:21:55 +02:00
Jonas Jenwald
bf553f22da Ensure that the /P-entry is actually a dictionary in StructTreePage.prototype.addNode
This may fix issue 19822, but without a test-case it's simply impossible to know for sure.
2025-04-17 14:01:53 +02:00
Jonas Jenwald
76f23ce3b5 Catch, and ignore, errors during Page.prototype.getStructTree
This way any errors thrown during parsing of the page-structTree will not be forwarded to the viewer.
2025-04-17 13:57:30 +02:00
Jonas Jenwald
8e7060158e Remove duplicate secondaryToolbar button mask-image definitions (PR 18385 follow-up)
It appears that all secondaryToolbar buttons currently have their `mask-image` definitions duplicated, which leads to larger than necessary CSS files.
2025-04-17 10:51:51 +02:00
Jonas Jenwald
97fe7d6a19 Add a "supportsPrinting" viewer-option (bug 1957401)
This will allow us to respect the `print.enabled` Firefox preference, by extending [this method](https://searchfox.org/mozilla-central/rev/56117379696ea0cffb94cd09c14cd022a8c5e4e8/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#426-453), which will hide the toolbar and secondaryToolbar print-buttons.
2025-04-15 12:43:11 +02:00
Jonas Jenwald
245d9ba925 Ensure that "local" /Contents stream-dict /Resources aren't empty (PR 19803 follow-up)
This is a small, and quite possibly pointless, optimization which ensures that any "local" /Resources aren't empty, to avoid needlessly trying to load and merge dictionaries.
2025-04-14 09:58:15 +02:00
Tim van der Meij
2f7d163dfd
Merge pull request #19812 from timvandermeij/disable-permafail
Remove debug code from the integration tests, and skip the "must check that canvas perfectly fits the page whatever the zoom level" integration test in Chrome
2025-04-13 20:53:58 +02:00
Tim van der Meij
923753a66b
Skip the "must check that canvas perfectly fits the page whatever the zoom level" integration test in Chrome
This is a temporary measure to reduce noise until #19811 is fixed. Note
that this shouldn't be an issue in terms of coverage because we still
run the test in Firefox.
2025-04-13 19:32:39 +02:00
Tim van der Meij
efe4a3455a
Remove debug code from the integration tests
Doing so simplifies the code a bit, and such code is generally not
checked in because it can easily be added locally if needed.
2025-04-13 19:19:13 +02:00
Tim van der Meij
35f85c55bd
Merge pull request #19810 from Snuffleupagus/issue-19808
Update Webpack to version `5.99.5` (issue 19808)
2025-04-13 18:43:19 +02:00
Tim van der Meij
574e4f4ec1
Merge pull request #19809 from timvandermeij/integration-tests-isolate-all-and-random
Run the integration tests in a random order
2025-04-13 18:37:08 +02:00
Jonas Jenwald
6b961c424f Update Webpack to version 5.99.5 (issue 19808)
In Webpack version `5.99.0` the way that `export` statements are handled was changed slightly, with much less boilerplate code being generated, which unfortunately breaks our `tweakWebpackOutput` function that's used to expose the exported properties globally and that e.g. the viewer depends upon.

Given that we were depending on formatting that should most likely be viewed as nothing more than an internal implementation detail in Webpack, we instead work-around this by manually defining the structures that were previously generated.
Obviously this will lead to a tiny bit more manual work in the future, however we don't change the API-surface often enough that it should be a big issue *and* the relevant unit-tests are updated such that it shouldn't be possible to break this.

*NOTE:* In the future we might want to consider no longer using global properties like this, and instead rely only on proper `export`s throughout the code-base.
However changing this would likely be non-trivial (given edge-cases), and it'd be an `api-major` change, so let's just do the minimal amount of work to unblock Webpack updates for now.
2025-04-13 16:48:19 +02:00
Tim van der Meij
938430be5b
Remove workaround from the "must convert input to uppercase" scripting integration test
It's no longer necessary after commit 1c73e52 that caused the document
to be closed properly between tests, and this therefore partly reverts
commit 973b67f.
2025-04-13 15:57:54 +02:00
Tim van der Meij
5f46791887
Run the integration tests in a random order
This commit configures Jasmine to no longer run the tests in a fixed
order, which combined with the previous isolation commits avoids being
able to accidentally introduce dependencies between integration tests.
2025-04-13 15:46:03 +02:00
Tim van der Meij
75b321b000
Isolate the viewer integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:24:15 +02:00
Tim van der Meij
965949c259
Isolate the text layer integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:24:15 +02:00
Tim van der Meij
6308f5eb51
Isolate the text field integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:24:15 +02:00
Tim van der Meij
7c8262ccc9
Isolate the stamp editor integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:24:15 +02:00
Tim van der Meij
44243761a5
Isolate the highlight editor integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:20:27 +02:00
Tim van der Meij
5011d96a62
Isolate the freetext editor integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:20:23 +02:00
Tim van der Meij
f043760b54
Isolate the find integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:20:18 +02:00
Tim van der Meij
179859f54a
Isolate the copy/paste integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:20:14 +02:00
Tim van der Meij
0e9e4ec64f
Isolate the caret browsing integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:20:08 +02:00
Tim van der Meij
a60f9bc612
Isolate the autolinker integration tests
To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
2025-04-13 15:20:03 +02:00