[orca] Fix for bug 668472 - LookupError causes messages in Thunderbird to not be readable



commit f56be615d2c9e7f7c2f6b6530cdc99b808d41a11
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jan 23 09:10:54 2012 +0100

    Fix for bug 668472 - LookupError causes messages in Thunderbird to not be readable

 src/orca/scripts/toolkits/Gecko/script.py |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 9c587a2..8785697 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -2005,17 +2005,21 @@ class Script(default.Script):
             # precedes it.  Therefore, that's what we need to look at when
             # trying to determine our position.
             #
-            if candidate.getRole() in [pyatspi.ROLE_LIST,
-                                       pyatspi.ROLE_COMBO_BOX] \
-               and candidate.getState().contains(pyatspi.STATE_FOCUSABLE) \
+            try:
+                role = candidate.getRole()
+                state = candidate.getState()
+            except LookupError:
+                role = None
+                state = pyatspi.StateSet()
+            if role in [pyatspi.ROLE_LIST, pyatspi.ROLE_COMBO_BOX] \
+               and state.contains(pyatspi.STATE_FOCUSABLE) \
                and not self.utilities.isSameObject(obj, candidate):
                 start = self.utilities.characterOffsetInParent(candidate)
                 end = start + 1
                 candidate = candidate.parent
 
             if self.utilities.isSameObject(obj, candidate) \
-               and (start <= offset < end or candidate.getRole() == \
-               pyatspi.ROLE_ENTRY):
+               and (start <= offset < end or role == pyatspi.ROLE_ENTRY):
                 index = contents.index(content)
                 break
 
@@ -5407,7 +5411,10 @@ class Script(default.Script):
             # wrong.]]]
             #
             if obj and not self._objectForFocusGrab:
-                obj.queryComponent().grabFocus()
+                try:
+                    obj.queryComponent().grabFocus()
+                except LookupError:
+                    pass
 
             if self._objectForFocusGrab:
                 # [[[See https://bugzilla.mozilla.org/show_bug.cgi?id=363214.
@@ -5420,7 +5427,10 @@ class Script(default.Script):
                 #
                 #if objectForFocus.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
                 #    objectForFocus = objectForFocus.parent
-                self._objectForFocusGrab.queryComponent().grabFocus()
+                try:
+                    self._objectForFocusGrab.queryComponent().grabFocus()
+                except LookupError:
+                    pass
 
         text = self.utilities.queryNonEmptyText(obj)
         if text:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]