[orca] Fix for bgo#620671 - Timing problem with generator cache



commit a500db83ec029af7329a5e71f5fdbdb980f4f8ef
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sat Jun 5 13:08:06 2010 -0400

    Fix for bgo#620671 - Timing problem with generator cache

 src/orca/script_utilities.py              |    5 +++--
 src/orca/scripts/toolkits/Gecko/script.py |   19 +++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 191993e..8c7477c 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -531,8 +531,6 @@ class Utilities:
         try:
             return self._script.generatorCache[self.DISPLAYED_TEXT][obj]
         except:
-            if not self._script.generatorCache.has_key(self.DISPLAYED_TEXT):
-                self._script.generatorCache[self.DISPLAYED_TEXT] = {}
             displayedText = None
 
         role = obj.getRole()
@@ -594,6 +592,9 @@ class Utilities:
                         displayedText = \
                             self.appendString(displayedText, childText)
 
+        if not self._script.generatorCache.has_key(self.DISPLAYED_TEXT):
+            self._script.generatorCache[self.DISPLAYED_TEXT] = {}
+
         self._script.generatorCache[self.DISPLAYED_TEXT][obj] = displayedText
         return self._script.generatorCache[self.DISPLAYED_TEXT][obj]
 
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 650e94f..be16a28 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -2633,8 +2633,8 @@ class Script(default.Script):
         try:
             return self.generatorCache['inDocumentContent'][obj]
         except:
-            if not self.generatorCache.has_key('inDocumentContent'):
-                self.generatorCache['inDocumentContent'] = {}
+            pass
+
         result = False
         while obj:
             role = obj.getRole()
@@ -2644,8 +2644,14 @@ class Script(default.Script):
                 break
             else:
                 obj = obj.parent
-        self.generatorCache['inDocumentContent'][obj] = result
-        return self.generatorCache['inDocumentContent'][obj]
+
+        if not self.generatorCache.has_key('inDocumentContent'):
+            self.generatorCache['inDocumentContent'] = {}
+
+        if obj:
+            self.generatorCache['inDocumentContent'][obj] = result
+            
+        return result
 
     def useCaretNavigationModel(self, keyboardEvent):
         """Returns True if we should do our own caret navigation.
@@ -2855,10 +2861,11 @@ class Script(default.Script):
         try:
             return self.generatorCache['isAria'][obj]
         except:
-            if not self.generatorCache.has_key('isAria'):
-                self.generatorCache['isAria'] = {}
+            pass
         obj = obj or orca_state.locusOfFocus
         attrs = self._getAttrDictionary(obj)
+        if not self.generatorCache.has_key('isAria'):
+            self.generatorCache['isAria'] = {}
         self.generatorCache['isAria'][obj] = \
             ('xml-roles' in attrs and 'live' not in attrs)
         return self.generatorCache['isAria'][obj]



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