fix for bug 199910 - should HTTP null-check prompt callbacks?. r-dougt, sr-darin.

This commit is contained in:
suresh%netscape.com 2003-04-02 23:43:12 +00:00
parent 11ad7740c2
commit 3eab16a931

View File

@ -753,6 +753,8 @@ nsHttpChannel::GetCallback(const nsIID &aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aResult, "Invalid argument in GetCallback!");
*aResult = nsnull;
NS_ENSURE_TRUE(mCallbacks, NS_ERROR_NOT_INITIALIZED);
rv = mCallbacks->GetInterface(aIID, aResult);
if (NS_FAILED(rv)) {
if (mLoadGroup) {
@ -763,6 +765,10 @@ nsHttpChannel::GetCallback(const nsIID &aIID, void **aResult)
}
}
// defend against bad nsIInterfaceRequestor implementations.
if (NS_SUCCEEDED(rv) && !*aResult)
return NS_ERROR_NO_INTERFACE;
return rv;
}
@ -786,11 +792,9 @@ nsHttpChannel::PromptTempRedirect()
nsCOMPtr<nsIPrompt> prompt;
rv = GetCallback(NS_GET_IID(nsIPrompt), getter_AddRefs(prompt));
if (NS_FAILED(rv)) return rv;
if (prompt) {
prompt->Confirm(nsnull, messageString, &repost);
if (!repost)
return NS_ERROR_FAILURE;
}
prompt->Confirm(nsnull, messageString, &repost);
if (!repost)
return NS_ERROR_FAILURE;
}
return rv;