Bug 1438955 - Remove ImmReleaseContext hook. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 07 Mar 2018 11:01:30 +0900
changeset 461911 ae730768385d79888333172a1902b5eae763dbff
parent 461910 ca86b5f0a30a71d0e57e829176bd1eb611d8c2a1
child 461912 926f80f2c5ccaa5b0374b48678d62c304cbc9a68
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1438955
milestone60.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 1438955 - Remove ImmReleaseContext hook. r=masayuki
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginInstanceChild.h
toolkit/xre/test/win/TestDllInterceptor.cpp
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -71,28 +71,26 @@ typedef BOOL (WINAPI *User32TrackPopupMe
                                             int nReserved,
                                             HWND hWnd,
                                             CONST RECT *prcRect);
 static WindowsDllInterceptor sUser32Intercept;
 static HWND sWinlessPopupSurrogateHWND = nullptr;
 static User32TrackPopupMenu sUser32TrackPopupMenuStub = nullptr;
 
 typedef HIMC (WINAPI *Imm32ImmGetContext)(HWND hWND);
-typedef BOOL (WINAPI *Imm32ImmReleaseContext)(HWND hWND, HIMC hIMC);
 typedef LONG (WINAPI *Imm32ImmGetCompositionString)(HIMC hIMC,
                                                     DWORD dwIndex,
                                                     LPVOID lpBuf,
                                                     DWORD dwBufLen);
 typedef BOOL (WINAPI *Imm32ImmSetCandidateWindow)(HIMC hIMC,
                                                   LPCANDIDATEFORM lpCandidate);
 typedef BOOL (WINAPI *Imm32ImmNotifyIME)(HIMC hIMC, DWORD dwAction,
                                         DWORD dwIndex, DWORD dwValue);
 static WindowsDllInterceptor sImm32Intercept;
 static Imm32ImmGetContext sImm32ImmGetContextStub = nullptr;
-static Imm32ImmReleaseContext sImm32ImmReleaseContextStub = nullptr;
 static Imm32ImmGetCompositionString sImm32ImmGetCompositionStringStub = nullptr;
 static Imm32ImmSetCandidateWindow sImm32ImmSetCandidateWindowStub = nullptr;
 static Imm32ImmNotifyIME sImm32ImmNotifyIME = nullptr;
 static PluginInstanceChild* sCurrentPluginInstance = nullptr;
 static const HIMC sHookIMC = (const HIMC)0xefefefef;
 
 using mozilla::gfx::SharedDIB;
 
@@ -2031,27 +2029,16 @@ PluginInstanceChild::ImmGetContextProc(H
         NS_WARNING("We cannot recongnize hooked window class");
         return sImm32ImmGetContextStub(aWND);
     }
 
     return sHookIMC;
 }
 
 // static
-BOOL
-PluginInstanceChild::ImmReleaseContextProc(HWND aWND, HIMC aIMC)
-{
-    if (aIMC == sHookIMC) {
-        return TRUE;
-    }
-
-    return sImm32ImmReleaseContextStub(aWND, aIMC);
-}
-
-// static
 LONG
 PluginInstanceChild::ImmGetCompositionStringProc(HIMC aIMC, DWORD aIndex,
                                                  LPVOID aBuf, DWORD aLen)
 {
     if (aIMC != sHookIMC) {
         return sImm32ImmGetCompositionStringStub(aIMC, aIndex, aBuf, aLen);
     }
     if (!sCurrentPluginInstance) {
@@ -2125,27 +2112,26 @@ PluginInstanceChild::InitImm32Hook()
         return;
     }
 
     if (sImm32ImmGetContextStub) {
         return;
     }
 
     // When using windowless plugin, IMM API won't work due ot OOP.
+    //
+    // ImmReleaseContext on Windows 7+ just returns TRUE only, so we don't
+    // need to hook this.
 
     sImm32Intercept.Init("imm32.dll");
     sImm32Intercept.AddHook(
         "ImmGetContext",
         reinterpret_cast<intptr_t>(ImmGetContextProc),
         (void**)&sImm32ImmGetContextStub);
     sImm32Intercept.AddHook(
-        "ImmReleaseContext",
-        reinterpret_cast<intptr_t>(ImmReleaseContextProc),
-        (void**)&sImm32ImmReleaseContextStub);
-    sImm32Intercept.AddHook(
         "ImmGetCompositionStringW",
         reinterpret_cast<intptr_t>(ImmGetCompositionStringProc),
         (void**)&sImm32ImmGetCompositionStringStub);
     sImm32Intercept.AddHook(
         "ImmSetCandidateWindow",
         reinterpret_cast<intptr_t>(ImmSetCandidateWindowProc),
         (void**)&sImm32ImmSetCandidateWindowStub);
     sImm32Intercept.AddHook(
--- a/dom/plugins/ipc/PluginInstanceChild.h
+++ b/dom/plugins/ipc/PluginInstanceChild.h
@@ -330,17 +330,16 @@ private:
                                           int nIndex,
                                           LONG newLong);
     static LONG WINAPI SetWindowLongWHook(HWND hWnd,
                                           int nIndex,
                                           LONG newLong);
 #endif
 
     static HIMC WINAPI ImmGetContextProc(HWND aWND);
-    static BOOL WINAPI ImmReleaseContextProc(HWND aWND, HIMC aIMC);
     static LONG WINAPI ImmGetCompositionStringProc(HIMC aIMC, DWORD aIndex,
                                                    LPVOID aBuf, DWORD aLen);
     static BOOL WINAPI ImmSetCandidateWindowProc(HIMC hIMC,
                                                  LPCANDIDATEFORM plCandidate);
     static BOOL WINAPI ImmNotifyIME(HIMC aIMC, DWORD aAction, DWORD aIndex,
                                     DWORD aValue);
 
     class FlashThrottleMsg : public CancelableRunnable
--- a/toolkit/xre/test/win/TestDllInterceptor.cpp
+++ b/toolkit/xre/test/win/TestDllInterceptor.cpp
@@ -670,17 +670,16 @@ int main()
       TestHook(TestCreateDIBSection, "gdi32.dll", "CreateDIBSection") &&
       TestHook(TestCreateFileW, "kernel32.dll", "CreateFileW") &&    // see Bug 1316415
 #endif
       TestHook(TestCreateFileA, "kernel32.dll", "CreateFileA") &&
       TestHook(TestQueryDosDeviceW, "kernelbase.dll", "QueryDosDeviceW") &&
       TestDetour("user32.dll", "CreateWindowExW") &&
       TestHook(TestInSendMessageEx, "user32.dll", "InSendMessageEx") &&
       TestHook(TestImmGetContext, "imm32.dll", "ImmGetContext") &&
-      // TestHook("imm32.dll", "ImmReleaseContext") &&    // see Bug 1316415
       TestHook(TestImmGetCompositionStringW, "imm32.dll", "ImmGetCompositionStringW") &&
       TestHook(TestImmSetCandidateWindow, "imm32.dll", "ImmSetCandidateWindow") &&
       TestHook(TestImmNotifyIME, "imm32.dll", "ImmNotifyIME") &&
       TestHook(TestGetSaveFileNameW, "comdlg32.dll", "GetSaveFileNameW") &&
       TestHook(TestGetOpenFileNameW, "comdlg32.dll", "GetOpenFileNameW") &&
 #ifdef _M_X64
       TestHook(TestGetKeyState, "user32.dll", "GetKeyState") &&    // see Bug 1316415
       TestHook(TestLdrUnloadDll, "ntdll.dll", "LdrUnloadDll") &&