[orca/gnome-41] Structural Navigation: Handle unimplemented collection interface error



commit 0c69e6c8d9ab2b284b5099799930574cd27e75bf
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue May 17 14:14:09 2022 +0200

    Structural Navigation: Handle unimplemented collection interface error
    
    The collection interface is something applications and toolkits get
    "for free" from AT-SPI2. However, applications/toolkits that provide
    their own implementation of AT-SPI2 (e.g. WebKitGtk) presumably need
    to also implement AtspiCollection themselves, or do something so that
    the default AT-SPI2 implementation is used. Currently, in WebKitGtk
    version 2.36, a non-implemented error occurs when querying the
    collection interface on the document. We were not handling this error,
    causing Orca to be silent when structural navigation commands were
    used. This commit handles the error. It cannot solve the missing
    implementation, however. Thus in WebKitGtk apps,  Orca will now announce
    things like "no more headings" when there are in fact headings present.
    
    See issue #244

 src/orca/structural_navigation.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index c93c419cb..17200da12 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -870,7 +870,17 @@ class StructuralNavigation:
         if matches:
             return matches.copy(), criteria
 
-        col = document.queryCollection()
+        try:
+            col = document.queryCollection()
+        except NotImplementedError:
+            msg = "STRUCTURAL NAVIGATION: %s does not implement collection" % document
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return [], None
+        except:
+            msg = "STRUCTURAL NAVIGATION: Exception querying collection on %s" % document
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return [], None
+
         criteria = structuralNavigationObject.criteria(col, arg)
         rule = col.createMatchRule(criteria.states.raw(),
                                    criteria.matchStates,


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