[orca] More debugging output and a Zombie check for Gecko content



commit 6540a51d60b11964bff635361298635d9ffe9ebe
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jun 1 16:06:47 2015 -0400

    More debugging output and a Zombie check for Gecko content

 src/orca/scripts/toolkits/Gecko/script.py          |   20 ++++++++++++++++++++
 .../scripts/toolkits/Gecko/script_utilities.py     |    4 ++--
 2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 80a1dae..c073218 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1928,13 +1928,23 @@ class Script(default.Script):
             return True
 
         obj, offset = self.utilities.getCaretContext()
+        msg = "INFO: Current context is: %s, %i" % (obj, offset)
+        debug.println(debug.LEVEL_INFO, msg)
+
         line = self.utilities.getLineContentsAtOffset(obj, offset)
         if not (line and line[0]):
+            msg = "INFO: Could not get line contents for %s, %i" % (obj, offset)
+            debug.println(debug.LEVEL_INFO, msg)
             return False
 
         obj, offset = self.utilities.previousContext(line[0][0], line[0][1], True)
+        msg = "INFO: Previous context is: %s, %i" % (obj, offset)
+        debug.println(debug.LEVEL_INFO, msg)
+
         contents = self.utilities.getLineContentsAtOffset(obj, offset)
         if not contents:
+            msg = "INFO: Could not get line contents for %s, %i" % (obj, offset)
+            debug.println(debug.LEVEL_INFO, msg)
             return False
 
         obj, start = contents[0][0], contents[0][1]
@@ -1956,13 +1966,23 @@ class Script(default.Script):
             return True
 
         obj, offset = self.utilities.getCaretContext()
+        msg = "INFO: Current context is: %s, %i" % (obj, offset)
+        debug.println(debug.LEVEL_INFO, msg)
+
         line = self.utilities.getLineContentsAtOffset(obj, offset)
         if not (line and line[0]):
+            msg = "INFO: Could not get line contents for %s, %i" % (obj, offset)
+            debug.println(debug.LEVEL_INFO, msg)
             return False
 
         obj, offset = self.utilities.nextContext(line[-1][0], line[-1][2] - 1, True)
+        msg = "INFO: Next context is: %s, %i" % (obj, offset)
+        debug.println(debug.LEVEL_INFO, msg)
+
         contents = self.utilities.getLineContentsAtOffset(obj, offset)
         if not contents:
+            msg = "INFO: Could not get line contents for %s, %i" % (obj, offset)
+            debug.println(debug.LEVEL_INFO, msg)
             return False
 
         obj, start = contents[0][0], contents[0][1]
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index f5b43fa..f587c7d 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -1867,7 +1867,7 @@ class Utilities(script_utilities.Utilities):
         if self.isSameObject(obj, documentFrame):
             return None, -1
 
-        while obj.parent and obj != obj.parent:
+        while obj.parent and not self.isZombie(obj.parent):
             start, end, length = self._rangeInParentWithLength(obj)
             if start + 1 == end and 0 <= start < end <= length:
                 return self.findNextCaretInOrder(obj.parent, start)
@@ -1908,7 +1908,7 @@ class Utilities(script_utilities.Utilities):
         if self.isSameObject(obj, documentFrame):
             return None, -1
 
-        while obj.parent and obj != obj.parent:
+        while obj.parent and not self.isZombie(obj.parent):
             start, end, length = self._rangeInParentWithLength(obj)
             if start + 1 == end and 0 <= start < end <= length:
                 return self.findPreviousCaretInOrder(obj.parent, start)


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