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

Additional check to ensure pdfViewer object is defined before handleMouseWheel event accesses its property isInPresentationMode #7778

Conversation

srslafazan
Copy link

Additional check to ensure pdfViewer object is defined before handleMouseWheel event accesses its property isInPresentationMode

@@ -2000,7 +2000,7 @@ function webViewerPageChanging(e) {
var zoomDisabled = false, zoomDisabledTimeout;
function handleMouseWheel(evt) {
var pdfViewer = PDFViewerApplication.pdfViewer;
if (pdfViewer.isInPresentationMode) {
if (pdfViewer && pdfViewer.isInPresentationMode) {
Copy link
Contributor

@timvandermeij timvandermeij Nov 2, 2016

Choose a reason for hiding this comment

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

If the pdfViewer object is not defined, then we may also be in trouble in the other parts of this function (for example here: https://github.com/mozilla/pdf.js/pull/7778/files#diff-529d1853ee1bba753a0fcb40ea778723R2032). Therefore, I think it would be better to change this line to if (!pdfViewer || pdfViewer.isInPresentationMode) {. That way we get out if pdfViewer is not defined (to avoid more issues) and also when we're in presentation mode.

@timvandermeij
Copy link
Contributor

timvandermeij commented Nov 2, 2016

Looks good to me with the comment adressed. Make sure that after your changes there is still one commit by squashing the commits. Refer to https://github.com/mozilla/pdf.js/wiki/Squashing-Commits for how to do that easily.

…ouseWheel event accesses its property isInPresentationMode
@srslafazan srslafazan force-pushed the defensive-check-for-mousewheel-handler branch from f62d735 to 7fec8de Compare November 3, 2016 19:25
@srslafazan
Copy link
Author

Awesome, thanks! I made the change.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Nov 3, 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/729859bab16fb41/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 3, 2016

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/729859bab16fb41/output.txt

Total script time: 2.71 mins

Published

@timvandermeij timvandermeij merged commit fe3c12b into mozilla:master Nov 3, 2016
@timvandermeij
Copy link
Contributor

Thank you!

movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…ousewheel-handler

Additional check to ensure pdfViewer object is defined before handleMouseWheel event accesses its property isInPresentationMode
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