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

Run AnnotationStorage.resetModified when destroying the PDFDocumentLoadingTask/PDFDocumentProxy #12758

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

This will, in a very simple way using the existing events, thus allow the viewer to remove the "beforeunload" window event listener when the document is closed.
Generally speaking we want to avoid having global event listeners for the PDF document instance, which is why the EventBus exists, and instead reserve global events for the viewer itself. However, the AnnotationStorage "beforeunload" event unfortunately needs to be document-specific and we should thus ensure that it's correctly removed when the document is destroyed.

… a new `PDFViewerApplication` method instead

Given that this relies on accessing properties on the `PDFDocumentProxy`-instance, it seems more appropriate for this code to live in `PDFViewerApplication`.
… the default viewer

These callbacks should not be necessary *before* the document has been initialized. Furthermore, move the functionality to a new helper-method since `PDFViewerApplication.load` is already quite large.
…tLoadingTask`/`PDFDocumentProxy`

This will, in a very simple way using the existing events, thus allow the viewer to remove the "beforeunload" `window` event listener when the document is closed.
Generally speaking we want to avoid having *global* event listeners for the PDF document instance, which is why the `EventBus` exists, and instead reserve global events for the viewer itself. However, the `AnnotationStorage` "beforeunload" event unfortunately needs to be document-specific and we should thus ensure that it's correctly removed when the document is destroyed.
@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/482a67342d17b21/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/482a67342d17b21/output.txt

Total script time: 4.27 mins

Published

@timvandermeij timvandermeij merged commit 1c8ead1 into mozilla:master Dec 19, 2020
@timvandermeij
Copy link
Contributor

Looks good!

@Snuffleupagus Snuffleupagus deleted the AnnotationStorage-rm-event branch December 19, 2020 21:33
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