From f08015a587efb7cacdf2c69d9045d91561cf60a5 Mon Sep 17 00:00:00 2001 From: James Teh Date: Thu, 16 Nov 2017 16:51:28 +1000 Subject: [PATCH] Bug 1417327 part 3: Accessible handler: Fix cache for IAccessible::accDefaultAction and use it for IAccessibleAction::name(0). r=MarcoZ 1. Bug 1363595 added support for retrieving accDefaultAction from the cache, but the value was never cached in the first place. This would have meant that accDefaultAction was returning nothing to clients. 2. Since accDefaultAction is the name of the first action, we can also use this cached value for IAccessibleAction::name for index 0. MozReview-Commit-ID: 6PGRH45kKdB --HG-- extra : rebase_source : 52688f1e44ad7613c5dd14903b6240a51aa2d4eb --- accessible/ipc/win/HandlerProvider.cpp | 5 +++++ .../ipc/win/handler/AccessibleHandler.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/accessible/ipc/win/HandlerProvider.cpp b/accessible/ipc/win/HandlerProvider.cpp index 44f803e38b825..5e54f08f83d52 100644 --- a/accessible/ipc/win/HandlerProvider.cpp +++ b/accessible/ipc/win/HandlerProvider.cpp @@ -315,6 +315,11 @@ HandlerProvider::BuildDynamicIA2Data(DynamicIA2Data* aOutIA2Data) return; } + hr = target->get_accDefaultAction(kChildIdSelf, &aOutIA2Data->mDefaultAction); + if (FAILED(hr)) { + return; + } + hr = target->get_accChildCount(&aOutIA2Data->mChildCount); if (FAILED(hr)) { return; diff --git a/accessible/ipc/win/handler/AccessibleHandler.cpp b/accessible/ipc/win/handler/AccessibleHandler.cpp index 042703cba2979..fda2a2b49abd7 100644 --- a/accessible/ipc/win/handler/AccessibleHandler.cpp +++ b/accessible/ipc/win/handler/AccessibleHandler.cpp @@ -1280,6 +1280,24 @@ AccessibleHandler::get_keyBinding(long actionIndex, HRESULT AccessibleHandler::get_name(long actionIndex, BSTR* name) { + if (!name) { + return E_INVALIDARG; + } + + if (HasPayload()) { + if (actionIndex >= mCachedData.mDynamicData.mNActions) { + // Action does not exist. + return E_INVALIDARG; + } + + if (actionIndex == 0) { + // same as accDefaultAction. + GET_BSTR(mDefaultAction, *name); + return S_OK; + } + } + + // At this point, there's either no payload or actionIndex is > 0. HRESULT hr = ResolveIAHyperlink(); if (FAILED(hr)) { return hr;