From 811c16554f7da60919c1649537c42d0d6b14e3ee Mon Sep 17 00:00:00 2001 From: "jim_nance%yahoo.com" Date: Sat, 13 May 2000 12:39:16 +0000 Subject: [PATCH] Fix 37025. Slightly modified version of Rusty Lynches patch. r=jim_nance@yahoo.com git-svn-id: svn://10.0.0.236/trunk@69560 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/nsPluginsDirUNIX.cpp | 31 ++++++++++++------- .../plugin/nglsrc/nsPluginsDirUNIX.cpp | 31 ++++++++++++------- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirUNIX.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirUNIX.cpp index 5f64819306e..95a27b09c01 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirUNIX.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirUNIX.cpp @@ -131,20 +131,27 @@ nsPluginFile::~nsPluginFile() nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) { PRLibSpec libSpec; - void * handle; + PRLibSpec tempSpec; + PRLibrary * handle; -/* This is a hack for Tru64 Unix. We really should not be calling dlopen() - * directly, but since the original authors use NSPR functions in other - * places, I assume they have a reason for not doing it here. - * jlnance - Mon Apr 24 13:52:14 EDT 2000 - */ -#ifndef RTLD_GLOBAL -#define RTLD_GLOBAL 0 -#endif + /////////////////////////////////////////////////////////// + // 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. - // Ok, now to pull a rabbit out of my hat - handle = dlopen("libXt.so", RTLD_LAZY|RTLD_GLOBAL); - handle = dlopen("libXext.so", RTLD_NOW|RTLD_GLOBAL); + tempSpec.type = PR_LibSpec_Pathname; + tempSpec.value.pathname = "libXt.so"; + handle = PR_LoadLibraryWithFlags(tempSpec, PR_LD_NOW|PR_LD_GLOBAL); + + tempSpec.value.pathname = "libXext.so"; + handle = PR_LoadLibraryWithFlags(tempSpec, PR_LD_NOW|PR_LD_GLOBAL); libSpec.type = PR_LibSpec_Pathname; libSpec.value.pathname = this->GetCString(); diff --git a/mozilla/modules/plugin/nglsrc/nsPluginsDirUNIX.cpp b/mozilla/modules/plugin/nglsrc/nsPluginsDirUNIX.cpp index 5f64819306e..95a27b09c01 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginsDirUNIX.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginsDirUNIX.cpp @@ -131,20 +131,27 @@ nsPluginFile::~nsPluginFile() nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) { PRLibSpec libSpec; - void * handle; + PRLibSpec tempSpec; + PRLibrary * handle; -/* This is a hack for Tru64 Unix. We really should not be calling dlopen() - * directly, but since the original authors use NSPR functions in other - * places, I assume they have a reason for not doing it here. - * jlnance - Mon Apr 24 13:52:14 EDT 2000 - */ -#ifndef RTLD_GLOBAL -#define RTLD_GLOBAL 0 -#endif + /////////////////////////////////////////////////////////// + // 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. - // Ok, now to pull a rabbit out of my hat - handle = dlopen("libXt.so", RTLD_LAZY|RTLD_GLOBAL); - handle = dlopen("libXext.so", RTLD_NOW|RTLD_GLOBAL); + tempSpec.type = PR_LibSpec_Pathname; + tempSpec.value.pathname = "libXt.so"; + handle = PR_LoadLibraryWithFlags(tempSpec, PR_LD_NOW|PR_LD_GLOBAL); + + tempSpec.value.pathname = "libXext.so"; + handle = PR_LoadLibraryWithFlags(tempSpec, PR_LD_NOW|PR_LD_GLOBAL); libSpec.type = PR_LibSpec_Pathname; libSpec.value.pathname = this->GetCString();