fall back on nsILoadGroup when nsIChannel has no nsIPrompt.

Bug 72111; r=bbaetz, sr=darin
This commit is contained in:
badami%netscape.com 2002-02-12 04:27:31 +00:00
parent a5c73d7696
commit d0c4ee54ef
2 changed files with 20 additions and 2 deletions

View File

@ -1806,6 +1806,16 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
mKeepRunning = PR_TRUE;
mPrompter = aPrompter;
if (!mPrompter) {
nsCOMPtr<nsILoadGroup> ldGrp;
aChannel->GetLoadGroup(getter_AddRefs(ldGrp));
if (ldGrp) {
nsCOMPtr<nsIInterfaceRequestor> cbs;
rv = ldGrp->GetNotificationCallbacks(getter_AddRefs(cbs));
if (NS_SUCCEEDED(rv))
mPrompter = do_GetInterface(cbs);
}
}
mFTPEventSink = sink;
mAuthPrompter = aAuthPrompter;
mCacheEntry = cacheEntry;

View File

@ -582,8 +582,16 @@ nsGopherChannel::SendRequest(nsITransport* aTransport)
// We require a query string here - if we don't have one,
// then we need to ask the user
if (!mPrompter) {
NS_ERROR("We need a prompter!");
return NS_ERROR_FAILURE;
if (mLoadGroup) {
nsCOMPtr<nsIInterfaceRequestor> cbs;
rv = mLoadGroup->GetNotificationCallbacks(getter_AddRefs(cbs));
if (NS_SUCCEEDED(rv))
mPrompter = do_GetInterface(cbs);
}
if (!mPrompter) {
NS_ERROR("We need a prompter!");
return NS_ERROR_FAILURE;
}
}
nsXPIDLString search;
PRBool res;