Backed out changeset 7ff6eeaad3d1, bug 488042

This commit is contained in:
Josh Aas 2009-05-16 02:04:50 -04:00
parent a587e6f2eb
commit ce8d3e9c4f
4 changed files with 397 additions and 63 deletions

View File

@ -220,6 +220,35 @@ CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew)
return 0;
}
// We prefer the newer Java plugin by default, but if "UseNewJavaPlugin" is
// explicitly set to 0 then we'll use the older one.
static PRBool
PreferNPRuntimeJavaPlugIn(const TCHAR* javaVersion)
{
HKEY javaKey = NULL;
TCHAR keyName[_MAX_PATH];
_tcscpy(keyName, TEXT("Software\\JavaSoft\\Java Plug-in\\"));
_tcscat(keyName, javaVersion);
DWORD val;
DWORD valSize = sizeof(DWORD);
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
keyName, 0, KEY_READ, &javaKey)) {
return TRUE;
}
// Look for "UseNewJavaPlugin"
if (ERROR_SUCCESS != ::RegQueryValueEx(javaKey, TEXT("UseNewJavaPlugin"),
NULL, NULL,
(LPBYTE) &val,
&valSize)) {
val = 1;
}
::RegCloseKey(javaKey);
return (val == 0) ? PR_FALSE : PR_TRUE;
}
//*****************************************************************************
// nsPluginDirServiceProvider::Constructor/Destructor
//*****************************************************************************
@ -263,8 +292,9 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant,
*persistant = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (!prefs)
return NS_ERROR_FAILURE;
if (!prefs) {
return rv;
}
if (nsCRT::strcmp(charProp, NS_WIN_4DOTX_SCAN_KEY) == 0) {
// Check our prefs to see if scanning the 4.x folder has been
@ -273,7 +303,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant,
PRBool bScan4x;
if (NS_SUCCEEDED(prefs->GetBoolPref(NS_WIN_4DOTX_SCAN_KEY, &bScan4x)) &&
!bScan4x) {
return NS_ERROR_FAILURE;
return rv;
}
// Look for the plugin folder that the user has in their
@ -337,6 +367,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant,
TCHAR newestPath[JAVA_PATH_SIZE];
const TCHAR mozPath[_MAX_PATH] = TEXT("Software\\mozilla.org\\Mozilla");
TCHAR browserJavaVersion[_MAX_PATH];
PRBool preferNPRuntimeJavaPlugIn = PR_TRUE;
newestPath[0] = 0;
LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
@ -382,6 +413,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant,
if (CompareVersion(curVer, minVer) >= 0) {
if (!_tcsncmp(browserJavaVersion, curKey, _MAX_PATH)) {
_tcscpy(newestPath, path);
preferNPRuntimeJavaPlugIn = PreferNPRuntimeJavaPlugIn(curKey);
::RegCloseKey(keyloc);
break;
}
@ -389,6 +421,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant,
if (CompareVersion(curVer, maxVer) >= 0) {
_tcscpy(newestPath, path);
CopyVersion(&maxVer, &curVer);
preferNPRuntimeJavaPlugIn = PreferNPRuntimeJavaPlugIn(curKey);
}
}
}
@ -417,22 +450,31 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant,
_tcscat(newestPath, TEXT("\\bin"));
// See whether the "new_plugin" directory exists
TCHAR tmpPath[JAVA_PATH_SIZE];
nsCOMPtr<nsILocalFile> tmpFile;
// Use the new NPRuntime-based Java Plug-In if preferNPRuntimeJavaPlugIn
// is true (which it is by default), and if the appropriate subdirectory
// actually exists.
// Note that this is a temporary code path until the old
// OJI-based Java Plug-In isn't being shipped alongside the new
// one any more.
if (preferNPRuntimeJavaPlugIn) {
// See whether the "new_plugin" directory exists
TCHAR tmpPath[JAVA_PATH_SIZE];
nsCOMPtr<nsILocalFile> tmpFile;
nsresult rv;
_tcscpy(tmpPath, newestPath);
_tcscat(tmpPath, TEXT("\\new_plugin"));
rv = t_NS_NewNativeLocalFile(tmpPath, PR_TRUE, getter_AddRefs(tmpFile));
if (NS_SUCCEEDED(rv) && tmpFile) {
PRBool exists = PR_FALSE;
PRBool isDir = PR_FALSE;
if (NS_SUCCEEDED(tmpFile->Exists(&exists)) && exists &&
NS_SUCCEEDED(tmpFile->IsDirectory(&isDir)) && isDir) {
// Assume we're supposed to use this as the search
// directory for the Java Plug-In instead of the normal
// one
_tcscpy(newestPath, tmpPath);
_tcscpy(tmpPath, newestPath);
_tcscat(tmpPath, TEXT("\\new_plugin"));
rv = t_NS_NewNativeLocalFile(tmpPath, PR_TRUE, getter_AddRefs(tmpFile));
if (NS_SUCCEEDED(rv) && tmpFile) {
PRBool exists = PR_FALSE;
PRBool isDir = PR_FALSE;
if (NS_SUCCEEDED(tmpFile->Exists(&exists)) && exists &&
NS_SUCCEEDED(tmpFile->IsDirectory(&isDir)) && isDir) {
// Assume we're supposed to use this as the search
// directory for the Java Plug-In instead of the normal
// one
_tcscpy(newestPath, tmpPath);
}
}
}

View File

@ -1053,6 +1053,12 @@ nsresult PostPluginUnloadEvent(PRLibrary* aLibrary)
void nsPluginTag::TryUnloadPlugin(PRBool aForceShutdown)
{
PRBool isXPCOM = PR_FALSE;
if (!(mFlags & NS_PLUGIN_FLAG_NPAPI))
isXPCOM = PR_TRUE;
if (isXPCOM && !aForceShutdown) return;
if (mEntryPoint) {
mEntryPoint->Shutdown();
mEntryPoint->Release();
@ -1060,7 +1066,8 @@ void nsPluginTag::TryUnloadPlugin(PRBool aForceShutdown)
}
// before we unload check if we are allowed to, see bug #61388
if (mLibrary && mCanUnloadLibrary) {
// also, never unload an XPCOM plugin library
if (mLibrary && mCanUnloadLibrary && !isXPCOM) {
// NPAPI plugins can be unloaded now if they don't use XPConnect
if (!mXPConnected)
// unload the plugin asynchronously by posting a PLEvent
@ -2652,8 +2659,12 @@ nsresult nsPluginHostImpl::ReloadPlugins(PRBool reloadPages)
for (nsRefPtr<nsPluginTag> p = mPlugins; p != nsnull;) {
next = p->mNext;
// only remove our plugin from the list if it's not running.
if (!IsRunningPlugin(p)) {
// XXX only remove our plugin from the list if it's not running and not
// an XPCOM plugin. XPCOM plugins do not get a call to nsIPlugin::Shutdown
// if plugins are reloaded. This also fixes a crash on UNIX where the call
// to shutdown would break the ProxyJNI connection to the JRE after a reload.
// see bug 86591
if (!IsRunningPlugin(p) && (!p->mEntryPoint || p->HasFlag(NS_PLUGIN_FLAG_NPAPI))) {
if (p == mPlugins)
mPlugins = next;
else
@ -3517,9 +3528,11 @@ nsresult nsPluginHostImpl::AddInstanceToActiveList(nsCOMPtr<nsIPlugin> aPlugin,
if (aURL)
aURL->GetSpec(url);
// Let's find the corresponding plugin tag by matching nsIPlugin pointer.
// It is going to be used later when we decide whether or not we should delay
// unloading NPAPI dll from memory.
// let's find the corresponding plugin tag by matching nsIPlugin pointer
// it's legal for XPCOM plugins not to have nsIPlugin implemented but
// this is OK, we don't need the plugin tag for XPCOM plugins. It is going
// to be used later when we decide whether or not we should delay unloading
// NPAPI dll from memory, and XPCOM dlls will stay in memory anyway.
nsPluginTag * pluginTag = nsnull;
if (aPlugin) {
for (pluginTag = mPlugins; pluginTag != nsnull; pluginTag = pluginTag->mNext) {
@ -3695,38 +3708,61 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
NS_ASSERTION(pluginTag, "Must have plugin tag here!");
nsCAutoString contractID(
NS_LITERAL_CSTRING(NS_INLINE_PLUGIN_CONTRACTID_PREFIX) +
nsDependentCString(mimetype));
GetPluginFactory(mimetype, getter_AddRefs(plugin));
if (plugin) {
#if defined(XP_WIN) && !defined(WINCE)
static BOOL firstJavaPlugin = FALSE;
BOOL restoreOrigDir = FALSE;
char origDir[_MAX_PATH];
if (pluginTag->mIsJavaPlugin && !firstJavaPlugin) {
DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir);
NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding");
nsCOMPtr<nsIFile> binDirectory;
result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
getter_AddRefs(binDirectory));
instance = do_CreateInstance(contractID.get(), &result);
// couldn't create an XPCOM plugin, try to create wrapper for a
// legacy plugin
if (NS_FAILED(result)) {
if (plugin) {
#if defined(XP_WIN) && !defined(WINCE)
static BOOL firstJavaPlugin = FALSE;
BOOL restoreOrigDir = FALSE;
char origDir[_MAX_PATH];
if (pluginTag->mIsJavaPlugin && !firstJavaPlugin) {
DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir);
NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding");
nsCOMPtr<nsIFile> binDirectory;
result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
getter_AddRefs(binDirectory));
if (NS_SUCCEEDED(result)) {
nsCAutoString path;
binDirectory->GetNativePath(path);
restoreOrigDir = ::SetCurrentDirectory(path.get());
}
}
#endif
result = plugin->CreateInstance(NULL, kIPluginInstanceIID, (void **)getter_AddRefs(instance));
#if defined(XP_WIN) && !defined(WINCE)
if (!firstJavaPlugin && restoreOrigDir) {
BOOL bCheck = ::SetCurrentDirectory(origDir);
NS_ASSERTION(bCheck, " Error restoring driectoy");
firstJavaPlugin = TRUE;
}
#endif
}
if (NS_FAILED(result)) {
nsCOMPtr<nsIPlugin> bwPlugin =
do_GetService("@mozilla.org/blackwood/pluglet-engine;1", &result);
if (NS_SUCCEEDED(result)) {
nsCAutoString path;
binDirectory->GetNativePath(path);
restoreOrigDir = ::SetCurrentDirectory(path.get());
result = bwPlugin->CreatePluginInstance(NULL,
kIPluginInstanceIID,
aMimeType,
(void **)getter_AddRefs(instance));
}
}
#endif
result = plugin->CreateInstance(NULL, kIPluginInstanceIID, (void **)getter_AddRefs(instance));
#if defined(XP_WIN) && !defined(WINCE)
if (!firstJavaPlugin && restoreOrigDir) {
BOOL bCheck = ::SetCurrentDirectory(origDir);
NS_ASSERTION(bCheck, " Error restoring driectoy");
firstJavaPlugin = TRUE;
}
#endif
}
// neither an XPCOM or legacy plugin could be instantiated,
// so return the failure
if (NS_FAILED(result))
return result;
@ -3769,6 +3805,7 @@ nsPluginHostImpl::SetUpDefaultPluginInstance(const char *aMimeType,
{
if (mDefaultPluginDisabled) {
// The default plugin is disabled, don't load it.
return NS_OK;
}
@ -3781,10 +3818,20 @@ nsPluginHostImpl::SetUpDefaultPluginInstance(const char *aMimeType,
GetPluginFactory("*", getter_AddRefs(plugin));
nsresult result = NS_ERROR_OUT_OF_MEMORY;
if (plugin)
result = plugin->CreateInstance(NULL, kIPluginInstanceIID,
getter_AddRefs(instance));
nsresult result;
instance = do_CreateInstance(NS_INLINE_PLUGIN_CONTRACTID_PREFIX "*",
&result);
// couldn't create an XPCOM plugin, try to create wrapper for a
// legacy plugin
if (NS_FAILED(result)) {
if (plugin)
result = plugin->CreateInstance(NULL, kIPluginInstanceIID,
getter_AddRefs(instance));
}
// neither an XPCOM or legacy plugin could be instantiated, so
// return the failure
if (NS_FAILED(result))
return result;
@ -4131,6 +4178,102 @@ nsPluginHostImpl::FindPluginEnabledForExtension(const char* aExtension,
return nsnull;
}
#if defined(XP_MACOSX)
/* The following code examines the format of a Mac OS X binary, and determines whether it
* is compatible with the current executable.
*/
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <unistd.h>
static inline PRBool is_directory(const char* path)
{
struct stat sb;
return ::stat(path, &sb) == 0 && S_ISDIR(sb.st_mode);
}
static inline PRBool is_symbolic_link(const char* path)
{
struct stat sb;
return ::lstat(path, &sb) == 0 && S_ISLNK(sb.st_mode);
}
static int open_executable(const char* path)
{
int fd = 0;
char resolvedPath[PATH_MAX] = "\0";
// If the root of the bundle as referred to by path is a symbolic link,
// CFBundleCopyExecutableURL will not return an absolute URL, but will
// instead only return the executable name, such as "MRJPlugin". Work
// around that by always using a fully-resolved absolute pathname.
if (is_symbolic_link(path)) {
path = realpath(path, resolvedPath);
if (!path)
return fd;
}
// if this is a directory, it must be a bundle, so get the true path using CFBundle...
if (is_directory(path)) {
CFBundleRef bundle = NULL;
CFStringRef pathRef = CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8);
if (pathRef) {
CFURLRef bundleURL = CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, true);
CFRelease(pathRef);
if (bundleURL != NULL) {
bundle = CFBundleCreate(NULL, bundleURL);
CFRelease(bundleURL);
if (bundle) {
CFURLRef executableURL = CFBundleCopyExecutableURL(bundle);
if (executableURL) {
pathRef = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
CFRelease(executableURL);
if (pathRef) {
CFIndex bufferSize = CFStringGetMaximumSizeForEncoding(CFStringGetLength(pathRef), kCFStringEncodingUTF8) + 1;
char* executablePath = new char[bufferSize];
if (executablePath && CFStringGetCString(pathRef, executablePath, bufferSize, kCFStringEncodingUTF8)) {
fd = open(executablePath, O_RDONLY, 0);
delete[] executablePath;
}
CFRelease(pathRef);
}
}
CFRelease(bundle);
}
}
}
} else {
fd = open(path, O_RDONLY, 0);
}
return fd;
}
static PRBool IsCompatibleExecutable(const char* path)
{
int fd = open_executable(path);
if (fd > 0) {
// Check the executable header to see if it is something we can use. Currently
// we can only use 32-bit mach-o and FAT binaries (FAT headers are always big
// endian, so we do network-to-host swap on the bytes from disk).
// Note: We assume FAT binaries contain the right arch. Maybe fix that later.
UInt32 magic;
ssize_t n = read(fd, &magic, sizeof(magic));
close(fd);
if (n == sizeof(magic)) {
if ((magic == MH_MAGIC) || (PR_ntohl(magic) == FAT_MAGIC))
return PR_TRUE;
}
}
return PR_FALSE;
}
#else
inline PRBool IsCompatibleExecutable(const char* path) { return PR_TRUE; }
#endif
static nsresult ConvertToNative(nsIUnicodeEncoder *aEncoder,
const nsACString& aUTF8String,
nsACString& aNativeString)
@ -4227,18 +4370,65 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi
}
nsIPlugin* plugin = pluginTag->mEntryPoint;
if (!plugin) {
// nsIPlugin* of xpcom plugins can be found thru a call to
// nsIComponentManager::GetClassObjectByContractID()
nsCAutoString contractID(
NS_LITERAL_CSTRING(NS_INLINE_PLUGIN_CONTRACTID_PREFIX) +
nsDependentCString(aMimeType));
nsresult rv = CallGetClassObject(contractID.get(), &plugin);
if (NS_SUCCEEDED(rv) && plugin) {
// plugin is already addref'd
pluginTag->mEntryPoint = plugin;
plugin->Initialize();
}
}
if (!plugin) {
// No, this is not a leak. GetGlobalServiceManager() doesn't
// addref the pointer on the way out. It probably should.
nsIServiceManagerObsolete* serviceManager;
nsServiceManager::GetGlobalServiceManager((nsIServiceManager**)&serviceManager);
// Now lets try to get the entry point from an NPAPI plugin
rv = CreateNPAPIPlugin(serviceManager, pluginTag, &plugin);
if (NS_SUCCEEDED(rv))
pluginTag->mEntryPoint = plugin;
pluginTag->Mark(NS_PLUGIN_FLAG_NPAPI);
// no need to initialize, already done by CreatePlugin()
// need to get the plugin factory from this plugin.
nsFactoryProc nsGetFactory = nsnull;
#ifdef XP_OS2
nsGetFactory = (nsFactoryProc) PR_FindFunctionSymbol(pluginTag->mLibrary, "_NSGetFactory");
#else
nsGetFactory = (nsFactoryProc) PR_FindFunctionSymbol(pluginTag->mLibrary, "NSGetFactory");
#endif
if (nsGetFactory && IsCompatibleExecutable(pluginTag->mFullPath.get())) {
rv = nsGetFactory(serviceManager, kPluginCID, nsnull, nsnull, // XXX fix ClassName/ContractID
(nsIFactory**)&pluginTag->mEntryPoint);
plugin = pluginTag->mEntryPoint;
if (plugin)
plugin->Initialize();
}
#ifdef XP_OS2
// on OS2, first check if this might be legacy XPCOM module.
else if (PR_FindSymbol(pluginTag->mLibrary, "NSGetFactory") &&
IsCompatibleExecutable(pluginTag->mFullPath.get())) {
// Possibly a legacy XPCOM module. We'll need to create a calling
// vtable/calling convention wrapper for it.
nsCOMPtr<nsILegacyPluginWrapperOS2> wrapper =
do_GetService(NS_LEGACY_PLUGIN_WRAPPER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = wrapper->GetFactory(serviceManager, kPluginCID, nsnull, nsnull,
pluginTag->mLibrary, &pluginTag->mEntryPoint);
plugin = pluginTag->mEntryPoint;
if (plugin)
plugin->Initialize();
}
}
#endif
else {
// Now lets try to get the entry point from an NPAPI plugin
rv = CreateNPAPIPlugin(serviceManager, pluginTag, &plugin);
if (NS_SUCCEEDED(rv))
pluginTag->mEntryPoint = plugin;
pluginTag->Mark(NS_PLUGIN_FLAG_NPAPI);
// no need to initialize, already done by CreatePlugin()
}
}
if (plugin) {
@ -4721,6 +4911,8 @@ nsresult nsPluginHostImpl::FindPlugins(PRBool aCreatePluginList, PRBool * aPlugi
nsCOMPtr<nsIComponentManager> compManager;
NS_GetComponentManager(getter_AddRefs(compManager));
if (compManager)
LoadXPCOMPlugins(compManager);
#ifdef XP_WIN
// Failure here is not a show-stopper so just warn.
@ -4863,6 +5055,15 @@ nsresult nsPluginHostImpl::FindPlugins(PRBool aCreatePluginList, PRBool * aPlugi
// No more need for cached plugins. Clear it up.
mCachedPlugins = nsnull;
/*
* XXX Big time hack alert!!!!
* Because Real Player 8 installs in the components folder, we must have this one off
* scan for nppl3260.dll because XPCOM has shut off nsGetFactory type plugins.
* When we stop supporting Real 8 or they fix their installer, this can go away.
*/
if (aCreatePluginList)
ScanForRealInComponentsFolder(compManager);
// reverse our list of plugins
nsRefPtr<nsPluginTag> next;
nsRefPtr<nsPluginTag> prev;
@ -4880,6 +5081,23 @@ nsresult nsPluginHostImpl::FindPlugins(PRBool aCreatePluginList, PRBool * aPlugi
return NS_OK;
}
nsresult
nsPluginHostImpl::LoadXPCOMPlugins(nsIComponentManager* aComponentManager)
{
// the component reg is a flat file now see 48888
// we have to reimplement this method if we need it
// The "new style" XPCOM plugins have their information stored in
// the component registry, under the key
//
// nsIRegistry::Common/software/plugins
//
// Enumerate through that list now, creating an nsPluginTag for
// each.
return NS_OK;
}
nsresult
nsPluginHostImpl::UpdatePluginInfo(nsPluginTag* aPluginTag)
{
@ -6241,6 +6459,78 @@ nsPluginHostImpl::GetPluginName(nsIPluginInstance *aPluginInstance,
// end of nsPIPluginHost implementation
nsresult
nsPluginHostImpl::ScanForRealInComponentsFolder(nsIComponentManager * aCompManager)
{
nsresult rv = NS_OK;
#ifdef XP_WIN
// First, lets check if we already have Real. No point in doing this if it's installed correctly
if (NS_SUCCEEDED(IsPluginEnabledForType("audio/x-pn-realaudio-plugin")))
return rv;
// Next, maybe the pref wants to override
PRBool bSkipRealPlayerHack = PR_FALSE;
if (!mPrefService ||
(NS_SUCCEEDED(mPrefService->GetBoolPref("plugin.skip_real_player_hack", &bSkipRealPlayerHack)) &&
bSkipRealPlayerHack))
return rv;
// now we need the XPCOM components folder
nsCOMPtr<nsIFile> RealPlugin;
if (NS_FAILED(NS_GetSpecialDirectory(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(RealPlugin))) || !RealPlugin)
return rv;
// make sure the file is actually there
RealPlugin->AppendNative(nsDependentCString("nppl3260.dll"));
PRBool exists;
nsCAutoString filePath;
RealPlugin->Exists(&exists);
if (!exists || NS_FAILED(RealPlugin->GetNativePath(filePath)))
return rv;
// now make sure it's a plugin
nsCOMPtr<nsILocalFile> localfile;
NS_NewNativeLocalFile(filePath,
PR_TRUE,
getter_AddRefs(localfile));
if (!nsPluginsDir::IsPluginFile(localfile))
return rv;
// try to get the mime info and descriptions out of the plugin
nsPluginFile pluginFile(localfile);
nsPluginInfo info;
memset(&info, 0, sizeof(info));
if (NS_FAILED(pluginFile.GetPluginInfo(info)))
return rv;
nsCOMPtr<nsIComponentManager> compManager;
NS_GetComponentManager(getter_AddRefs(compManager));
// finally, create our "plugin tag" and add it to the list
if (info.fMimeTypeArray) {
nsRefPtr<nsPluginTag> pluginTag = new nsPluginTag(&info);
if (pluginTag) {
pluginTag->SetHost(this);
pluginTag->mNext = mPlugins;
mPlugins = pluginTag;
// last thing we need is to register this plugin with layout so it can be used in full-page mode
if (pluginTag->IsEnabled())
pluginTag->RegisterWithCategoryManager(mOverrideInternalTypes);
}
}
// free allocated strings in GetPluginInfo
pluginFile.FreePluginInfo(info);
#endif
return rv;
}
nsresult nsPluginHostImpl::AddUnusedLibrary(PRLibrary * aLibrary)
{
if (!mUnusedLibraries.Contains(aLibrary)) // don't add duplicates

View File

@ -338,6 +338,9 @@ private:
NS_IMETHOD
TrySetUpPluginInstance(const char *aMimeType, nsIURI *aURL, nsIPluginInstanceOwner *aOwner);
nsresult
LoadXPCOMPlugins(nsIComponentManager* aComponentManager);
nsresult
NewEmbeddedPluginStreamListener(nsIURI* aURL, nsIPluginInstanceOwner *aOwner,
nsIPluginInstance* aInstance,
@ -410,6 +413,9 @@ private:
nsresult GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt **aPrompt);
// one-off hack to include nppl3260.dll from the components folder
nsresult ScanForRealInComponentsFolder(nsIComponentManager * aCompManager);
// calls PostPluginUnloadEvent for each library in mUnusedLibraries
void UnloadUnusedLibraries();

View File

@ -190,12 +190,8 @@ PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
++extension;
if (len > 5) {
if (!PL_strncasecmp(filename, "np", 2) && !PL_strcasecmp(extension, "dll")) {
// don't load OJI-based Java plugins
if (!PL_strncasecmp(filename, "npoji", 5))
return PR_FALSE;
if (!PL_strncasecmp(filename, "np", 2) && !PL_strcasecmp(extension, "dll"))
return PR_TRUE;
}
}
return ret;
}