[orca] Web: Return early when asking for object or line contents of dead object



commit 7cb9c2d381681bd18e476582e72371aae25f2281
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Feb 27 13:32:49 2021 +0100

    Web: Return early when asking for object or line contents of dead object
    
    If an object has been destroyed, and is inside a giant subtree of
    just-destroyed elements, we will spend a potentially very long
    time trying to find contents, and in the end still fail. So bail
    immediately if the object is dead.

 src/orca/scripts/web/script_utilities.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 87406e6af..59646a8ff 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1570,6 +1570,11 @@ class Utilities(script_utilities.Utilities):
         if not obj:
             return []
 
+        if self.isDead(obj):
+            msg = "ERROR: Cannot get object contents at offset for dead object."
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return []
+
         offset = max(0, offset)
 
         if useCache:
@@ -1683,6 +1688,11 @@ class Utilities(script_utilities.Utilities):
         if not obj:
             return []
 
+        if self.isDead(obj):
+            msg = "ERROR: Cannot get line contents at offset for dead object."
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return []
+
         text = self.queryNonEmptyText(obj)
         offset = max(0, offset)
 


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