Bug 1424505: Don't try to retrieve the accessible focus from remote documents on Windows 7. r=eeejay

Bug 1421144 fixed IAccessible::accFocus to work when focus is within a remote document.
Unfortunately, this causes mysterious intermittent crashes when called from a UIA client in Windows 7.
Ideally, we'd deal with the actual cause of the crashes, but they seem to be deep in Windows RPC code and all attempts at tracking this down have failed.
Clients don't seem to need this too often anyway (and it's a minor annoyance if it doesn't work when they do).

MozReview-Commit-ID: IxvbBGJ2wxA

--HG--
extra : rebase_source : 504909703718b75fffcabf1fbe56c0bbff089b58
This commit is contained in:
James Teh 2018-05-01 15:48:43 +10:00
parent 12da0454e1
commit a6bdc218ba

View File

@ -6,6 +6,7 @@
#include "RootAccessibleWrap.h"
#include "Compatibility.h"
#include "mozilla/WindowsVersion.h"
#include "nsCoreUtils.h"
#include "nsWinUtils.h"
@ -155,8 +156,11 @@ RootAccessibleWrap::get_accFocus(
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild)
{
HRESULT hr = DocAccessibleWrap::get_accFocus(pvarChild);
if (FAILED(hr) || pvarChild->vt != VT_EMPTY) {
// We got a definite result (either failure or an accessible).
if (FAILED(hr) || pvarChild->vt != VT_EMPTY || !IsWin8OrLater()) {
// 1. We got a definite result (either failure or an accessible); or
// 2. This is Windows 7, where we don't want to retrieve the focus from a
// remote document because this causes mysterious intermittent crashes
// when we're called by UIA clients; see bug 1424505.
return hr;
}