Skip to content

Commit

Permalink
[a11y] Accessibility bridge rejects actions on invalidtrees.
Browse files Browse the repository at this point in the history
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

(cherry picked from commit 1e82f57)

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-Original-Commit-Position: refs/heads/master@{#859902}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2739912
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4430@{#173}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
lucasradaelli authored and Chromium LUCI CQ committed Mar 5, 2021
1 parent 9cc2c2f commit 1613c10
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fuchsia/engine/browser/accessibility_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down

0 comments on commit 1613c10

Please sign in to comment.