fixed bug when firing the OnConnectionsComplete() notification. If one of the listeners initiated a new URL load then state in the doc loader became inconsistent...

This commit is contained in:
rpotts%netscape.com 1999-01-19 22:48:05 +00:00
Родитель 1892e8e3e5
Коммит 5a21fff729
2 изменённых файлов: 30 добавлений и 10 удалений

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

@ -1229,6 +1229,15 @@ void nsDocLoaderImpl::LoadURLComplete(nsIURL* aURL, nsISupports* aBindInfo, PRIn
NS_ASSERTION((mTotalURLs >= mForegroundURLs), "Foreground URL count is wrong.");
#ifdef DEBUG
const char* buffer;
aURL->GetSpec(&buffer);
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
("DocLoader - LoadURLComplete(...) called for %s.\nForeground URLs: %d\nTotal URLs: %d\n",
buffer, mForegroundURLs, mTotalURLs));
#endif /* DEBUG */
/*
* If this was the last URL for the entire document (including any sub
* documents) then fire an OnConnectionsComplete(...) notification.
@ -1258,16 +1267,17 @@ void nsDocLoaderImpl::AreAllConnectionsComplete(void)
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
("DocLoader [%p] - OnConnectionsComplete(...) called.\n", this));
/* Notify all observers that all connections have been loaded... */
for (index = 0; index < count; index++) {
nsIDocumentLoaderObserver* observer = (nsIDocumentLoaderObserver*)mDocObservers.ElementAt(index);
observer->OnConnectionsComplete();
}
/*
* Clear the flag indicating that the document loader is still loading a
* document...
*/
mIsLoadingDocument = PR_FALSE;
/* Notify all observers that all connections have been loaded... */
for (index = 0; index < count; index++) {
nsIDocumentLoaderObserver* observer = (nsIDocumentLoaderObserver*)mDocObservers.ElementAt(index);
observer->OnConnectionsComplete();
}
}
}
/*

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

@ -1229,6 +1229,15 @@ void nsDocLoaderImpl::LoadURLComplete(nsIURL* aURL, nsISupports* aBindInfo, PRIn
NS_ASSERTION((mTotalURLs >= mForegroundURLs), "Foreground URL count is wrong.");
#ifdef DEBUG
const char* buffer;
aURL->GetSpec(&buffer);
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
("DocLoader - LoadURLComplete(...) called for %s.\nForeground URLs: %d\nTotal URLs: %d\n",
buffer, mForegroundURLs, mTotalURLs));
#endif /* DEBUG */
/*
* If this was the last URL for the entire document (including any sub
* documents) then fire an OnConnectionsComplete(...) notification.
@ -1258,16 +1267,17 @@ void nsDocLoaderImpl::AreAllConnectionsComplete(void)
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
("DocLoader [%p] - OnConnectionsComplete(...) called.\n", this));
/* Notify all observers that all connections have been loaded... */
for (index = 0; index < count; index++) {
nsIDocumentLoaderObserver* observer = (nsIDocumentLoaderObserver*)mDocObservers.ElementAt(index);
observer->OnConnectionsComplete();
}
/*
* Clear the flag indicating that the document loader is still loading a
* document...
*/
mIsLoadingDocument = PR_FALSE;
/* Notify all observers that all connections have been loaded... */
for (index = 0; index < count; index++) {
nsIDocumentLoaderObserver* observer = (nsIDocumentLoaderObserver*)mDocObservers.ElementAt(index);
observer->OnConnectionsComplete();
}
}
}
/*