mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug #56934 --> properly determine the status for on end document load. We used to
use the status of the last request processed in loading the document to determine success or failure. That's incorrect. Instead, test to see if the load group is being canceled. If it is, use that as the status for the entire document. Otherwise, ignore the status for the last request and instead use the status for the main document (the default load channel). sr=rpotts, r=sspitzer
This commit is contained in:
parent
b2a2d07e66
commit
f5614e7782
@ -56,7 +56,8 @@ PRLogModuleInfo* gLoadGroupLog = nsnull;
|
||||
nsLoadGroup::nsLoadGroup(nsISupports* outer)
|
||||
: mDefaultLoadAttributes(nsIChannel::LOAD_NORMAL),
|
||||
mForegroundCount(0),
|
||||
mChannels(nsnull)
|
||||
mChannels(nsnull),
|
||||
mStatus(NS_OK)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
|
||||
@ -186,7 +187,10 @@ nsLoadGroup::IsPending(PRBool *aResult)
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetStatus(nsresult *status)
|
||||
{
|
||||
*status = NS_OK;
|
||||
if (NS_SUCCEEDED(mStatus) && mDefaultLoadChannel)
|
||||
return mDefaultLoadChannel->GetStatus(status);
|
||||
|
||||
*status = mStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -197,6 +201,11 @@ nsLoadGroup::Cancel(nsresult status)
|
||||
nsresult rv, firstError;
|
||||
PRUint32 count;
|
||||
|
||||
// set the load group status to our cancel status while we cancel
|
||||
// all our requests...once the cancel is done, we'll reset it...
|
||||
|
||||
mStatus = status;
|
||||
|
||||
rv = mChannels->Count(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -262,6 +271,7 @@ nsLoadGroup::Cancel(nsresult status)
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
mStatus = NS_OK;
|
||||
return firstError;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,8 @@ protected:
|
||||
nsCOMPtr<nsIChannel> mDefaultLoadChannel;
|
||||
|
||||
nsWeakPtr mGroupListenerFactory;
|
||||
|
||||
nsresult mStatus;
|
||||
};
|
||||
|
||||
#endif // nsLoadGroup_h__
|
||||
|
@ -595,6 +595,10 @@ void nsDocLoaderImpl::DocLoaderIsEmpty(nsresult aStatus)
|
||||
// Update the progress status state - the document is done
|
||||
mProgressStateFlags = nsIWebProgressListener::STATE_STOP;
|
||||
|
||||
|
||||
nsresult loadGroupStatus = NS_OK;
|
||||
mLoadGroup->GetStatus(&loadGroupStatus);
|
||||
|
||||
//
|
||||
// New code to break the circular reference between
|
||||
// the load group and the docloader...
|
||||
@ -606,11 +610,11 @@ void nsDocLoaderImpl::DocLoaderIsEmpty(nsresult aStatus)
|
||||
// loader may be loading a *new* document - if LoadDocument()
|
||||
// was called from a handler!
|
||||
//
|
||||
doStopDocumentLoad(docChannel, aStatus);
|
||||
FireOnEndDocumentLoad(this, docChannel, aStatus);
|
||||
doStopDocumentLoad(docChannel, loadGroupStatus);
|
||||
FireOnEndDocumentLoad(this, docChannel, loadGroupStatus);
|
||||
|
||||
if (mParent) {
|
||||
mParent->DocLoaderIsEmpty(aStatus);
|
||||
mParent->DocLoaderIsEmpty(loadGroupStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user