Bug 1448091 part 1: Accessible HandlerProvider: Return an error if refreshing the cache fails. r?MarcoZ draft
authorJames Teh <jteh@mozilla.com>
Fri, 23 Mar 2018 11:44:05 -0400
changeset 771664 b1afb53991db0e788397e06bc75d9a8620d1a441
parent 771560 9cb650de48f9339b8b1499aeb9fe68f15f122aa2
child 771665 db447f94427bc28079fe0df9bc091c964e13fc1e
push id103747
push userbmo:jteh@mozilla.com
push dateFri, 23 Mar 2018 17:02:38 +0000
reviewersMarcoZ
bugs1448091
milestone61.0a1
Bug 1448091 part 1: Accessible HandlerProvider: Return an error if refreshing the cache fails. r?MarcoZ BuildDynamicIA2Data can't return an HRESULT; failure is communicated by the fact that the unique id in the data is set to 0. However, IGeckoBackChannel::Refresh returned S_OK even if BuildDynamicIA2Data failed. We now check the unique id and return an appropriate error code if it's 0. Among other things, this means that the handler will return an error when querying dead objects instead of returning stale cache data. MozReview-Commit-ID: IorDRHCItD8
accessible/ipc/win/HandlerProvider.cpp
--- a/accessible/ipc/win/HandlerProvider.cpp
+++ b/accessible/ipc/win/HandlerProvider.cpp
@@ -551,16 +551,26 @@ HandlerProvider::Refresh(DynamicIA2Data*
   }
 
   if (!mscom::InvokeOnMainThread("HandlerProvider::BuildDynamicIA2Data",
                                  this, &HandlerProvider::BuildDynamicIA2Data,
                                  aOutData)) {
     return E_FAIL;
   }
 
+  if (!aOutData->mUniqueId) {
+    // BuildDynamicIA2Data failed.
+    if (!mTargetUnk) {
+      // Even though we checked this before, the accessible can be shut down
+      // before BuildDynamicIA2Data executes on the main thread.
+      return CO_E_OBJNOTCONNECTED;
+    }
+    return E_FAIL;
+  }
+
   return S_OK;
 }
 
 template<typename Interface>
 HRESULT
 HandlerProvider::ToWrappedObject(Interface** aObj)
 {
   mscom::STAUniquePtr<Interface> inObj(*aObj);