ASSERTION FAILED: cache under WebCore::AXObjectCache::postTextStateChangePlatformNoti...
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2019 09:55:34 +0000 (09:55 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2019 09:55:34 +0000 (09:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189094
<rdar://problem/43853526>

Reviewed by Zalan Bujtas.

Source/WebCore:

Protect against access to objects and cache's that can be removed while an object is still in memory.

Unskipped flaky tests on mac-wk2.

* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(textMarkerForVisiblePosition):
(textMarkerRangeFromVisiblePositions):

LayoutTests:

Unskip flaky test with crash resolved.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240773 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 7da39ae..3dd7d64 100644 (file)
@@ -1,3 +1,15 @@
+2019-01-31  Chris Fleizach  <cfleizach@apple.com>
+
+        ASSERTION FAILED: cache under WebCore::AXObjectCache::postTextStateChangePlatformNotification
+        https://bugs.webkit.org/show_bug.cgi?id=189094
+        <rdar://problem/43853526>
+
+        Reviewed by Zalan Bujtas.
+
+        Unskip flaky test with crash resolved.
+
+        * platform/mac-wk2/TestExpectations:
+
 2019-01-30  Ryosuke Niwa  <rniwa@webkit.org>
 
         Enable swipe tests on iOS
index 943ca2a..d86bb4f 100644 (file)
@@ -894,8 +894,6 @@ imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-m
 imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ]
 imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]
 
-webkit.org/b/189094 [ HighSierra+ ] accessibility/mac/focus-setting-selection-syncronizing-not-clearing.html [ Skip ]
-
 webkit.org/b/189598 compositing/backing/backing-store-attachment-fill-forwards-animation.html [ Pass Failure ]
 
 # Skip local authenticator tests for mac now.
index fd03b74..2b6c522 100644 (file)
@@ -1,3 +1,21 @@
+2019-01-31  Chris Fleizach  <cfleizach@apple.com>
+
+        ASSERTION FAILED: cache under WebCore::AXObjectCache::postTextStateChangePlatformNotification
+        https://bugs.webkit.org/show_bug.cgi?id=189094
+        <rdar://problem/43853526>
+
+        Reviewed by Zalan Bujtas.
+
+        Protect against access to objects and cache's that can be removed while an object is still in memory.
+
+        Unskipped flaky tests on mac-wk2.
+
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (textMarkerForVisiblePosition):
+        (textMarkerRangeFromVisiblePositions):
+
 2019-01-30  Chris Dumez  <cdumez@apple.com>
 
         Regression(PSON) History navigations to twitter.com lead to a 403 HTTP error
index 2fd9d9a..d075550 100644 (file)
@@ -408,9 +408,11 @@ void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject*
     if (id wrapper = object->wrapper())
         [userInfo setObject:wrapper forKey:NSAccessibilityTextChangeElement];
 
-    AXPostNotificationWithUserInfo(rootWebArea()->wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
-    if (rootWebArea()->wrapper() != object->wrapper())
-        AXPostNotificationWithUserInfo(object->wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
+    if (auto root = rootWebArea()) {
+        AXPostNotificationWithUserInfo(rootWebArea()->wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
+        if (root->wrapper() != object->wrapper())
+            AXPostNotificationWithUserInfo(object->wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
+    }
 
     [userInfo release];
 }
index ea83ea1..2c61541 100644 (file)
@@ -715,7 +715,9 @@ static CharacterOffset characterOffsetForTextMarker(AXObjectCache* cache, CFType
 static id textMarkerForVisiblePosition(AXObjectCache* cache, const VisiblePosition& visiblePos)
 {
     ASSERT(cache);
-
+    if (!cache)
+        return nil;
+    
     auto textMarkerData = cache->textMarkerDataForVisiblePosition(visiblePos);
     if (!textMarkerData)
         return nil;
@@ -1113,6 +1115,9 @@ static NSString* nsStringForReplacedNode(Node* replacedNode)
 
 static id textMarkerRangeFromVisiblePositions(AXObjectCache* cache, const VisiblePosition& startPosition, const VisiblePosition& endPosition)
 {
+    if (!cache)
+        return nil;
+    
     id startTextMarker = textMarkerForVisiblePosition(cache, startPosition);
     id endTextMarker = textMarkerForVisiblePosition(cache, endPosition);
     return textMarkerRangeFromMarkers(startTextMarker, endTextMarker);