0

[a11y] Accessibility bridge rejects actions on invalidtrees.

This change rejects actions performed on invalid accessibility trees by
checking if the tree still exists.

Test: Does not crash during manual test of b/2736858
Bug: 1180440
Bug: b/2736858

Change-Id: I12ca7b9ac53e0a026ce62b29b165f4cb169dd403
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2736858
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Sharon Yang <yangsharon@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#859902}
This commit is contained in:
Lucas Radaelli
2021-03-04 20:23:24 +00:00
committed by Chromium LUCI CQ
parent ee860cb18f
commit 1e82f57730

@ -176,9 +176,14 @@ void AccessibilityBridge::OnAccessibilityActionRequested(
action_data.scroll_behavior = ax::mojom::ScrollBehavior::kScrollIfVisible;
}
web_contents_->GetMainFrame()
->FromAXTreeID(ax_id->first)
->AccessibilityPerformAction(action_data);
auto* frame = web_contents_->GetMainFrame()->FromAXTreeID(ax_id->first);
if (!frame) {
// Fuchsia targeted a tree that does not exist.
callback(false);
return;
}
frame->AccessibilityPerformAction(action_data);
callback(true);
if (event_received_callback_for_test_) {