Allow a blank (magic) registry name passed to StartInstall() as in 4.x;

Don't delete a jarfile we didn't download! plus bugs 10749,13386
This commit is contained in:
dveditz%netscape.com 1999-09-17 00:11:24 +00:00
Родитель 0ed39c7f4e
Коммит 92f34f9d7a
3 изменённых файлов: 21 добавлений и 13 удалений

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

@ -137,6 +137,7 @@ nsInstall::nsInstall()
{
mScriptObject = nsnull; // this is the jsobject for our context
mVersionInfo = nsnull; // this is the version information passed to us in StartInstall()
mInstalledFiles = nsnull; // the list of installed objects
mRegistryPackageName = ""; // this is the name that we will add into the registry for the component we are installing
mUIName = ""; // this is the name that will be displayed in UI.
@ -1217,6 +1218,13 @@ nsInstall::SetPackageFolder(const nsString& aFolder)
PRInt32
nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aRegistryPackageName, const nsString& aVersion, PRInt32* aReturn)
{
if ( aUserPackageName.Length() == 0 )
{
// There must be some pretty name for the UI and the uninstall list
*aReturn = SaveError(INVALID_ARGUMENTS);
return NS_OK;
}
char szRegPackagePath[MAXREGPATHLEN];
char* szRegPackageName = aRegistryPackageName.ToNewCString();
@ -1233,12 +1241,6 @@ nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aRegis
mUserCancelled = PR_FALSE;
if ( aRegistryPackageName.Equals("") )
{
*aReturn = nsInstall::INVALID_ARGUMENTS;
return NS_OK;
}
mUIName = aUserPackageName;
*aReturn = GetQualifiedPackageName( aRegistryPackageName, mRegistryPackageName );
@ -1786,7 +1788,7 @@ nsInstall::ScheduleForInstall(nsInstallObject* ob)
PRInt32
nsInstall::SanityCheck(void)
{
if ( mRegistryPackageName == "" || mUIName == "")
if ( mInstalledFiles == nsnull )
{
return INSTALL_NOT_STARTED;
}

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

@ -134,7 +134,7 @@ nsLoggingProgressNotifier::FinalizeProgress(const PRUnichar* message, PRInt32 it
{
if (mLogStream == nsnull) return NS_ERROR_NULL_POINTER;
*mLogStream << " Item [" << (itemNum+1) << "/" << totNum << "]\t" << nsAutoCString(message) << nsEndl;
*mLogStream << " Item [" << (itemNum) << "/" << totNum << "]\t" << nsAutoCString(message) << nsEndl;
return NS_OK;
}

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

@ -374,8 +374,14 @@ bail:
notifier->AfterJavascriptEvaluation( url.GetUnicode() );
if (scriptBuffer) delete [] scriptBuffer;
if (jarpath) {
if (jarpath)
{
if ( !url.Equals("file://",7) )
{
// delete the jarfile only if we've downloaded it
PR_Delete(jarpath);
}
nsCRT::free(jarpath);
}