Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the implementation of the PDFDocument.fingerprints-getter #17862

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

Snuffleupagus
Copy link
Collaborator

  • Add explicit length validation of the /ID entries. Given the EMPTY_FINGERPRINT constant we're already implicitly assuming a particular length.

  • Move the constants into the fingerprints-getter, since they're not used anywhere else.

  • Replace the hexString helper function with the standard Uint8Array.prototype.toHex method; see https://github.com/tc39/proposal-arraybuffer-base64

src/core/document.js Outdated Show resolved Hide resolved
@Snuffleupagus Snuffleupagus force-pushed the fingerprints-toHex branch 4 times, most recently from 844cf02 to 2598a0b Compare October 14, 2024 13:43
@Snuffleupagus Snuffleupagus force-pushed the fingerprints-toHex branch 2 times, most recently from c3e02cd to 825d3f2 Compare October 29, 2024 08:39
@Snuffleupagus Snuffleupagus marked this pull request as ready for review October 29, 2024 09:01
 - Add explicit `length` validation of the /ID entries. Given the `EMPTY_FINGERPRINT` constant we're already *implicitly* assuming a particular length.

 - Move the constants into the `fingerprints`-getter, since they're not used anywhere else.

 - Replace the `hexString` helper function with the standard `Uint8Array.prototype.toHex` method; see https://github.com/tc39/proposal-arraybuffer-base64
This allows using the new methods in browsers that support them, e.g. Firefox 133+, while still providing fallbacks where necessary; see https://github.com/tc39/proposal-arraybuffer-base64

*Please note:* These are not actual polyfills, but only implements what we need in the PDF.js code-base. Eventually this patch should be reverted, once support is generally available.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/ebb2c4843e3db36/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/6273c2632b50cf7/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/ebb2c4843e3db36/output.txt

Total script time: 30.65 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 15
  different first/second rendering: 3

Image differences available at: http://54.241.84.105:8877/ebb2c4843e3db36/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/6273c2632b50cf7/output.txt

Total script time: 46.16 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@Snuffleupagus Snuffleupagus merged commit 25cf4ad into mozilla:master Oct 29, 2024
10 checks passed
@Snuffleupagus Snuffleupagus deleted the fingerprints-toHex branch October 29, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants