Changeset 244631 in webkit
- Timestamp:
- Apr 24, 2019 5:49:08 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r244630 r244631 1 2019-04-24 Andres Gonzalez <andresg_22@apple.com> 2 3 Flaky crash under WebCore::AXObjectCache::stopCachingComputedObjectAttributes() 4 https://bugs.webkit.org/show_bug.cgi?id=187391 5 <rdar://problem/40681396 6 7 Check for null value returned by AccessibilityObject::axObjectCache. 8 9 Reviewed by Chris Fleizach. 10 11 No need for new test since existing tests caught this problem. 12 13 * accessibility/AccessibilityNodeObject.cpp: 14 (WebCore::AccessibilityNodeObject::firstChild const): 15 (WebCore::AccessibilityNodeObject::lastChild const): 16 (WebCore::AccessibilityNodeObject::previousSibling const): 17 (WebCore::AccessibilityNodeObject::nextSibling const): 18 (WebCore::AccessibilityNodeObject::addChildren): 19 (WebCore::AccessibilityNodeObject::anchorElement const): 20 (WebCore::AccessibilityNodeObject::changeValueByStep): 21 (WebCore::AccessibilityNodeObject::changeValueByPercent): 22 (WebCore::AccessibilityNodeObject::textForLabelElement const): 23 (WebCore::AccessibilityNodeObject::titleElementText const): 24 (WebCore::AccessibilityNodeObject::alternativeText const): 25 (WebCore::AccessibilityNodeObject::ariaLabeledByText const): 26 (WebCore::AccessibilityNodeObject::helpText const): 27 1 28 2019-04-24 Simon Fraser <simon.fraser@apple.com> 2 29 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r244582 r244631 178 178 if (!firstChild) 179 179 return nullptr; 180 181 return axObjectCache()->getOrCreate(firstChild); 180 181 auto objectCache = axObjectCache(); 182 return objectCache ? objectCache->getOrCreate(firstChild) : nullptr; 182 183 } 183 184 … … 190 191 if (!lastChild) 191 192 return nullptr; 192 193 return axObjectCache()->getOrCreate(lastChild); 193 194 auto objectCache = axObjectCache(); 195 return objectCache ? objectCache->getOrCreate(lastChild) : nullptr; 194 196 } 195 197 … … 203 205 return nullptr; 204 206 205 return axObjectCache()->getOrCreate(previousSibling); 207 auto objectCache = axObjectCache(); 208 return objectCache ? objectCache->getOrCreate(previousSibling) : nullptr; 206 209 } 207 210 … … 215 218 return nullptr; 216 219 217 return axObjectCache()->getOrCreate(nextSibling); 220 auto objectCache = axObjectCache(); 221 return objectCache ? objectCache->getOrCreate(nextSibling) : nullptr; 218 222 } 219 223 … … 345 349 if (renderer() && !m_node->hasTagName(canvasTag)) 346 350 return; 347 351 352 auto objectCache = axObjectCache(); 353 if (!objectCache) 354 return; 355 348 356 for (Node* child = m_node->firstChild(); child; child = child->nextSibling()) 349 addChild( axObjectCache()->getOrCreate(child));357 addChild(objectCache->getOrCreate(child)); 350 358 351 359 m_subtreeDirty = false; … … 950 958 951 959 AXObjectCache* cache = axObjectCache(); 960 if (!cache) 961 return nullptr; 952 962 953 963 // search up the DOM tree for an anchor element … … 1097 1107 setValue(String::numberToStringFixedPrecision(value)); 1098 1108 1099 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged); 1109 auto objectCache = axObjectCache(); 1110 if (objectCache) 1111 objectCache->postNotification(node(), AXObjectCache::AXValueChanged); 1100 1112 } 1101 1113 … … 1113 1125 setValue(String::numberToStringFixedPrecision(value)); 1114 1126 1115 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged); 1127 auto objectCache = axObjectCache(); 1128 if (objectCache) 1129 objectCache->postNotification(node(), AXObjectCache::AXValueChanged); 1116 1130 } 1117 1131 … … 1274 1288 if (!is<HTMLLabelElement>(*element)) 1275 1289 return result; 1276 1290 1291 auto objectCache = axObjectCache(); 1292 if (!objectCache) 1293 return result; 1294 1277 1295 HTMLLabelElement* label = downcast<HTMLLabelElement>(element); 1278 1296 // Check to see if there's aria-labelledby attribute on the label element. 1279 if (AccessibilityObject* labelObject = axObjectCache()->getOrCreate(label))1297 if (AccessibilityObject* labelObject = objectCache->getOrCreate(label)) 1280 1298 result = labelObject->ariaLabeledByAttribute(); 1281 1299 … … 1292 1310 if (HTMLLabelElement* label = labelForElement(downcast<Element>(node))) { 1293 1311 String innerText = textForLabelElement(label); 1294 1312 1313 auto objectCache = axObjectCache(); 1295 1314 // Only use the <label> text if there's no ARIA override. 1296 if ( !innerText.isEmpty() && !ariaAccessibilityDescription())1297 textOrder.append(AccessibilityText(innerText, isMeter() ? AccessibilityTextSource::Alternative : AccessibilityTextSource::LabelByElement, axObjectCache()->getOrCreate(label)));1315 if (objectCache && !innerText.isEmpty() && !ariaAccessibilityDescription()) 1316 textOrder.append(AccessibilityText(innerText, isMeter() ? AccessibilityTextSource::Alternative : AccessibilityTextSource::LabelByElement, objectCache->getOrCreate(label))); 1298 1317 return; 1299 1318 } … … 1341 1360 return; 1342 1361 1362 auto objectCache = axObjectCache(); 1343 1363 // The fieldset element derives its alternative text from the first associated legend element if one is available. 1344 if ( is<HTMLFieldSetElement>(*node)) {1345 AccessibilityObject* object = axObjectCache()->getOrCreate(downcast<HTMLFieldSetElement>(*node).legend());1364 if (objectCache && is<HTMLFieldSetElement>(*node)) { 1365 AccessibilityObject* object = objectCache->getOrCreate(downcast<HTMLFieldSetElement>(*node).legend()); 1346 1366 if (object && !object->isHidden()) 1347 1367 textOrder.append(AccessibilityText(accessibleNameForNode(object->node()), AccessibilityTextSource::Alternative)); … … 1487 1507 String ariaLabeledBy = ariaLabeledByAttribute(); 1488 1508 if (!ariaLabeledBy.isEmpty()) { 1509 auto objectCache = axObjectCache(); 1510 if (!objectCache) 1511 return; 1512 1489 1513 Vector<Element*> elements; 1490 1514 ariaLabeledByElements(elements); 1491 1515 1492 1516 Vector<RefPtr<AccessibilityObject>> axElements; 1493 1517 for (const auto& element : elements) 1494 axElements.append( axObjectCache()->getOrCreate(element));1518 axElements.append(objectCache->getOrCreate(element)); 1495 1519 1496 1520 textOrder.append(AccessibilityText(ariaLabeledBy, AccessibilityTextSource::Alternative, WTFMove(axElements))); … … 1617 1641 return title; 1618 1642 } 1619 1620 // Only take help text from an ancestor element if its a group or an unknown role. If help was 1643 1644 auto objectCache = axObjectCache(); 1645 if (!objectCache) 1646 return String(); 1647 1648 // Only take help text from an ancestor element if its a group or an unknown role. If help was 1621 1649 // added to those kinds of elements, it is likely it was meant for a child element. 1622 if (AccessibilityObject* axObj = axObjectCache()->getOrCreate(ancestor)) {1650 if (AccessibilityObject* axObj = objectCache->getOrCreate(ancestor)) { 1623 1651 if (!axObj->isGroup() && axObj->roleValue() != AccessibilityRole::Unknown) 1624 1652 break;
Note: See TracChangeset
for help on using the changeset viewer.