Bug 1334257: Assure that TIPMessageHandler hooks may not be instantiated more than once; r=jimm

MozReview-Commit-ID: LiDQ9yUzGTK

--HG--
extra : rebase_source : f1191c3951af39b34207e0d08f8a3536f04cec27
This commit is contained in:
Aaron Klotz 2017-01-26 15:30:44 -07:00
parent 0d2bf66dfd
commit e49ac45079

View File

@ -414,11 +414,14 @@ public:
static void Initialize()
{
MOZ_ASSERT(!sInstance);
if (!IsWin8OrLater()) {
return;
}
if (sInstance) {
return;
}
sInstance = new TIPMessageHandler();
ClearOnShutdown(&sInstance);
}
@ -452,7 +455,7 @@ private:
::GetCurrentThreadId());
MOZ_ASSERT(mHook);
if (!IsWin10OrLater()) {
if (!IsWin10OrLater() && !sProcessCaretEventsStub) {
// tiptsf loads when STA COM is first initialized, so it should be present
sTipTsfInterceptor.Init("tiptsf.dll");
DebugOnly<bool> ok = sTipTsfInterceptor.AddHook("ProcessCaretEvents",
@ -461,12 +464,13 @@ private:
MOZ_ASSERT(ok);
}
MOZ_ASSERT(!sSendMessageTimeoutWStub);
sUser32Intercept.Init("user32.dll");
DebugOnly<bool> hooked = sUser32Intercept.AddHook("SendMessageTimeoutW",
reinterpret_cast<intptr_t>(&SendMessageTimeoutWHook),
(void**) &sSendMessageTimeoutWStub);
MOZ_ASSERT(hooked);
if (!sSendMessageTimeoutWStub) {
sUser32Intercept.Init("user32.dll");
DebugOnly<bool> hooked = sUser32Intercept.AddHook("SendMessageTimeoutW",
reinterpret_cast<intptr_t>(&SendMessageTimeoutWHook),
(void**) &sSendMessageTimeoutWStub);
MOZ_ASSERT(hooked);
}
}
class MOZ_RAII A11yInstantiationBlocker