forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notify observers of node delete at end of AXTree::Unserialize
Previously, we notify an AXTreeObserver of a node removed from AXTree before the node is actually removed from the tree. In this change, we notify an AXTreeObserver of a node removed from AXTree after the tree is stable and its nodes have been updated. Previously, when in AXTree::Unserialize and before tree modification takes place, we call NotifyNodeWillBeReparentedOrDeleted on the node to be deleted. AXTreeObserver/ BrowserAccessibilityManager::OnNodeWillBeDeleted removes its reference to the AxNode's BrowserAccessibility object and destroy it as well. This takes place before the actual ax node is deleted from the tree. The subsequent action, also before tree modification, such as a call to BrowserAccessibility::InternalGetFirstChild() will reveal the inconsistent state--retrieving the child node from ax tree, however when we query through BrowserAccessibilityManager::id_wrapper_map_ for its BrowserAccessibility, it is not found because it is deleted in the prior action. This inconsistent state can cause a null dereferencing in BrowserAccessibility::PlatformIsLeafIncludingIgnored for role::kButton. In the following scenario, a crash would occur. AXTree: kRootWebArea chromium#1 ++kButton chromium#5 ++++kCheckBox chromium#2 ++++kGenericContainer chromium#3 IGNORED ++++++kStaticText chromium#4 IGNORED AXTreeUpdate: 1. remove node kCheckBox chromium#2 2. remove subtree kGenericContainer chromium#3 IGNORED --- AXTree::Unserailize: { NotifyNodeWillBeReparentedOrDeleted(kCheckBox#2) OnNodeWillBeDeleted(kCheckBox#2) id_wrapper_map_.erase(kCheckBox#2) delete BrowserAccessibility of kCheckBox#2 NotifySubTreeWillBeReparentedOrDeleted(#kGenericContainer#3) FireWinAccessibilityEvent(kGenericContainer#3) ... PlatformIsLeafIncludingIgnored(kButton#5) InternalGetFirstChild(kButton#5) GetUnignoredChildAtIndex(0) returns kCheckBox ax node id_wrapper_map.get(kCheckBox#2) -> null Dereferencing null, exception occurs. //--- then tree modification/ax node deletion happens -- } Bug: 1020187 Change-Id: I8e83b3450ca6253e837f4854a1c90a4779b3d435 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1907774 Commit-Queue: Victor Fei <vicfei@microsoft.com> Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org> Reviewed-by: Adam Ettenberger <adettenb@microsoft.com> Cr-Commit-Position: refs/heads/master@{#715341}
- Loading branch information
Showing
12 changed files
with
153 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
content/test/data/accessibility/event/button-remove-children-expected-uia-win.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
StructureChanged/ChildRemoved on role=button | ||
StructureChanged/ChildrenReordered on role=button |
2 changes: 2 additions & 0 deletions
2
content/test/data/accessibility/event/button-remove-children-expected-win.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
EVENT_OBJECT_HIDE on <input#checkbox> role=ROLE_SYSTEM_CHECKBUTTON FOCUSABLE IA2_STATE_CHECKABLE | ||
EVENT_OBJECT_REORDER on <button> role=ROLE_SYSTEM_PUSHBUTTON FOCUSABLE |
23 changes: 23 additions & 0 deletions
23
content/test/data/accessibility/event/button-remove-children.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
@WIN-DENY:EVENT_OBJECT_LOCATIONCHANGE* | ||
@WIN-DENY:IA2_EVENT_TEXT_REMOVED* | ||
This test is for crbug.com/1020187. | ||
By removing 'checkbox' first then 'ignored_content', we should not cause AXTree | ||
to crash during AXTree unserialization. | ||
--> | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<button> | ||
<input id="checkbox" type="checkbox"> | ||
<div id="ignored_content" aria-hidden="true">text content ignored</div> | ||
</button> | ||
<script> | ||
function go() { | ||
document.getElementById('checkbox').remove(); | ||
document.getElementById('ignored_content').remove(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters