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

Some hasJSActions, and general annotation-code, related cleanup in the viewer and API #12622

Merged
merged 1 commit into from
Nov 14, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

  • Add support for logical assignment operators, i.e. &&=, ||=, and ??=, with a Babel-plugin. Given that these required incrementing the ECMAScript version in the ESLint and Acorn configurations, and that platform/browser support is still fairly limited, always transpiling them seems appropriate for now.

  • Cache the hasJSActions promise in the API, similar to the existing getAnnotations caching. With this implemented, the lookup should now be cheap enough that it can be called unconditionally in the viewer.

  • Slightly improve cleanup of resources when destroying the WorkerTransport.

  • Remove the annotationStorage-property from the PDFPageView constructor, since it's not necessary and also brings it more inline with the BaseViewer.

  • Update the BaseViewer.createAnnotationLayerBuilder method to actaually agree with the IPDFAnnotationLayerFactory interface.[1]

  • Slightly tweak a couple of JSDoc comments.


[1] We probably ought to re-factor both the IPDFTextLayerFactory and IPDFAnnotationLayerFactory interfaces to take parameter objects instead, since especially the IPDFAnnotationLayerFactory one is becoming quite unwieldy. Given that that would likely be a breaking change for any custom viewer-components implementation, this probably requires careful deprecation.

…the viewer and API

 - Add support for logical assignment operators, i.e. `&&=`, `||=`, and `??=`, with a Babel-plugin. Given that these required incrementing the ECMAScript version in the ESLint and Acorn configurations, and that platform/browser support is still fairly limited, always transpiling them seems appropriate for now.

 - Cache the `hasJSActions` promise in the API, similar to the existing `getAnnotations` caching. With this implemented, the lookup should now be cheap enough that it can be called unconditionally in the viewer.

 - Slightly improve cleanup of resources when destroying the `WorkerTransport`.

 - Remove the `annotationStorage`-property from the `PDFPageView` constructor, since it's not necessary and also brings it more inline with the `BaseViewer`.

 - Update the `BaseViewer.createAnnotationLayerBuilder` method to actaually agree with the `IPDFAnnotationLayerFactory` interface.[1]

 - Slightly tweak a couple of JSDoc comments.

---
[1] We probably ought to re-factor both the `IPDFTextLayerFactory` and `IPDFAnnotationLayerFactory` interfaces to take parameter objects instead, since especially the `IPDFAnnotationLayerFactory` one is becoming quite unwieldy. Given that that would likely be a breaking change for any custom viewer-components implementation, this probably requires careful deprecation.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/904e975ead9cf2e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/904e975ead9cf2e/output.txt

Total script time: 4.13 mins

Published

@timvandermeij
Copy link
Contributor

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/6728317f0b07f38/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_unittest from @timvandermeij received. Current queue size: 0

Live output at: http://3.101.106.178:8877/be7bf0ba5b36742/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/6728317f0b07f38/output.txt

Total script time: 3.70 mins

  • Unit Tests: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/be7bf0ba5b36742/output.txt

Total script time: 4.65 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit 2aefc40 into mozilla:master Nov 14, 2020
@timvandermeij
Copy link
Contributor

Thank you for doing this!

@Snuffleupagus Snuffleupagus deleted the hasJSActions-cleanup branch November 14, 2020 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants