diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index 5db10429ec3..48dbf5a84a6 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -1393,9 +1393,13 @@ PluginInstanceChild::SetWindowLongAHook(HWND hWnd, GetProp(hWnd, kPluginInstanceChildProperty)); // Hook our subclass back up, just like we do on setwindow. - self->mPluginWndProc = - reinterpret_cast(sUser32SetWindowLongAHookStub(hWnd, nIndex, - reinterpret_cast(PluginWindowProc))); + WNDPROC currentProc = + reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_WNDPROC)); + if (currentProc != PluginWindowProc) { + self->mPluginWndProc = + reinterpret_cast(sUser32SetWindowLongAHookStub(hWnd, nIndex, + reinterpret_cast(PluginWindowProc))); + } return proc; } @@ -1422,9 +1426,13 @@ PluginInstanceChild::SetWindowLongWHook(HWND hWnd, GetProp(hWnd, kPluginInstanceChildProperty)); // Hook our subclass back up, just like we do on setwindow. - self->mPluginWndProc = - reinterpret_cast(sUser32SetWindowLongWHookStub(hWnd, nIndex, - reinterpret_cast(PluginWindowProc))); + WNDPROC currentProc = + reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_WNDPROC)); + if (currentProc != PluginWindowProc) { + self->mPluginWndProc = + reinterpret_cast(sUser32SetWindowLongAHookStub(hWnd, nIndex, + reinterpret_cast(PluginWindowProc))); + } return proc; }