Bug 119310 preferences + open in new tab + clicking browser crashes @nsLoadGroup::RemoveRequest

assert instead of crashing if some load fails
r=darin sr=waterson
This commit is contained in:
timeless%mac.com 2002-01-16 00:16:51 +00:00
parent 4ca475a6d9
commit 7edbfb6b60
4 changed files with 16 additions and 13 deletions

View File

@ -5950,16 +5950,18 @@ nsXULDocument::ResumeWalk()
nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i];
observer->EndLoad(this);
}
NS_ASSERTION(mPlaceHolderRequest, "Bug 119310, perhaps overlayinfo referenced a overlay that doesn't exist");
if (mPlaceHolderRequest) {
// Remove the placeholder channel; if we're the last channel in the
// load group, this will fire the OnEndDocumentLoad() method in the
// docshell, and run the onload handlers, etc.
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
if (group) {
rv = group->RemoveRequest(mPlaceHolderRequest, nsnull, NS_OK);
if (NS_FAILED(rv)) return rv;
// Remove the placeholder channel; if we're the last channel in the
// load group, this will fire the OnEndDocumentLoad() method in the
// docshell, and run the onload handlers, etc.
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
if (group) {
rv = group->RemoveRequest(mPlaceHolderRequest, nsnull, NS_OK);
if (NS_FAILED(rv)) return rv;
mPlaceHolderRequest = nsnull;
mPlaceHolderRequest = nsnull;
}
}
return rv;
}

View File

@ -1380,9 +1380,9 @@ nsresult nsParser::DidBuildModel(nsresult anErrorCode) {
nsresult result=anErrorCode;
if (IsComplete()) {
if(mParserContext && !mParserContext->mPrevContext) {
if (mParserContext && !mParserContext->mPrevContext) {
if (mParserContext->mDTD) {
result = mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool(0==mParserContext->mPrevContext),this,mSink);
result = mParserContext->mDTD->DidBuildModel(anErrorCode,PR_TRUE,this,mSink);
}
//Ref. to bug 61462.
mParserContext->mRequest = 0;

View File

@ -482,6 +482,7 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
NS_IMETHODIMP
nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt, nsresult aStatus)
{
NS_ENSURE_ARG_POINTER(request);
nsresult rv;
#if defined(PR_LOGGING)

View File

@ -1380,9 +1380,9 @@ nsresult nsParser::DidBuildModel(nsresult anErrorCode) {
nsresult result=anErrorCode;
if (IsComplete()) {
if(mParserContext && !mParserContext->mPrevContext) {
if (mParserContext && !mParserContext->mPrevContext) {
if (mParserContext->mDTD) {
result = mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool(0==mParserContext->mPrevContext),this,mSink);
result = mParserContext->mDTD->DidBuildModel(anErrorCode,PR_TRUE,this,mSink);
}
//Ref. to bug 61462.
mParserContext->mRequest = 0;