Bug 1384260: Part 2 - Remove GetForegroundWindow from Windows plugin code path r=jmathies

GetForegroundWindow in PluginInstanceParent is used as part of message throttling in windowed plugins -- which we no longer officially support.  We need to remove it from normal behavior for sandboxing the content process as part of win32k-lockdown.  We are not removing windowed plugin code yet so, rather than break the behavior, I've gated the win32 calls so that they aren't run with windowless plugins.

Note that the original behavior was fine as the sandbox just makes the function return NULL -- but it would still show up in stack analysis so the behavior in this patch is preferred.

Differential Revision: https://phabricator.services.mozilla.com/D47936

--HG--
extra : moz-landing-system : lando
This commit is contained in:
David Parks 2019-10-16 21:21:50 +00:00
Родитель 2c043f0a5f
Коммит 61e2e5b22d
1 изменённых файлов: 9 добавлений и 6 удалений

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

@ -1426,12 +1426,15 @@ int16_t PluginInstanceParent::NPP_HandleEvent(void* event) {
// which fires WM_KILLFOCUS. Delayed delivery causes Flash to
// misinterpret the event, dropping back out of fullscreen. Trap
// this event and drop it.
wchar_t szClass[26];
HWND hwnd = GetForegroundWindow();
if (hwnd && hwnd != mPluginHWND &&
GetClassNameW(hwnd, szClass, sizeof(szClass) / sizeof(char16_t)) &&
!wcscmp(szClass, kFlashFullscreenClass)) {
return 0;
// mPluginHWND is always NULL for non-windowed plugins.
if (mPluginHWND) {
wchar_t szClass[26];
HWND hwnd = GetForegroundWindow();
if (hwnd && hwnd != mPluginHWND &&
GetClassNameW(hwnd, szClass, sizeof(szClass) / sizeof(char16_t)) &&
!wcscmp(szClass, kFlashFullscreenClass)) {
return 0;
}
}
} break;