Bug 905058 - Before accessing the UIA root element make sure the global com ptr is populated. r=bbondy

This commit is contained in:
Jim Mathies 2013-08-14 09:11:13 -05:00
parent 4a2fc3f265
commit ca638afd2e

View File

@ -686,16 +686,17 @@ MetroWidget::WindowProcedure(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLPara
// UiaReturnRawElementProvider passing the return result from FrameworkView // UiaReturnRawElementProvider passing the return result from FrameworkView
// OnAutomationProviderRequested as the hwnd (me scratches head) which results in // OnAutomationProviderRequested as the hwnd (me scratches head) which results in
// GetLastError always being set to invalid handle (6) after CallWindowProc returns. // GetLastError always being set to invalid handle (6) after CallWindowProc returns.
if (dwObjId == UiaRootObjectId) { if (dwObjId == UiaRootObjectId && gProviderRoot) {
NS_ASSERTION(gProviderRoot.Get(), "gProviderRoot is null??");
ComPtr<IRawElementProviderSimple> simple; ComPtr<IRawElementProviderSimple> simple;
gProviderRoot.As(&simple); gProviderRoot.As(&simple);
LRESULT res = UiaReturnRawElementProvider(aWnd, aWParam, aLParam, simple.Get()); if (simple) {
if (res) { LRESULT res = UiaReturnRawElementProvider(aWnd, aWParam, aLParam, simple.Get());
return res; if (res) {
return res;
}
NS_ASSERTION(res, "UiaReturnRawElementProvider failed!");
Log("UiaReturnRawElementProvider failed! GetLastError=%X", GetLastError());
} }
NS_ASSERTION(res, "UiaReturnRawElementProvider failed!");
Log("UiaReturnRawElementProvider failed! GetLastError=%X", GetLastError());
} }
break; break;
} }