diff --git a/modules/plugin/base/src/nsPluginsDirUnix.cpp b/modules/plugin/base/src/nsPluginsDirUnix.cpp --- a/modules/plugin/base/src/nsPluginsDirUnix.cpp +++ b/modules/plugin/base/src/nsPluginsDirUnix.cpp @@ -151,34 +151,42 @@ static PRBool LoadExtraSharedLib(const c #define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32 #define PREF_PLUGINS_SONAME "plugin.soname.list" #if defined(SOLARIS) || defined(HPUX) #define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX ":libXm" LOCAL_PLUGIN_DLL_SUFFIX #else #define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX #endif /* this function looks for user_pref("plugin.soname.list", "/usr/X11R6/lib/libXt.so.6:libXext.so"); + user_pref("plugin.soname.list.libflashplayer.so", "/usr/lib/libGL.so"); in user's pref.js and loads all libs in specified order */ -static void LoadExtraSharedLibs() +static void LoadExtraSharedLibs(const char *soname) { // check out if user's prefs.js has libs name nsresult res; nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &res)); if (NS_SUCCEEDED(res) && (prefs != nsnull)) { char *sonameList = NULL; PRBool prefSonameListIsSet = PR_TRUE; - res = prefs->GetCharPref(PREF_PLUGINS_SONAME, &sonameList); + nsCAutoString prefname(PREF_PLUGINS_SONAME); + if (soname) { + prefname.AppendLiteral("."); + prefname.Append(soname); + } + res = prefs->GetCharPref(prefname.get(), &sonameList); if (!sonameList) { + if (soname) + return; // pref is not set, lets use hardcoded list prefSonameListIsSet = PR_FALSE; sonameList = PL_strdup(DEFAULT_EXTRA_LIBS_LIST); } if (sonameList) { char *arrayOfLibs[PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS] = {0}; int numOfLibs = 0; char *nextToken; char *p = nsCRT::strtok(sonameList,":",&nextToken); if (p) { @@ -367,56 +375,61 @@ nsresult nsPluginFile::LoadPlugin(PRLibr mPlugin->Exists(&exists); if (!exists) return NS_ERROR_FILE_NOT_FOUND; nsresult rv; nsCAutoString path; rv = mPlugin->GetNativePath(path); if (NS_FAILED(rv)) return rv; -#ifdef AIX nsCAutoString leafName; rv = mPlugin->GetNativeLeafName(leafName); if (NS_FAILED(rv)) return rv; +#ifdef AIX if (StringBeginsWith(leafName, NS_LITERAL_CSTRING("libjavaplugin_oji"))) SetJavaLibPath(path); #endif libSpec.value.pathname = path.get(); #if defined(MOZ_WIDGET_GTK2) /////////////////////////////////////////////////////////// + // Sometimes plugins are just evil and we need to help them + // not hurt us. This hook lets users preload arbitrary + // libraries for individual plugins. + LoadExtraSharedLibs(leafName.get()); + + /////////////////////////////////////////////////////////// // Normally, Mozilla isn't linked against libXt and libXext // since it's a Gtk/Gdk application. On the other hand, // legacy plug-ins expect the libXt and libXext symbols // to already exist in the global name space. This plug-in // wrapper is linked against libXt and libXext, but since // we never call on any of these libraries, plug-ins still // fail to resolve Xt symbols when trying to do a dlopen // at runtime. Explicitly opening Xt/Xext into the global // namespace before attempting to load the plug-in seems to // work fine. - #if defined(SOLARIS) || defined(HPUX) // Acrobat/libXm: Lazy resolving might cause crash later (bug 211587) pLibrary = outLibrary = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW); #else // Some dlopen() doesn't recover from a failed PR_LD_NOW (bug 223744) pLibrary = outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); #endif if (!pLibrary) { - LoadExtraSharedLibs(); + LoadExtraSharedLibs(nsnull); // try reload plugin once more pLibrary = outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); if (!pLibrary) DisplayPR_LoadLibraryErrorMessage(libSpec.value.pathname); } #else pLibrary = outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); #endif // MOZ_WIDGET_GTK2 #ifdef NS_DEBUG