Bug 1336515: Fix assertions in TIPMessageHandler instantiation on non-touchscreen devices; r=jimm
authorAaron Klotz <aklotz@mozilla.com>
Fri, 03 Feb 2017 11:21:15 -0700
changeset 479643 e54a95d4fec35114fa7d2b7bf3df84695c1732d2
parent 479642 22651b5d537d8f6d0c09a2148f4c1017ab0a368e
child 479644 8598941437bf858986323f1ef313d0c1c24ef7fa
push id44315
push usertnguyen@mozilla.com
push dateTue, 07 Feb 2017 02:03:39 +0000
reviewersjimm
bugs1336515
milestone54.0a1
Bug 1336515: Fix assertions in TIPMessageHandler instantiation on non-touchscreen devices; r=jimm MozReview-Commit-ID: FCQBD6hB4oL
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -450,18 +450,20 @@ private:
     mMessages[4] = ::RegisterWindowMessage(L"ProgrammabilityCaretVisibility");
     mMessages[5] = ::RegisterWindowMessage(L"CaretTrackingUpdateIPHidden");
     mMessages[6] = ::RegisterWindowMessage(L"CaretTrackingUpdateIPInfo");
 
     mHook = ::SetWindowsHookEx(WH_GETMESSAGE, &TIPHook, nullptr,
                                ::GetCurrentThreadId());
     MOZ_ASSERT(mHook);
 
-    if (!IsWin10OrLater() && !sProcessCaretEventsStub) {
-      // tiptsf loads when STA COM is first initialized, so it should be present
+    // On touchscreen devices, tiptsf.dll will have been loaded when STA COM was
+    // first initialized.
+    if (!IsWin10OrLater() && GetModuleHandle(L"tiptsf.dll") &&
+        !sProcessCaretEventsStub) {
       sTipTsfInterceptor.Init("tiptsf.dll");
       DebugOnly<bool> ok = sTipTsfInterceptor.AddHook("ProcessCaretEvents",
           reinterpret_cast<intptr_t>(&ProcessCaretEventsHook),
           (void**) &sProcessCaretEventsStub);
       MOZ_ASSERT(ok);
     }
 
     if (!sSendMessageTimeoutWStub) {