Bug 547142 - [OOPP] Exiting full-screen video locks the browser. r=bent.

This commit is contained in:
Jim Mathies 2010-02-22 17:10:08 -08:00
Родитель 8c9c58a404
Коммит 76f596fe81
3 изменённых файлов: 74 добавлений и 19 удалений

Просмотреть файл

@ -53,6 +53,9 @@
extern const PRUnichar* kOOPPPluginFocusEventId;
UINT gOOPPPluginFocusEvent =
RegisterWindowMessage(kOOPPPluginFocusEventId);
extern const PRUnichar* kOOPPGetBaseMessageEventId;
UINT gOOPPGetBaseMessageEvent =
RegisterWindowMessage(kOOPPGetBaseMessageEventId);
UINT gOOPPSpinNativeLoopEvent =
RegisterWindowMessage(L"SyncChannel Spin Inner Loop Message");
UINT gOOPPStopNativeLoopEvent =
@ -540,6 +543,7 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
SharedSurfaceBeforePaint(rect, npremoteevent);
CallNPP_HandleEvent(npremoteevent, &handled);
SharedSurfaceAfterPaint(npevent);
return handled;
}
break;
@ -559,14 +563,32 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
!wcscmp(szClass, L"ShockwaveFlashFullScreen")) {
return 0;
}
// intentional fall through
}
break;
default:
if (!CallNPP_HandleEvent(npremoteevent, &handled))
return 0;
case WM_IME_SETCONTEXT:
{
// Children can activate the underlying parent browser window
// generating nested events that arrive here. Check the base
// event this event was triggered by and unlock the child using
// ReplyMessage if needed.
HWND hwnd = NULL;
UINT baseMsg = 0;
mNPNIface->getvalue(mNPP, NPNVnetscapeWindow, &hwnd);
NS_ASSERTION(GetWindowThreadProcessId(hwnd, nsnull) ==
GetCurrentThreadId(),
"hwnd belongs to another thread!");
if (hwnd &&
SendMessage(hwnd, gOOPPGetBaseMessageEvent,
(WPARAM)&baseMsg, 0) &&
baseMsg == WM_ACTIVATE) {
ReplyMessage(0);
}
}
break;
}
if (!CallNPP_HandleEvent(npremoteevent, &handled))
return 0;
}
else {
if (!CallNPP_HandleEvent(npremoteevent, &handled))

Просмотреть файл

@ -283,6 +283,12 @@ LPFNLRESULTFROMOBJECT
const PRUnichar* kOOPPPluginFocusEventId = L"OOPP Plugin Focus Widget Event";
PRUint32 nsWindow::sOOPPPluginFocusEvent =
RegisterWindowMessageW(kOOPPPluginFocusEventId);
// Used in OOPP hang detection.
const PRUnichar* kOOPPGetBaseMessageEventId = L"Get Base Widget Event Message";
PRUint32 nsWindow::sOOPPGetBaseMessageEvent =
RegisterWindowMessage(kOOPPGetBaseMessageEventId);
PRInt32 nsWindow::sCallDepth = 0;
UINT nsWindow::sBaseMsg = 0;
#endif
/**************************************************************
@ -3716,7 +3722,7 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
nsAutoRollup autoRollup;
LRESULT popupHandlingResult;
if ( DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult) )
if (DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult))
return popupHandlingResult;
// XXX This fixes 50208 and we are leaving 51174 open to further investigate
@ -3742,16 +3748,30 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
}
}
#ifdef MOZ_IPC
// Track the base event, used in focus hang detection for OOPP.
NS_ASSERTION(nsWindow::sCallDepth >= 0, "Call depth out of sync.");
if (++nsWindow::sCallDepth == 1)
nsWindow::sBaseMsg = msg;
#endif
// Call ProcessMessage
if (nsnull != someWindow) {
LRESULT retValue;
if (PR_TRUE == someWindow->ProcessMessage(msg, wParam, lParam, &retValue)) {
return retValue;
}
LRESULT retValue;
if (PR_TRUE == someWindow->ProcessMessage(msg, wParam, lParam, &retValue)) {
#ifdef MOZ_IPC
nsWindow::sCallDepth--;
#endif
return retValue;
}
return ::CallWindowProcW(someWindow->GetPrevWindowProc(),
hWnd, msg, wParam, lParam);
LRESULT res = ::CallWindowProcW(someWindow->GetPrevWindowProc(),
hWnd, msg, wParam, lParam);
#ifdef MOZ_IPC
nsWindow::sCallDepth--;
#endif
return res;
}
// The main windows message processing method for plugins.
@ -4702,13 +4722,23 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
SetHasTaskbarIconBeenCreated();
#endif
#ifdef MOZ_IPC
if (msg == sOOPPPluginFocusEvent) {
// With OOPP, the plugin window exists in another process and is a child of
// this window. This window is a placeholder plugin window for the dom. We
// receive this event when the child window receives focus. (sent from
// PluginInstanceParent.cpp)
::SendMessage(mWnd, WM_MOUSEACTIVATE, 0, 0); // See nsPluginNativeWindowWin.cpp
}
if (msg == sOOPPPluginFocusEvent) {
// With OOPP, the plugin window exists in another process and is a child of
// this window. This window is a placeholder plugin window for the dom. We
// receive this event when the child window receives focus. (sent from
// PluginInstanceParent.cpp)
::SendMessage(mWnd, WM_MOUSEACTIVATE, 0, 0); // See nsPluginNativeWindowWin.cpp
}
else if (msg == sOOPPGetBaseMessageEvent && wParam) {
// PluginInstanceParent uses this to retreive the base event for a nested
// event it receives. Used in preventing hangs on events forwared from
// child.
NS_ASSERTION(nsWindow::sCallDepth > 0,
"Call depth not 0 when requesting base message?");
*(reinterpret_cast<UINT*>(wParam)) = sBaseMsg;
*aRetValue = 1;
return PR_TRUE;
}
#endif
}
break;

Просмотреть файл

@ -449,6 +449,9 @@ protected:
static PRBool sTrackPointHack;
#ifdef MOZ_IPC
static PRUint32 sOOPPPluginFocusEvent;
static PRUint32 sOOPPGetBaseMessageEvent;
static PRInt32 sCallDepth;
static UINT sBaseMsg;
#endif
// Hook Data Memebers for Dropdowns. sProcessHook Tells the