Fix for not opening bundles plugin resources on Mac fixing crashes (and tab clean up) bug 91988 r=bnesse sr=sfraser

This commit is contained in:
peterlubczynski%netscape.com 2001-08-22 03:55:53 +00:00
Родитель 5e263b2559
Коммит fde7ebe790
3 изменённых файлов: 116 добавлений и 102 удалений

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

@ -339,9 +339,9 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
FSSpec spec = file;
if (!nsCRT::memcmp(spec.name + 1, aFileName, spec.name[0]))
{
Boolean targetIsFolder, wasAliased;
OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased);
pluginRefNum = ::FSpOpenResFile(&spec, fsRdPerm);
nsPluginFile pluginFile(file);
pluginRefNum = pluginFile.OpenPluginResource();
if (pluginRefNum != -1)
found = true;
}
}
@ -364,10 +364,10 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
FSSpec spec = file;
if (!nsCRT::memcmp(spec.name + 1, aFileName, spec.name[0]))
{
Boolean targetIsFolder, wasAliased;
OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased);
pluginRefNum = ::FSpOpenResFile(&spec, fsRdPerm);
found = PR_TRUE;
nsPluginFile pluginFile(file);
pluginRefNum = pluginFile.OpenPluginResource();
if (pluginRefNum != -1)
found = true;
}
}
}
@ -544,6 +544,7 @@ ns4xPlugin::Shutdown(void)
fShutdownEntry = nsnull;
}
PLUGIN_LOG(PLUGIN_LOG_NORMAL,("4xPlugin Shutdown done, this=%p",this));
return NS_OK;
}

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

@ -102,6 +102,9 @@ public:
* Should be called after GetPluginInfo to free all allocated stuff
*/
nsresult FreePluginInfo(nsPluginInfo &PluginInfo);
// Open the resource fork for the plugin
short OpenPluginResource(void);
};
#endif /* nsPluginsDir_h___ */

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

@ -202,15 +202,10 @@ static char* GetPluginString(short id, short index)
return p2cstrdup(str);
}
/**
* Obtains all of the information currently available for this plugin.
*/
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
// Opens the resource fork for the plugin
// Also checks if the plugin is a CFBundle and opens gets the correct resource
short nsPluginFile::OpenPluginResource()
{
// clear out the info, except for the first field.
nsCRT::memset(&info.fName, 0, sizeof(info) - sizeof(PRUint32));
// need to open the plugin's resource file and read some resources.
FSSpec spec = *this;
Boolean targetIsFolder, wasAliased;
OSErr err = ::ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased);
@ -226,6 +221,20 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
}
#endif
return refNum;
}
/**
* Obtains all of the information currently available for this plugin.
*/
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
{
// clear out the info, except for the first field.
nsCRT::memset(&info.fName, 0, sizeof(info) - sizeof(PRUint32));
// need to open the plugin's resource file and read some resources.
short refNum = OpenPluginResource();
if (refNum != -1) {
if (info.fPluginInfoSize >= sizeof(nsPluginInfo)) {
// 'STR#', 126, 2 => plugin name.
@ -242,6 +251,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
::ReleaseResource(typeList);
}
FSSpec spec = *this;
int variantCount = info.fVariantCount;
info.fMimeTypeArray = new char*[variantCount];
info.fMimeDescriptionArray = new char*[variantCount];