Bug 1417327 part 3: Accessible handler: Fix cache for IAccessible::accDefaultAction and use it for IAccessibleAction::name(0). r=MarcoZ a=gchang
authorJames Teh <jteh@mozilla.com>
Thu, 16 Nov 2017 16:51:28 +1000
changeset 442520 ad61044a4ba8ce0077c8ad6a415a0555fd8fac7c
parent 442519 5b467b5636efa46906af107b824ecfb4787cc971
child 442521 3480ca96e9cd95c0c889899a07d8b738c594c517
push id8239
push userarchaeopteryx@coole-files.de
push dateMon, 27 Nov 2017 10:55:23 +0000
treeherdermozilla-beta@66c82ad8b8a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, gchang
bugs1417327, 1363595
milestone58.0
Bug 1417327 part 3: Accessible handler: Fix cache for IAccessible::accDefaultAction and use it for IAccessibleAction::name(0). r=MarcoZ a=gchang 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
accessible/ipc/win/HandlerProvider.cpp
accessible/ipc/win/handler/AccessibleHandler.cpp
--- a/accessible/ipc/win/HandlerProvider.cpp
+++ b/accessible/ipc/win/HandlerProvider.cpp
@@ -310,16 +310,21 @@ HandlerProvider::BuildDynamicIA2Data(Dyn
     return;
   }
 
   hr = target->get_accDescription(kChildIdSelf, &aOutIA2Data->mDescription);
   if (FAILED(hr)) {
     return;
   }
 
+  hr = target->get_accDefaultAction(kChildIdSelf, &aOutIA2Data->mDefaultAction);
+  if (FAILED(hr)) {
+    return;
+  }
+
   hr = target->get_accChildCount(&aOutIA2Data->mChildCount);
   if (FAILED(hr)) {
     return;
   }
 
   hr = target->get_accValue(kChildIdSelf, &aOutIA2Data->mValue);
   if (FAILED(hr)) {
     return;
--- a/accessible/ipc/win/handler/AccessibleHandler.cpp
+++ b/accessible/ipc/win/handler/AccessibleHandler.cpp
@@ -1275,16 +1275,34 @@ AccessibleHandler::get_keyBinding(long a
   }
   return mIAHyperlinkPassThru->get_keyBinding(
     actionIndex, nMaxBindings, keyBindings, nBindings);
 }
 
 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;
   }
   return mIAHyperlinkPassThru->get_name(actionIndex, name);
 }
 
 HRESULT