mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 768802: Prevent plugins from setting the foreground window during NP_Initialize; r=bsmedberg
--HG-- extra : rebase_source : 8628dba0eca82a12d2b9f999e55889c9a6c3ab18
This commit is contained in:
parent
5662a359c6
commit
2b957f2ee3
@ -34,6 +34,7 @@
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "PluginHangUIParent.h"
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "mozilla/widget/AudioSession.h"
|
||||
#endif
|
||||
|
||||
@ -1217,6 +1218,26 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
|
||||
return NS_OK;
|
||||
}
|
||||
#else
|
||||
#if defined(XP_WIN)
|
||||
class MOZ_STACK_CLASS SetForegroundLocker
|
||||
{
|
||||
public:
|
||||
SetForegroundLocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
::LockSetForegroundWindow(LSFW_LOCK);
|
||||
}
|
||||
|
||||
~SetForegroundLocker()
|
||||
{
|
||||
::LockSetForegroundWindow(LSFW_UNLOCK);
|
||||
}
|
||||
|
||||
private:
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
||||
{
|
||||
@ -1232,6 +1253,11 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
||||
uint32_t flags = 0;
|
||||
#ifdef XP_WIN
|
||||
flags |= kAllowAsyncDrawing;
|
||||
|
||||
// Bug 768802: We need to call LockSetForegroundWindow before calling
|
||||
// NP_Initialize to prevent our window from losing focus when the
|
||||
// plugin starts.
|
||||
SetForegroundLocker fgLock;
|
||||
#endif
|
||||
|
||||
if (!CallNP_Initialize(flags, error)) {
|
||||
|
Loading…
Reference in New Issue
Block a user