Bug 626016. Prevent QuickTime plugin from stealing focus when it's hidden due to SetWindow call. r=bsmedberg a=blocking-final

This commit is contained in:
Felipe Gomes 2011-02-18 13:31:59 -08:00
Родитель 72713bda66
Коммит d3c026453c
3 изменённых файлов: 20 добавлений и 4 удалений

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

@ -937,6 +937,13 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
switch (aWindow.type) {
case NPWindowTypeWindow:
{
if ((GetQuirks() & PluginModuleChild::QUIRK_QUICKTIME_AVOID_SETWINDOW) &&
aWindow.width == 0 &&
aWindow.height == 0) {
// Skip SetWindow call for hidden QuickTime plugins
return true;
}
if (!CreatePluginWindow())
return false;

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

@ -110,6 +110,7 @@ PluginModuleChild::PluginModuleChild() :
mQuirks(QUIRKS_NOT_INITIALIZED),
mShutdownFunc(0),
mInitializeFunc(0)
, mPluginFilename("")
#if defined(OS_WIN) || defined(OS_MACOSX)
, mGetEntryPointsFunc(0)
#elif defined(MOZ_WIDGET_GTK2)
@ -183,10 +184,9 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
if (!InitGraphics())
return false;
nsCString filename;
filename = aPluginFilename.c_str();
mPluginFilename = aPluginFilename.c_str();
nsCOMPtr<nsILocalFile> pluginFile;
NS_NewNativeLocalFile(filename,
NS_NewNativeLocalFile(mPluginFilename,
PR_TRUE,
getter_AddRefs(pluginFile));
@ -1878,6 +1878,12 @@ PluginModuleChild::InitQuirksModes(const nsCString& aMimeType)
mQuirks |= QUIRK_FLASH_HOOK_GETWINDOWINFO;
mQuirks |= QUIRK_FLASH_FIXUP_MOUSE_CAPTURE;
}
// QuickTime plugin usually loaded with audio/mpeg mimetype
NS_NAMED_LITERAL_CSTRING(quicktime, "npqtplugin");
if (FindInReadable(quicktime, mPluginFilename)) {
mQuirks |= QUIRK_QUICKTIME_AVOID_SETWINDOW;
}
#endif
}

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

@ -249,6 +249,9 @@ public:
// Win: Addresses a flash bug with mouse capture and full screen
// windows.
QUIRK_FLASH_FIXUP_MOUSE_CAPTURE = 1 << 6,
// Win: QuickTime steals focus on SetWindow calls even if it's hidden.
// Avoid calling SetWindow in that case.
QUIRK_QUICKTIME_AVOID_SETWINDOW = 1 << 7,
};
int GetQuirks() { return mQuirks; }
@ -278,8 +281,8 @@ private:
virtual void ExitedCxxStack();
#endif
std::string mPluginFilename;
PRLibrary* mLibrary;
nsCString mPluginFilename;
nsCString mUserAgent;
int mQuirks;