Fix for 97249. Crash was being caused (regardless of what stack is

showing) by not carefully iterating the component list and
processing CRCs only on those XPI files that were downloaded.
r=jag, sr=dveditz.


git-svn-id: svn://10.0.0.236/trunk@104055 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
syd%netscape.com
2001-09-28 01:17:46 +00:00
parent fd8415d494
commit e4b9e2a9dd
2 changed files with 11 additions and 7 deletions

View File

@@ -87,6 +87,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
int fileSize = 0;
int currCompNum = 1, markedCompNum = 0;
int numToDL = 0; // num xpis to download
int passCount;
CONN myConn;
err = GetDLMarkedComp(aComps, aCustom, &markedComp, &markedCompNum);
@@ -121,6 +122,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
currCompSave = currComp;
bDone = 0;
while ( bDone == 0 && crcPass < MAXCRC ) {
passCount = 0;
while (currComp)
{
if ( (aCustom == TRUE && currComp->IsSelected()) || (aCustom == FALSE) )
@@ -252,7 +254,6 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
// closes the old connection if any
isNewConn = CheckConn( currHost, TYPE_FTP, &myConn, PR_FALSE );
err = nsFTPConn::OK;
nsFTPConn *conn;
@@ -277,7 +278,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
currComp->GetArchive());
err = conn->Get(srvPath, localPath, nsFTPConn::BINARY,
resPos, 1, nsInstallDlg::DownloadCB);
// conn->Close();
passCount++;
}
XI_IF_FREE(currHost);
@@ -339,7 +340,8 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
CheckConn( "", TYPE_UNDEF, &myConn, true );
bDone = CRCCheckDownloadedArchives(XPI_DIR, strlen(XPI_DIR), currCompSave, currCompNum);
bDone = CRCCheckDownloadedArchives(XPI_DIR, strlen(XPI_DIR),
currCompSave, passCount, aCustom);
crcPass++;
if ( bDone == 0 && crcPass < MAXCRC ) {
// reset ourselves
@@ -993,7 +995,7 @@ nsXIEngine::TotalToDownload(int aCustom, nsComponentList *aComps)
PRBool
nsXIEngine::CRCCheckDownloadedArchives(char *dlPath, short dlPathlen,
nsComponent *currComp, int count)
nsComponent *currComp, int count, int aCustom)
{
int i;
PRBool isClean;
@@ -1001,13 +1003,15 @@ nsXIEngine::CRCCheckDownloadedArchives(char *dlPath, short dlPathlen,
isClean = PR_TRUE;
for(i = 0; currComp != (nsComponent *) NULL && i < MAX_COMPONENTS; i++) {
for(i = 0; currComp != (nsComponent *) NULL && i < MAX_COMPONENTS; i++) {
strncpy( buf, (const char *) dlPath, dlPathlen );
buf[ dlPathlen ] = '\0';
strcat( buf, "/" );
strcat( buf, currComp->GetArchive() );
nsInstallDlg::MajorProgressCB(buf, i, count, nsInstallDlg::ACT_INSTALL);
if (IsArchiveFile(buf) == PR_TRUE && VerifyArchive( buf ) != ZIP_OK) {
if (((aCustom == TRUE && currComp->IsSelected()) ||
(aCustom == FALSE)) && IsArchiveFile(buf) == PR_TRUE &&
VerifyArchive( buf ) != ZIP_OK) {
currComp->SetDownloaded(FALSE); // VerifyArchive has unlinked it
isClean = false;
}

View File

@@ -119,7 +119,7 @@ private:
int DelDLMarker();
int TotalToDownload(int aCustom, nsComponentList *aComps);
PRBool CRCCheckDownloadedArchives(char *dlPath, short dlPathLen,
nsComponent *currComp, int count);
nsComponent *currComp, int count, int aCustom);
PRBool IsArchiveFile(char *path);
int VerifyArchive(char *szArchive);
PRBool CheckConn( char *URL, int type, CONN *myConn, PRBool force );