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

recognizeNavigatorObject: Fail gracefully if object's location property returns None. #7567

Merged
merged 1 commit into from Oct 17, 2017

Conversation

Projects
None yet
3 participants
@jcsteh
Contributor

jcsteh commented Sep 5, 2017

Link to issue number:

Reported by @derekriemer in #7476 (comment).

Summary of the issue:

If you attempt to recognize an object where the location property returns None for some reason (e.g. the object died), you get this unhandled exception:

ERROR - scriptHandler.executeScript (03:14:01.536):
error executing script: <bound method GlobalCommands.script_recognizeWithCaptionBot of <globalCommands.GlobalCommands object at 0x0595E2D0>> with gesture u'alt+NVDA+d'
Traceback (most recent call last):
File "scriptHandler.py", line 187, in executeScript
script(gesture)
File "globalCommands.py", line 2064, in script_recognizeWithCaptionBot
recogUi.recognizeNavigatorObject(recog)
File "contentRecog\recogUi.py", line 129, in recognizeNavigatorObject
left, top, width, height = nav.location
TypeError: 'NoneType' object is not iterable

Description of how this pull request fixes the issue:

We catch the TypeError exception, report "Content is not visible" to the user and log a debugWarning.

Testing performed:

  1. Opened google.com in Firefox.
  2. Turned off caret moves review cursor (NVDA+6) and focus moves navigator object (NVDA+7).
  3. Opened nvaccess.org.
  4. Pressed NVDA+r.

Known issues with pull request:

None.

Change log entry:

Bug fixes:

- When using a content recognition command (e.g. NVDA+r), NVDA now reports an error message instead of nothing if the navigator object has disappeared. (#7567)
recognizeNavigatorObject: Fail gracefully if object's location proper…
…ty returns None.

We now report "Content is not visible" to the user and log a debugWarning instead of throwing an unhandled exception.

jcsteh added a commit that referenced this pull request Sep 11, 2017

@feerrenrut feerrenrut merged commit 6ac86c8 into master Oct 17, 2017

@nvaccessAuto nvaccessAuto added this to the 2017.4 milestone Oct 17, 2017

feerrenrut added a commit that referenced this pull request Oct 17, 2017

Update changes file for PR #7567
- When using a content recognition command (e.g. NVDA+r), NVDA now
  reports an error message instead of nothing if the navigator object
  has disappeared. (#7567)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment