Fix for bug # 99638. r=darin sr=rpotts. Use nsIMultiPartChannel to access

htttpChannel that is part of a multipartChannel.


git-svn-id: svn://10.0.0.236/trunk@109051 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
radha%netscape.com
2001-11-27 23:14:15 +00:00
parent ddac650d1a
commit 73b66f889a
2 changed files with 32 additions and 2 deletions

View File

@@ -68,7 +68,6 @@
// Interfaces Needed
#include "nsIUploadChannel.h"
#include "nsIHttpChannel.h"
#include "nsIDataChannel.h"
#include "nsIProgressEventSink.h"
#include "nsIWebProgress.h"
@@ -83,6 +82,7 @@
#include "nsIDOMDocument.h"
#include "nsICachingChannel.h"
#include "nsICacheEntryDescriptor.h"
#include "nsIMultiPartChannel.h"
// The following are for bug #13871: Prevent frameset spoofing
#include "nsICodebasePrincipal.h"
@@ -4648,6 +4648,11 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel,
nsCOMPtr<nsIInputStream> inputStream;
if (aChannel) {
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel));
// Check if the HTTPChannel is hiding under a multiPartChannel
if (!httpChannel) {
GetHttpChannel(aChannel, getter_AddRefs(httpChannel));
}
if (httpChannel) {
httpChannel->GetUploadStream(getter_AddRefs(inputStream));
@@ -5105,7 +5110,11 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
cacheChannel->GetCacheToken(getter_AddRefs(cacheToken));
}
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel));
// Check if the httpChannel is hiding under a multipartChannel
if (!httpChannel) {
GetHttpChannel(aChannel, getter_AddRefs(httpChannel));
}
if (httpChannel) {
httpChannel->GetUploadStream(getter_AddRefs(inputStream));
httpChannel->GetReferrer(getter_AddRefs(referrerURI));
@@ -5367,6 +5376,7 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, PRUint32 aCloneID,
}
nsresult
nsDocShell::GetRootSessionHistory(nsISHistory ** aReturn)
{
@@ -5384,6 +5394,24 @@ nsDocShell::GetRootSessionHistory(nsISHistory ** aReturn)
return rv;
}
nsresult
nsDocShell::GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
if (!aChannel)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIMultiPartChannel> multiPartChannel(do_QueryInterface(aChannel));
if (multiPartChannel) {
nsCOMPtr<nsIChannel> baseChannel;
multiPartChannel->GetBaseChannel(getter_AddRefs(baseChannel));
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(baseChannel));
*aReturn = httpChannel;
NS_IF_ADDREF(*aReturn);
}
return NS_OK;
}
//*****************************************************************************
// nsDocShell: Global History
//*****************************************************************************