try to sync with UXP to solve crash in msctfime.

This commit is contained in:
2018-07-07 13:59:34 +08:00
parent d1df17ccbe
commit 019ca9a532
10 changed files with 140 additions and 37 deletions
@@ -129,7 +129,9 @@ public:
nsPluginHost::SpecialType mPluginType;
};
static bool sInMessageDispatch = false;
static bool sInPreviousMessageDispatch = false;
static UINT sLastMsg = 0;
static bool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsNPAPIPluginInstance * aInst,
HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -199,6 +201,16 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
RefPtr<nsNPAPIPluginInstance> inst;
win->GetPluginInstance(inst);
// Real may go into a state where it recursivly dispatches the same event
// when subclassed. If this is Real, lets examine the event and drop it
// on the floor if we get into this recursive situation. See bug 192914.
if (win->mPluginType == nsPluginHost::eSpecialType_RealPlayer) {
if (sInMessageDispatch && msg == sLastMsg)
return true;
// Cache the last message sent
sLastMsg = msg;
}
bool enablePopups = false;
// Activate/deactivate mouse capture on the plugin widget
@@ -268,6 +280,10 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
case WM_SETFOCUS:
case WM_KILLFOCUS: {
// RealPlayer can crash, don't process the message for those,
// see bug 328675.
if (win->mPluginType == nsPluginHost::eSpecialType_RealPlayer && msg == sLastMsg)
return TRUE;
// Make sure setfocus and killfocus get through to the widget procedure
// even if they are eaten by the plugin. Also make sure we aren't calling
// recursively.
@@ -297,6 +313,7 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
}
}
sInMessageDispatch = true;
LRESULT res;
WNDPROC proc = (WNDPROC)win->GetWindowProc();
if (PluginWndProc == proc) {
@@ -306,6 +323,7 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
} else {
res = CallWindowProc(proc, hWnd, msg, wParam, lParam);
}
sInMessageDispatch = false;
if (inst) {
// Popups are enabled (were enabled before the call to