Bug 1460022: Part 4 - Update a11y code to reflect new interface for DLL interceptor; r=Jamie
authorAaron Klotz <aklotz@mozilla.com>
Wed, 27 Jun 2018 11:49:17 -0600
changeset 424934 f538fbf4d5099cbd84c3777d5eb338333dca33a4
parent 424933 7bdadc37becdd1c800543396b19a3d8f2c114e08
child 424935 388defa609728a5bcacd0bb48f461f5fca783e0e
push id104944
push useraklotz@mozilla.com
push dateWed, 04 Jul 2018 02:23:52 +0000
treeherdermozilla-inbound@ff25e66da36e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1460022
milestone63.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 1460022: Part 4 - Update a11y code to reflect new interface for DLL interceptor; r=Jamie
accessible/windows/msaa/Compatibility.cpp
--- a/accessible/windows/msaa/Compatibility.cpp
+++ b/accessible/windows/msaa/Compatibility.cpp
@@ -90,17 +90,18 @@ Compatibility::IsModuleVersionLessThan(H
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Compatibility
 ////////////////////////////////////////////////////////////////////////////////
 
 static WindowsDllInterceptor sUser32Interceptor;
-static decltype(&InSendMessageEx) sInSendMessageExStub = nullptr;
+static WindowsDllInterceptor::FuncHookType<decltype(&InSendMessageEx)>
+  sInSendMessageExStub;
 static bool sInSendMessageExHackEnabled = false;
 static PVOID sVectoredExceptionHandler = nullptr;
 
 #if defined(_MSC_VER)
 #include <intrin.h>
 #pragma intrinsic(_ReturnAddress)
 #define RETURN_ADDRESS() _ReturnAddress()
 #elif defined(__GNUC__) || defined(__clang__)
@@ -262,21 +263,19 @@ Compatibility::Init()
   }
 
   // If we have a consumer who is not NVDA, we enable detection for the
   // InSendMessageEx compatibility hack. NVDA does not require this.
   // We also skip UIA, as we see crashes there.
   if ((sConsumers & (~(UIAUTOMATION | NVDA))) &&
       BrowserTabsRemoteAutostart()) {
     sUser32Interceptor.Init("user32.dll");
-    if (!sInSendMessageExStub) {
-      sUser32Interceptor.AddHook("InSendMessageEx",
-                                 reinterpret_cast<intptr_t>(&InSendMessageExHook),
-                                 (void**)&sInSendMessageExStub);
-    }
+    sInSendMessageExStub.Set(sUser32Interceptor, "InSendMessageEx",
+                             &InSendMessageExHook);
+
     // The vectored exception handler allows us to catch exceptions ahead of any
     // SEH handlers.
     if (!sVectoredExceptionHandler) {
       // We need to let ASan's ShadowExceptionHandler remain in the firstHandler
       // position, otherwise we'll get infinite recursion when our handler
       // faults on shadow memory.
       const ULONG firstHandler = FALSE;
       sVectoredExceptionHandler =