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
--- 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);