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

Add a reset method to the PDFHistory implementation #11380

Merged
merged 3 commits into from
Dec 15, 2019

Conversation

Snuffleupagus
Copy link
Collaborator

This patch addresses a couple of smaller issues with the PDFHistory class:

  • Most, if not all, other viewer components can be reset in one way or another, and there's no good reason for the PDFHistory implementation to be different here.

  • Currently it's (technically) possible to keep adding entries to the browser history, via the PDFHistory instance, even after the document has been closed. That obviously makes no sense, and is caused by the lack of a reset method.

  • The internal this._isPagesLoaded property was never actually reset, which would lead to it being temporarily wrong when a new document was opened in the default viewer.

@Snuffleupagus Snuffleupagus force-pushed the PDFHistory-reset branch 2 times, most recently from ca7f8d0 to c65c2e2 Compare December 10, 2019 11:20
@Snuffleupagus Snuffleupagus marked this pull request as ready for review December 10, 2019 13:04
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

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

Total script time: 1.72 mins

Published

This patch addresses a couple of smaller issues with the `PDFHistory` class:
 - Most, if not all, other viewer components can be reset in one way or another, and there's no good reason for the `PDFHistory` implementation to be different here.

 - Currently it's (technically) possible to keep adding entries to the browser history, via the `PDFHistory` instance, even after the document has been closed. That obviously makes no sense, and is caused by the lack of a `reset` method.

 - The internal `this._isPagesLoaded` property was never actually reset, which would lead to it being temporarily wrong when a new document was opened in the default viewer.
Looking at the `parseCurrentHash` function again it's now difficult for me to understand *what* I was thinking, since having a helper function that needs to be manually passed a `linkService` reference just looks weird.
…ate`, for e.g. MOZCENTRAL builds

By re-ordering the condition, which includes a `PDFJSDev` check, we can avoid meaningless output in the built files.
@timvandermeij
Copy link
Contributor

Nice work!

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