Skip to content

Shorten the PDFDocument.prototype.fieldObjects getter slightly#19903

Merged
calixteman merged 1 commit intomozilla:masterfrom
Snuffleupagus:shorten-fieldObjects-getter
May 9, 2025
Merged

Shorten the PDFDocument.prototype.fieldObjects getter slightly#19903
calixteman merged 1 commit intomozilla:masterfrom
Snuffleupagus:shorten-fieldObjects-getter

Conversation

@Snuffleupagus
Copy link
Collaborator

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 MissingDataExceptions, 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.

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.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@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/57737e487ed05a3/output.txt

@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/998bbb19f36abec/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/998bbb19f36abec/output.txt

Total script time: 30.00 mins

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

@Snuffleupagus Snuffleupagus requested a review from calixteman May 8, 2025 07:47
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.

@calixteman calixteman merged commit 293506a into mozilla:master May 9, 2025
9 checks passed
@Snuffleupagus Snuffleupagus deleted the shorten-fieldObjects-getter branch May 10, 2025 09:18
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