Repository: nvaccess/nvda

Issue:
Errors in Mozilla Firefox with mouse tracking enabled
**Reported by k_kolev1985 on 2013-11-20 10:42**
If I try to read text in objects (no matter if in the interface or in the virtual document itself) in Mozilla Firefox, by using the "mouse tracking" feature of NVDA, the screen reader may give errors (sounds).

Steps to reproduce it:
1. Enable the mouse tracking of NVDA, and also, just to be sure, enable the option to report the object type under the mouse cursor.
2. Open Firefox and load a page in it.
3. Try reading the page with the mouse, hovering it over the text on the page. Error sounds from NVDA may be heard, but not always.
4. Activate a link, witch points to a file for download (the file type doesn't matter).
5. Try again to read the text in the objects in the "File download" window. NVDA will most probably play its error sound again.

In both cases, I think NVDA reads the text under the mouse cursor, but also plays its error sound.

My configuration:
- OS: Windows 7 Ultimate SP1, 32-bit, in bulgarian (with locale settings also set to bulgarian);
- NVDA version: snapshot next-9985,6740b92, in bulgarian;
- Firefox version: 25.0.1, in bulgarian;

Interestingly enough, the error does not occur with a clean (with no add-ons installed) portable copy of NVDA 2013.3RC2. I think an add-on may be the culprit, but I can't figure out witch one, unfortunately. I'm attaching a NVDA log file with logging level set to "input/output". Hope it helps.
**Blocking #3837**



Discussion:
Attachment nvda-2013-11-20.log added by k_kolev1985 on 2013-11-20 10:43
Description:
Update:
File added from Trac
[nvda-2013-11-20.log.txt](https://github.com/nvaccess/nvda/files/1213506/nvda-2013-11-20.log.txt)

Comment 1 by jteh on 2013-11-20 10:47
I've seen this as well, but haven't had time to look into it. The error sound is disabled in release candidates, which is why you aren't noticing it there.

Comment 3 by mdcurran on 2014-02-04 21:56
It looks as if the underlying cause has been fixed in Firefox Nightly 30.0A1 (Feb 4 2014 build) according to my testing.
Though we should probably at least ensure that _getTextRange in IA2TextTextInfo always returns a string, even if it is empty.

Comment 4 by Sativarg on 2015-08-25 19:35
I have recently installed Windows ten and  have been using the latest test versions of NVDA for several weeks. I noticed the error sound and thought it was just a troubleshooting feature for testing purposes. I decided today to go in and turn it off in the settings. I did not find a setting to disable troubleshooting sounds. I was only able to stop the sound by disabling mouse tracking. I navigated to the NVDA folder waves folder and played the sounds. Error.wav file name and a search on DuckDuckGo lead me here. I have already modified the wave files to set my preferred volume level so I knew were to look. 

In my Firefox the problem seems to worsen on complex pages. The error sound will play when barely moving the mouse in some pages. The sound plays when moving into the scroll bar and from the page to the first tool bar above the page as well.
My setup
windows 10 pro up to date
NVDA version The about screen does not allow copying?
 11405,aa15058  Tue Aug 25 09:09:57 2015

I like the way Firefox gives version info to the clipboard with a few clicks
Name    Firefox
Version     40.0.2
Build ID    20150812163655
Update Channel  release

For the time being I have recorded a silent wave file and replaced error.wav

One such error is:
```
ERROR - eventHandler.executeEvent (10:31:07.707):
error executing event: mouseMove on <NVDAObjects.IAccessible.mozilla.Mozilla object at 0x05160EF0> with extra args of {'y': 401, 'x': 1514}
Traceback (most recent call last):
  File "eventHandler.pyc", line 152, in executeEvent
  File "eventHandler.pyc", line 92, in __init__
  File "eventHandler.pyc", line 100, in next
  File "NVDAObjects\__init__.pyc", line 930, in event_mouseMove
  File "NVDAObjects\IAccessible\__init__.pyc", line 142, in expand
AttributeError: 'NoneType' object has no attribute 'rindex'
```
This is considered fairly harmless, we should stop it from occurring so that it is no longer a red herring.

Resolving patch:
diff --git a/source/NVDAObjects/IAccessible/__init__.py b/source/NVDAObjects/IAccessible/__init__.py
--- a/source/NVDAObjects/IAccessible/__init__.py
+++ b/source/NVDAObjects/IAccessible/__init__.py
@@ -148,6 +148,8 @@ def expand(self,unit):
 		super(IA2TextTextInfo,self).expand(unit)
 		if isMouseChunkUnit:
 			text=self._getTextRange(self._startOffset,self._endOffset)
+			if not text:
+				return
 			try:
 				self._startOffset=text.rindex(u'\ufffc',0,oldStart-self._startOffset)
 			except ValueError:
@@ -199,7 +201,7 @@ def _getLineCount(self):
 
 	def _getTextRange(self,start,end):
 		try:
-			return self.obj.IAccessibleTextObject.text(start,end)
+			return self.obj.IAccessibleTextObject.text(start,end) or u""
 		except COMError:
 			return u""
 


Test patch: