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

[api-minor] Fix the AnnotationStorage usage properly in the viewer/tests (PR 12107 and 12143 follow-up) #12147

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Jul 31, 2020

The [api-minor] label probably ought to have been added to the original PR, given the changes to the createAnnotationLayerBuilder signature (if nothing else).

This patch fixes the following things:

  • Let the AnnotationLayer.render method create an AnnotationStorage-instance if none was provided, thus making the parameter properly optional. This not only fixes the reference tests, it also prevents issues when the viewer components are used.
  • Stop exporting AnnotationStorage in the official API, i.e. the src/pdf.js file, since it's no longer necessary given the change above. Generally speaking, unless absolutely necessary we probably shouldn't export unused things in the API.
  • Fix a number of JSDocs typedefs, in src/display/ and web/ code, to actually account for the new annotationStorage parameter.
  • Update web/interfaces.js to account for the changes in createAnnotationLayerBuilder.
  • Initialize the storage, in AnnotationStorage, using Object.create(null) rather than {} (which is the PDF.js default).

…tests (PR 12107 and 12143 follow-up)

*The [api-minor] label probably ought to have been added to the original PR, given the changes to the `createAnnotationLayerBuilder` signature (if nothing else).*

This patch fixes the following things:
 - Let the `AnnotationLayer.render` method create an `AnnotationStorage`-instance if none was provided, thus making the parameter *properly* optional. This not only fixes the reference tests, it also prevents issues when the viewer components are used.
 - Stop exporting `AnnotationStorage` in the official API, i.e. the `src/pdf.js` file, since it's no longer necessary given the change above. Generally speaking, unless absolutely necessary we probably shouldn't export unused things in the API.
 - Fix a number of JSDocs `typedef`s, in `src/display/` and `web/` code, to actually account for the new `annotationStorage` parameter.
 - Update `web/interfaces.js` to account for the changes in `createAnnotationLayerBuilder`.
 - Initialize the storage, in `AnnotationStorage`, using `Object.create(null)` rather than `{}` (which is the PDF.js default).
@Snuffleupagus Snuffleupagus force-pushed the fix-AnnotationStorage-usage branch from ad98eeb to 346afd1 Compare July 31, 2020 14:33
… as cloning a `PageViewport`, when no annotations exist for a page
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/bf37c8009b1cde8/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/e6d0aa755e12bcc/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/bf37c8009b1cde8/output.txt

Total script time: 26.83 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/e6d0aa755e12bcc/output.txt

Total script time: 29.18 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

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

@timvandermeij timvandermeij added annotations form-acroform Gecko 81 Tracking work planned for Form Fill in Shirley 81 release labels Jul 31, 2020
@timvandermeij timvandermeij merged commit b037e59 into mozilla:master Jul 31, 2020
@timvandermeij
Copy link
Contributor

Thank you for improving this!

@timvandermeij
Copy link
Contributor

I also marked the original PR as [api-minor] now.

@Snuffleupagus Snuffleupagus deleted the fix-AnnotationStorage-usage branch August 1, 2020 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotations form-acroform Gecko 81 Tracking work planned for Form Fill in Shirley 81 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants