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

Log an error when the value passed to set currentPageNumber is out of bounds (PR 7502 followup) #7529

Merged
merged 1 commit into from
Aug 7, 2016
Merged

Log an error when the value passed to set currentPageNumber is out of bounds (PR 7502 followup) #7529

merged 1 commit into from
Aug 7, 2016

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Aug 7, 2016

With PR #7502 we no longer dispatch an event when the val is out of bounds, so to better communicate why nothing happens this patch logs an error in that case (similar to the logging of errors when trying to set an invalid scale).

The way that the default viewer is currently implemented, means that e.g. keyboard short-cuts could trigger the new error. Hence this patch also adds the necessary validation code, both to app.js and pdf_link_service.js to prevent unnecessary errors.

Note: perhaps slightly simpler reviewing with https://github.com/mozilla/pdf.js/pull/7529/files?w=1.

},

get page() { // TODO remove
return this.pdfLinkService.page;
return this.pdfViewer.currentPageNumber;
Copy link
Contributor

@timvandermeij timvandermeij Aug 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this does not use the link service anymore, do we still need the TODO remove comment one line above? I don't see why this getter needs to go, and otherwise I think the setter would have to go as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not entirely sure why that comment is there in the first place, and we probably should keep the page getter/setter around for backwards compatibility.
I'll just remove the comment; thanks for pointing this out!

…of bounds (PR 7502 followup)

With PR 7502 we no longer dispatch an event when the `val` is out of bounds, so to better communicate why nothing happens this patch logs an error in that case (similar to the logging of errors when trying to set an invalid scale).

The way that the default viewer is currently implemented, means that e.g. keyboard short-cuts could trigger the new error. Hence this patch also adds the necessary validation code, both to `app.js` and `pdf_link_service.js` to prevent unnecessary errors.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2016

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/3c656244020b94b/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2016

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/3c656244020b94b/output.txt

Total script time: 1.02 mins

Published

@timvandermeij timvandermeij merged commit ca81f4d into mozilla:master Aug 7, 2016
@timvandermeij
Copy link
Contributor

Thank you for working on this!

@Snuffleupagus Snuffleupagus deleted the setCurrentPageNumber-warn-on-outOfBounds branch August 7, 2016 14:17
@Snuffleupagus
Copy link
Collaborator Author

@timvandermeij And thank you for reviewing this, and other PRs!

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