[WebAccessibilityObjectWrapper detach] should detach either the wrapped AXObject...
[WebKit-https.git] / Source / WebCore / accessibility / mac / WebAccessibilityObjectWrapperBase.mm
index b423736..592be96 100644 (file)
@@ -310,13 +310,29 @@ NSArray *convertToNSArray(const WebCore::AXCoreObject::AccessibilityChildrenVect
 }
 #endif
 
-- (void)detach
+- (void)detachAXObject
 {
     m_axObject = nullptr;
+}
+
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
+- (void)detachIsolatedObject
+{
     m_isolatedObject = nullptr;
+}
 #endif
+
+- (void)detach
+{
     _identifier = InvalidAXID;
+#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
+    if (!isMainThread()) {
+        ASSERT(AXObjectCache::clientSupportsIsolatedTree());
+        [self detachIsolatedObject];
+        return;
+    }
+#endif
+    [self detachAXObject];
 }
 
 - (BOOL)updateObjectBackingStore