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

Check that the correct pdfDocument is still active, before rendering the outline/attachments/layers #13212

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

This patch fixes some technical debt in the viewer.

Given that most API methods are (purposely) asynchronous, there's always a risk that the viewer could have been closed before the requested data arrives.
Lately we've started to check this case before using the data, to prevent errors and/or inconsistent state, however the outline/attachments/layers fetching and rendering is old enough that it pre-dates those checks.

…g the outline/attachments/layers

*This patch fixes some technical debt in the viewer.*

Given that most API methods are (purposely) asynchronous, there's always a risk that the viewer could have been `close`d before the requested data arrives.
Lately we've started to check this case before using the data, to prevent errors and/or inconsistent state, however the outline/attachments/layers fetching and rendering is old enough that it pre-dates those checks.
… (PR 12777 follow-up)

It's obviously better and more correct to handle the "pagesloaded" case within `PDFOutlineViewer` *itself*, rather than essentially splitting the logic in two parts and forcing `PDFSidebar` to deal with what should've been handled internally in `PDFOutlineViewer`.

This is what I *should* have done in PR	12777, but for some reason didn't figure out how to implement it well enough back then; sorry about the churn here!
@timvandermeij
Copy link
Contributor

/botio-windows preview

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 10.29 mins

Published

@timvandermeij timvandermeij merged commit 86374d4 into mozilla:master Apr 10, 2021
@timvandermeij
Copy link
Contributor

Looks good!

@Snuffleupagus Snuffleupagus deleted the BaseTreeViewer-init-checks branch April 10, 2021 13:07
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.

None yet

3 participants