Commit Graph

18491 Commits

Author SHA1 Message Date
Calixte Denizet
f7fec8c6d7 [Editor] Don't remove elements from the draw layer after it has been destroyed
Fixes issue #17379.
2023-12-05 22:41:20 +01:00
Jonas Jenwald
319e85449e
Merge pull request #17377 from Snuffleupagus/pr-17352-follow-up
Remove the unused `--editor-toolbar-active-bg-color` CSS variable (PR 17352 follow-up)
2023-12-05 15:06:13 +01:00
calixteman
7f04ce4d22
Merge pull request #17374 from calixteman/bug1865341
[Editor] Avoid conflicts between new persistent refs and the ones created when saving (bug 1865341)
2023-12-05 14:50:15 +01:00
Jonas Jenwald
c0bc5f9013 Remove the unused --editor-toolbar-active-bg-color CSS variable (PR 17352 follow-up)
This CSS variable became unused in PR 17352 but we apparently forgot to remove it there, which causes issues when trying to update PDF.js in mozilla-central; see https://treeherder.mozilla.org/push-health/push?repo=try&revision=0701bd2c189d85cd9ff050d6d3e8336d8f36e625&tab=tests&testGroup=pr&selectedTest=browserbasecontentteststaticbrowserparsablecssjs&selectedTaskId=
2023-12-05 14:01:23 +01:00
Calixte Denizet
ae5828c968 [Editor] Avoid conflicts between new persistent refs and the ones created when saving (bug 1865341)
When a pdf as a FreeText without appearance, we use a fake font in order to render it
and that leads to create few new refs for the font.
But then when we're saving, we create some new refs which start at the same number
as the previous created ones.
Consequently, when saving we're using some wrong objects (like a font) to check if
we're able to render the newly added FreeText.
In order to fix this bug, we just remove the persistent refs (which are only used
when rendering/printing) during the saving.
2023-12-05 12:33:21 +01:00
calixteman
795c63e400
Merge pull request #17375 from calixteman/bug1867588
[Editor] Always give the focus to the ink editor when starting drawing (bug 1867588)
2023-12-05 10:54:11 +01:00
Calixte Denizet
11610a9e66 [Editor] Always give the focus to the ink editor when starting drawing (bug 1867588)
This way, when the editor is blurred, it can be committed and everything works fine.
It fixes issue #17373.
2023-12-05 10:26:59 +01:00
calixteman
a3637e653f
Merge pull request #17370 from calixteman/issue17368
[Editor] Make sure that all layers are disabled when an editing session is done
2023-12-04 16:58:41 +01:00
Jonas Jenwald
d7bec1b527 Limit the amount of console "spam" during fuzz tests (PR 17337 follow-up)
Having just tested PR 17337 locally I noticed that especially the `JpxImage`-test causes a "ridiculous" amount of warning messages to be printed, which doesn't seem helpful.
Given that only actual `Error`s should be relevant here, we can easily disable this logging during the tests.
2023-12-04 16:39:45 +01:00
Jonas Jenwald
476cb84d92
Merge pull request #17367 from timvandermeij/modernize-test
Modernize the `calculateMD5` and `verifyManifestFiles` test helper functions
2023-12-04 16:03:19 +01:00
Calixte Denizet
43eea0b38e [Editor] Make sure that all layers are disabled when an editing session is done
Fixes issue #17368.
2023-12-04 13:27:39 +01:00
Tim van der Meij
ac5667166e
Modernize the verifyManifestFiles test helper function
The test helper code largely predates the introduction of modern
JavaScript features and should be refactored to improve readability.
In particular callbacks and recursive function calls make the code
harder to understand and maintain.

This commit:

- replaces the callback argument with returning a promise;
- replaces the recursive function calls with a simple loop;
- uses `const`/`let` instead of `var`;
- uses template strings for shorter string formatting code;
- improves the error messages to have more details.
2023-12-03 20:42:50 +01:00
Tim van der Meij
c9a923066b
Modernize the calculateMD5 test helper function
The test helper code largely predates the introduction of modern
JavaScript features and should be refactored to improve readability.
In particular callbacks and recursive function calls make the code
harder to understand and maintain.

This commit:

- replaces the callback argument with returning a promise;
- uses `const` instead of `var`;
- uses arrow functions for shorter code;
- uses template strings for shorter string formatting code;
- improves the error messages to have more details.
2023-12-03 20:42:45 +01:00
Tim van der Meij
5111b6d371
Merge pull request #17337 from manunio/initial-fuzzing-support
fuzz: initial integration
2023-12-03 15:12:18 +01:00
manunio
8bb8070116 fuzz: initial integration
- Adds initial fuzz_target for image decoders.
  - Adds jazzer.js as dev-dependency.
  - Adds a .eslintrc rule to ignore import/no-unresolved error.
2023-12-03 18:52:48 +05:30
calixteman
6b3ae4492e
Merge pull request #17364 from calixteman/editor_disable_highlight
[Editor] Disable mouse events when leaving the highlight mode
2023-12-01 18:49:52 +01:00
Jonas Jenwald
a1d84f5ecf
Merge pull request #17363 from Snuffleupagus/issue-17353
[Firefox] Restore opening of PDF attachments (issue 17353, bug 1867764)
2023-12-01 18:12:52 +01:00
Calixte Denizet
83d0b6cb55 [Editor] Disable mouse events when leaving the highlight mode 2023-12-01 17:10:19 +01:00
Jonas Jenwald
4c92ec9008 [Firefox] Restore opening of PDF attachments (issue 17353)
This unfortunately broke in PR 17060, since I had completely forgotten about https://bugzilla.mozilla.org/show_bug.cgi?id=1632644#c5 when writing that patch.
The easiest solution, while slightly unfortunate, seems to be to add a couple of non-standard hash parameters specifically for the PDF attachment use-case in the Firefox PDF Viewer. (Note that we cannot use "nameddest" here, since we also need to support the stringified destination-Array case.)
2023-12-01 12:16:56 +01:00
Jonas Jenwald
096426f073
Merge pull request #17360 from Snuffleupagus/issue-17347
Remove the "transitionend" event listener from the default viewer (issue 17347)
2023-12-01 10:22:42 +01:00
Jonas Jenwald
fe3bc575de Disable the "should compress and save text" unit-test in additional Node.js versions (PR 17202 follow-up)
It seems this unit-test started failing in Node.js version 20.10 as well. We should probably try and understand why, but for now just disable it to get passing CI tests.
2023-11-30 20:47:15 +01:00
Jonas Jenwald
412502370d Remove the "transitionend" event listener from the default viewer (issue 17347)
Given that this event listener is only used to trigger rendering after the sidebar has been opened/closed, we can utilize the existing one in the `PDFSidebar` class for this purpose instead. That one is registered on the sidebar DOM-element, and is needed to remove a CSS-class indicating that the sidebar is moving.
2023-11-30 20:29:40 +01:00
calixteman
d65dca7811
Merge pull request #17358 from whimboo/mouse_click_count
Use "count" and not "clickCount" when calling page.mouse.click()
2023-11-30 10:12:37 +01:00
Henrik Skupin
9052327e07
Use "count" and not "clickCount" when calling page.mouse.click() 2023-11-30 09:40:57 +01:00
calixteman
9ac1ac6ed3
Merge pull request #17352 from calixteman/move_button_hcm
[Editor] Fix the colors in HCM when hovering a button in the editor toolbar
2023-11-29 20:21:16 +01:00
Calixte Denizet
91eda77f63 [Editor] Fix the colors in HCM when hovering a button in the editor toolbar
It fixes few errors in the CSS for HCM.
It now complies to the specs from UI/UX.
Only the foreground must change in HCM and not the background, similarly to what
we had for the alt-text button before moving it.
2023-11-29 19:53:03 +01:00
calixteman
6a35e4206e
Merge pull request #17351 from calixteman/fix_mc_test
[Editor] Fix subtype for telemetry data (follow-up of #17329)
2023-11-29 11:48:42 +01:00
Calixte Denizet
05ca005eeb [Editor] Fix subtype for telemetry data (follow-up of #17329)
Fix a test failure in m-c.
2023-11-29 11:09:22 +01:00
calixteman
59cf2ee5a9
Merge pull request #17338 from Snuffleupagus/rm-FirefoxCom-requestSync
[Firefox] Remove the `FirefoxCom.requestSync` method
2023-11-28 16:26:32 +01:00
Jonas Jenwald
b03ce96605 [Firefox] Remove the FirefoxCom.requestSync method, since it's unused
After the two previous commits, which removed the remaining call-sites, this method is no longer used and can thus be removed.
As mentioned in the JSDocs for the now removed method, synchronous communication between the viewer and the platform code isn't really a good idea.

Once this patch has landed in mozilla-central some additional clean-up of the platform code will also be possible.
2023-11-28 16:19:58 +01:00
Jonas Jenwald
9ca504e538 [Firefox] Don't send the "abortLoading" message synchronously
Despite the comment, I believe that changing this should be fine for two separate reasons:
 - The platform code has an "unload" event listener, see [this code](https://searchfox.org/mozilla-central/rev/edb2612db13e89f1c44ab95b1e4d4366c16eb9fb/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#533-538), that invokes the same method. Hence we should still be guaranteed that the relevant platform method will run.

 - The `FirefoxComDataRangeTransport.abort` method is never actually invoked in the Firefox PDF Viewer.
   Note that the [`PDFDataRangeTransport.abort` method](f4b396f6c8/src/display/api.js (L759)) is only invoked via the [`PDFDataTransportStream.cancelAllRequests` method](f4b396f6c8/src/display/transport_stream.js (L167-L175)), which in turn is only invoked via the [`WorkerTransport.destroy` method](f4b396f6c8/src/display/api.js (L2485-L2487)). That method is invoked via the [`PDFDocumentLoadingTask.destroy` method](f4b396f6c8/src/display/api.js (L630)), which in the viewer is only invoked via the [`PDFViewerApplication.close` method](f4b396f6c8/web/app.js (L919)) which is never actually called in the Firefox PDF Viewer.

All-in-all, given the existing platform code *and* the current viewer-implementation it should thus be safe to not wait for the "abortLoading" message to complete.
2023-11-28 16:19:58 +01:00
Jonas Jenwald
ddebb0f954 [Firefox] Don't send the "initPassiveLoading" message synchronously
The return value is not, nor has it ever been, used for anything and we should thus be able to just send the message.
Note that the responses are already handled by the "message" event listener registered above.
2023-11-28 16:19:58 +01:00
calixteman
f4952399a4
Merge pull request #17329 from calixteman/move_alt_text_button
[Editor] Move the alt text button in the editor toolbar
2023-11-28 15:57:35 +01:00
Calixte Denizet
59112a7730 [Editor] Move the alt text button in the editor toolbar 2023-11-28 15:36:29 +01:00
calixteman
8e2507e0e8
Merge pull request #17317 from calixteman/editor_highlight
[Editor] Add a new editor to highlight some text in a pdf (bug 1866119)
2023-11-28 15:12:43 +01:00
Calixte Denizet
1ea6293923 [Editor] Add a new editor to highlight some text in a pdf (bug 1866119)
This patch is first big step for the new highlight feature.
Few patches will follow in order to conform to the specs UX/UI gave us.
2023-11-28 14:21:53 +01:00
calixteman
4bf7ff2027
Merge pull request #17344 from calixteman/issue17342
[Editor] Avoid to add a new ink editor when we aren't editing anymore
2023-11-27 16:53:48 +01:00
Calixte Denizet
2be136ab70 [Editor] Avoid to add a new ink editor when we aren't editing anymore 2023-11-27 16:18:31 +01:00
calixteman
b7e943bc7d
Merge pull request #17340 from calixteman/issue17332
Don't throw when there isn't enough data to get block info in flate stream
2023-11-26 19:23:25 +01:00
Calixte Denizet
52ea20eda4 Don't throw when there isn't enough data to get block info in flate stream
but just ends the stream.
2023-11-26 18:12:22 +01:00
Tim van der Meij
02a0189795
Merge pull request #17339 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2023-11-26 13:50:08 +01:00
Tim van der Meij
dd07267da6
Bump the stable version in pdfjs.config 2023-11-26 13:46:23 +01:00
Tim van der Meij
f4b396f6c8
Merge pull request #17334 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2023-11-25 19:42:40 +01:00
Tim van der Meij
ab692f805a
Update translations to the most recent versions 2023-11-25 19:34:44 +01:00
Tim van der Meij
dd7ff7e662
Update the JSDoc comments for the new TypeScript version
This commit fixes the JSDoc comment for the `annotationEditorMode` setter.
The types tests fail on that now because the input value was changed from
a number to an object with various properties in recent patches, but the
JSDoc comment was not updated accordingly.

Moreover, the types tests also fail because TypeScript 5.3 assumes that
getters and setters have equal return and input value types, which is
arguably also what one would expect, but our `annotationEditorMode`
getter and setter deviate from that because the getter returns a number
while the setter accepts an object. Given that it seems more important
to document the setter entirely, including the meaning and types of its
properties, and the type of the getter can easily be inferred from this
comment and the other JSDoc comments that have `annotationEditorMode` in
it, we remove the getter type to make the types tests pass again.
2023-11-25 19:34:44 +01:00
Tim van der Meij
8aa26fad24
Update the code style for the new Prettier version
This patch is automatically generated using `gulp lint --fix`.
2023-11-25 18:15:09 +01:00
Tim van der Meij
7381515e20
Update dependencies to the most recent versions 2023-11-25 17:25:35 +01:00
calixteman
9d863f5180
Merge pull request #17331 from calixteman/lang_marker
Remove language codes from text strings.
2023-11-25 16:43:37 +01:00
Calixte Denizet
eb5f610d18 Remove language codes from text strings.
And take care to have an even number of bytes with utf16 strings.
2023-11-25 15:09:31 +01:00
Tim van der Meij
4b1de1537f
Merge pull request #17320 from tamuratak/fix_webpack_readme
Fix examples/webpack/README.md.
2023-11-25 12:49:04 +01:00