diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 07a68106636..68da1b4e97b 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -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 inputStream; if (aChannel) { nsCOMPtr 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 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 multiPartChannel(do_QueryInterface(aChannel)); + if (multiPartChannel) { + nsCOMPtr baseChannel; + multiPartChannel->GetBaseChannel(getter_AddRefs(baseChannel)); + nsCOMPtr httpChannel(do_QueryInterface(baseChannel)); + *aReturn = httpChannel; + NS_IF_ADDREF(*aReturn); + } + return NS_OK; +} + //***************************************************************************** // nsDocShell: Global History //***************************************************************************** diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index 9c08bd3ea9e..173230e3978 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -76,6 +76,7 @@ #include "nsIDocShellHistory.h" #include "nsIURIFixup.h" #include "nsIWebBrowserFind.h" +#include "nsIHttpChannel.h" #define MAKE_LOAD_TYPE(type, flags) ((type) | ((flags) << 16)) @@ -238,6 +239,7 @@ protected: NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, PRUint32 aCloneID, nsISHEntry * areplaceEntry, nsISHEntry ** destEntry); nsresult GetRootSessionHistory(nsISHistory ** aReturn); + nsresult GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn); // Global History NS_IMETHOD ShouldAddToGlobalHistory(nsIURI * aURI, PRBool * aShouldAdd);