[orca/gnome-3-10] Sanity check to prevent hang in WebKitGtk content.



commit 5227d6f95d83c8e11f97b8fe8199ff8a1f5db2e8
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Dec 11 17:10:55 2013 +0100

    Sanity check to prevent hang in WebKitGtk content.

 src/orca/scripts/toolkits/WebKitGtk/script.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 787544f..f872315 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -573,10 +573,16 @@ class Script(default.Script):
             string = self.utilities.adjustForRepeats(string)
             voice = self.speechGenerator.getVoiceForString(obj, string)
             string = self.utilities.adjustForLinks(obj, string, start)
+            # Incrementing the offset should cause us to eventually reach
+            # the end of the text as indicated by a 0-length string and
+            # start and end offsets of 0. Sometimes WebKitGtk returns the
+            # final text segment instead.
+            if segments and [string, start, end, voice] == segments[-1]:
+                break
+
             segments.append([string, start, end, voice])
             offset = end + 1
             string, start, end = text.getTextAtOffset(offset, boundary)
-
         return segments
 
     def textLines(self, obj):


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