Commit 34646380 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Check validity of using IA2 interface prior to using it

The ax_dump_events tool is crashing when IA2 not supported on an object.
This checks that the queryInterface succeeded and that we hold a non-null
IA2 pointer, before trying to use the IA2 pointer.

Bug: None
Change-Id: I4e2e2b469b0d891eac920fac1273436d28702f85
Reviewed-on: https://chromium-review.googlesource.com/1115561
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570541}
parent 163d0bc9
......@@ -258,12 +258,13 @@ void AccessibilityEventRecorderWin::OnWinEventHook(
AccessibleStates ia2_state = 0;
Microsoft::WRL::ComPtr<IAccessible2> iaccessible2;
hr = QueryIAccessible2(iaccessible.Get(), iaccessible2.GetAddressOf());
bool has_ia2 = SUCCEEDED(hr) && iaccessible2;
base::string16 html_tag;
base::string16 obj_class;
base::string16 html_id;
if (SUCCEEDED(hr)) {
if (has_ia2) {
iaccessible2->get_states(&ia2_state);
base::win::ScopedBstr attributes_bstr;
if (S_OK == iaccessible2->get_attributes(attributes_bstr.Receive())) {
......@@ -309,7 +310,8 @@ void AccessibilityEventRecorderWin::OnWinEventHook(
// Group position, e.g. L3, 5 of 7
LONG group_level, similar_items_in_group, position_in_group;
if (iaccessible2->get_groupPosition(&group_level, &similar_items_in_group,
if (has_ia2 &&
iaccessible2->get_groupPosition(&group_level, &similar_items_in_group,
&position_in_group) == S_OK) {
if (group_level)
log += base::StringPrintf(" level=%ld", group_level);
......
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