Fix for stall when saving certain documents. Don't count non-persistent URIs when figuring out whether to do state notifications synchronously or asynchronously. b=122078 r=brade@netscape.com sr=rpotts@netscape.com

This commit is contained in:
locka%iol.ie 2002-02-01 12:42:13 +00:00
parent 0625a92542
commit e4324c4f4c
2 changed files with 23 additions and 1 deletions

View File

@ -329,7 +329,14 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveDocument(
if (datapathAsURI)
{
// Count how many URIs in the URI map require persisting
PRUint32 urisToPersist = 0;
if (mURIMap.Count() > 0)
{
mURIMap.Enumerate(EnumCountURIsToPersist, &urisToPersist);
}
if (urisToPersist > 0)
{
// Persist each file in the uri map. The document(s)
// will be saved after the last one of these is saved.
@ -1249,6 +1256,18 @@ nsWebBrowserPersist::EnumCalcProgress(nsHashKey *aKey, void *aData, void* closur
return PR_TRUE;
}
PRBool PR_CALLBACK
nsWebBrowserPersist::EnumCountURIsToPersist(nsHashKey *aKey, void *aData, void* closure)
{
URIData *data = (URIData *) aData;
PRUint32 *count = (PRUint32 *) closure;
if (data->mNeedsPersisting && !data->mSaved)
{
(*count)++;
}
return PR_TRUE;
}
PRBool PR_CALLBACK
nsWebBrowserPersist::EnumPersistURIs(nsHashKey *aKey, void *aData, void* closure)
{
@ -1274,7 +1293,6 @@ nsWebBrowserPersist::EnumPersistURIs(nsHashKey *aKey, void *aData, void* closure
NS_ENSURE_SUCCESS(rv, PR_FALSE);
rv = pthis->SaveURIInternal(uri, nsnull, fileAsURI, PR_TRUE);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
// Store the actual object because once it's persisted this
// will be fixed up with the right file extension.
@ -1282,6 +1300,8 @@ nsWebBrowserPersist::EnumPersistURIs(nsHashKey *aKey, void *aData, void* closure
data->mFile = fileAsURI;
data->mSaved = PR_TRUE;
NS_ENSURE_SUCCESS(rv, PR_FALSE);
return PR_TRUE;
}

View File

@ -129,6 +129,8 @@ private:
nsHashKey *aKey, void *aData, void* closure);
static PRBool PR_CALLBACK EnumFixRedirect(
nsHashKey *aKey, void *aData, void* closure);
static PRBool PR_CALLBACK EnumCountURIsToPersist(
nsHashKey *aKey, void *aData, void* closure);
nsCOMPtr<nsIURI> mCurrentDataPath;
PRBool mCurrentDataPathIsRelative;