Skip to content

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

Merged
feerrenrut merged 1 commit into
masterfrom
recogNoLocation
Oct 17, 2017
Merged

recognizeNavigatorObject: Fail gracefully if object's location property returns None.#7567
feerrenrut merged 1 commit into
masterfrom
recogNoLocation

Conversation

@jcsteh

@jcsteh jcsteh commented Sep 5, 2017

Copy link
Copy Markdown
Contributor

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)

…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
- 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants