Bug 1424505: Don't try to retrieve the accessible focus from remote documents on Windows 7. r=eeejay
authorJames Teh <jteh@mozilla.com>
Tue, 01 May 2018 15:48:43 +1000
changeset 472553 68bfd841265f54fdd4a214214e9ccc8297c64672
parent 472552 efbdd0a0a0ba523d0ec3b47ed3ad6872832c8e80
child 472554 d28c45ebedccae786507d357b725c889170653b8
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1424505, 1421144
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
accessible/windows/msaa/RootAccessibleWrap.cpp
--- a/accessible/windows/msaa/RootAccessibleWrap.cpp
+++ b/accessible/windows/msaa/RootAccessibleWrap.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "RootAccessibleWrap.h"
 
 #include "Compatibility.h"
+#include "mozilla/WindowsVersion.h"
 #include "nsCoreUtils.h"
 #include "nsWinUtils.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/destructor
 
@@ -150,18 +151,21 @@ RootAccessibleWrap::accNavigate(
   return S_OK;
 }
 
 STDMETHODIMP
 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;
   }
 
   // The base implementation reported no focus.
   // Focus might be in a remote document.
   // (The base implementation can't handle this.)
   // Get the document in the active tab.
   ProxyAccessible* docProxy = GetPrimaryRemoteTopLevelContentDoc();