diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 211724b18712..98eb5e75a69b 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -169,20 +169,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface) #if defined(OS_WIN) InitPopupMenuHook(); #endif // OS_WIN -#ifdef MOZ_X11 - // Maemo flash can render plugin with any provided rectangle and not require this quirk. -#ifndef MOZ_PLATFORM_MAEMO - const char *description = NULL; - mPluginIface->getvalue(GetNPP(), NPPVpluginDescriptionString, - &description); - if (description) { - NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10."); - if (StringBeginsWith(nsDependentCString(description), flash10Head)) { - PluginModuleChild::current()->AddQuirk(PluginModuleChild::QUIRK_FLASH_EXPOSE_COORD_TRANSLATION); - } - } -#endif -#endif } PluginInstanceChild::~PluginInstanceChild() diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 13921dfce5cb..ff964e851959 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -185,22 +185,37 @@ PluginModuleChild::Init(const std::string& aPluginFilename, return false; mPluginFilename = aPluginFilename.c_str(); - nsCOMPtr pluginFile; + nsCOMPtr localFile; NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPluginFilename), PR_TRUE, - getter_AddRefs(pluginFile)); + getter_AddRefs(localFile)); PRBool exists; - pluginFile->Exists(&exists); + localFile->Exists(&exists); NS_ASSERTION(exists, "plugin file ain't there"); - nsCOMPtr pluginIfile; - pluginIfile = do_QueryInterface(pluginFile); + nsPluginFile pluginFile(localFile); - nsPluginFile lib(pluginIfile); + nsresult rv; + // Maemo flash can render with any provided rectangle and so does not + // require this quirk. +#if defined(MOZ_X11) && !defined(MOZ_PLATFORM_MAEMO) + nsPluginInfo info = nsPluginInfo(); + rv = pluginFile.GetPluginInfo(info, &mLibrary); + if (NS_FAILED(rv)) + return false; - nsresult rv = lib.LoadPlugin(&mLibrary); - NS_ASSERTION(NS_OK == rv, "trouble with mPluginFile"); + NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10."); + if (StringBeginsWith(nsDependentCString(info.fDescription), flash10Head)) { + AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION); + } + + if (!mLibrary) +#endif + { + rv = pluginFile.LoadPlugin(&mLibrary); + NS_ASSERTION(NS_OK == rv, "trouble with mPluginFile"); + } NS_ASSERTION(mLibrary, "couldn't open shared object"); if (!Open(aChannel, aParentProcessHandle, aIOLoop)) diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 604ca66ae410..871309539b0b 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -256,13 +256,13 @@ public: }; int GetQuirks() { return mQuirks; } + +private: void AddQuirk(PluginQuirks quirk) { if (mQuirks == QUIRKS_NOT_INITIALIZED) mQuirks = 0; mQuirks |= quirk; } - -private: void InitQuirksModes(const nsCString& aMimeType); bool InitGraphics(); void DeinitGraphics();