Commit d5637f57 authored by Victor Fei's avatar Victor Fei Committed by Commit Bot

Fix AxVirtualObject::AddChildren should set |have_children_|

CL:2356484 fixed an issue in AXVirtualObject::AddChildren where the
parent should be set. As a follow up, this change also sets
|have_children_| to true when adding children for AXVirtualObject.

Consider the following call stack:

AXVirtualObject::AddChildren
AXObject::UpdateChildrenIfNecessary
AXObject::ChildrenIncludingIgnored
WebAXObject::ChildAt
BlinkAXTreeSource::GetChildren

AXObject::UpdateChildrenIfNecessary() relies on |have_children_| to
check if there are new children and should be added. If we do not set
|have_children_| to true in AXVirtualObjet::AddChildren(), the above
call will keep adding children and expand the heap beyond allowed
capacity triggering a check.

AX-Relnotes:n/a

Bug: 1149437
Change-Id: I973a73994bc59e47742ddfdd8c15c90d6c664421
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538354
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827921}
parent 1a239895
...@@ -30,6 +30,9 @@ void AXVirtualObject::AddChildren() { ...@@ -30,6 +30,9 @@ void AXVirtualObject::AddChildren() {
if (!accessible_node_) if (!accessible_node_)
return; return;
DCHECK(!have_children_);
have_children_ = true;
for (const auto& child : accessible_node_->GetChildren()) { for (const auto& child : accessible_node_->GetChildren()) {
AXObject* ax_child = AXObjectCache().GetOrCreate(child); AXObject* ax_child = AXObjectCache().GetOrCreate(child);
if (!ax_child) if (!ax_child)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment