diff --git a/mozilla/docshell/base/nsDSURIContentListener.cpp b/mozilla/docshell/base/nsDSURIContentListener.cpp index 08645cc16fb..fba33cde8d7 100644 --- a/mozilla/docshell/base/nsDSURIContentListener.cpp +++ b/mozilla/docshell/base/nsDSURIContentListener.cpp @@ -22,6 +22,7 @@ #include "nsDocShell.h" #include "nsDSURIContentListener.h" +#include "nsIChannel.h" //***************************************************************************** //*** nsDSURIContentListener: Object Management @@ -103,6 +104,39 @@ NS_IMETHODIMP nsDSURIContentListener::CanHandleContent(const char* aContentType, return NS_OK; } +NS_IMETHODIMP +nsDSURIContentListener::GetParentContentListener(nsIURIContentListener** + aParentListener) +{ + *aParentListener = mParentContentListener; + NS_IF_ADDREF(*aParentListener); + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::SetParentContentListener(nsIURIContentListener* + aParentListener) +{ + // Weak Reference, don't addref + mParentContentListener = aParentListener; + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::GetLoadCookie(nsISupports ** aLoadCookie) +{ + *aLoadCookie = mLoadCookie; + NS_IF_ADDREF(*aLoadCookie); + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::SetLoadCookie(nsISupports * aLoadCookie) +{ + mLoadCookie = aLoadCookie; + return NS_OK; +} + //***************************************************************************** // nsDSURIContentListener: Helpers //***************************************************************************** @@ -135,20 +169,6 @@ nsDocShell* nsDSURIContentListener::DocShell() return mDocShell; } -void nsDSURIContentListener::GetParentContentListener(nsIURIContentListener** - aParentListener) -{ - *aParentListener = mParentContentListener; - NS_IF_ADDREF(*aParentListener); -} - -void nsDSURIContentListener::SetParentContentListener(nsIURIContentListener* - aParentListener) -{ - // Weak Reference, don't addref - mParentContentListener = aParentListener; -} - void nsDSURIContentListener::GetPresContext(nsIPresContext** aPresContext) { *aPresContext = mPresContext; diff --git a/mozilla/docshell/base/nsDSURIContentListener.h b/mozilla/docshell/base/nsDSURIContentListener.h index d4904354424..55fcbd3fe6e 100644 --- a/mozilla/docshell/base/nsDSURIContentListener.h +++ b/mozilla/docshell/base/nsDSURIContentListener.h @@ -43,8 +43,6 @@ protected: void DocShell(nsDocShell* aDocShell); nsDocShell* DocShell(); - void GetParentContentListener(nsIURIContentListener** aParentListener); - void SetParentContentListener(nsIURIContentListener* aParentListener); void GetPresContext(nsIPresContext** aPresContext); void SetPresContext(nsIPresContext* aPresContext); PRBool HandleInCurrentDocShell(const char* aContentType, @@ -54,6 +52,7 @@ protected: protected: nsDocShell* mDocShell; nsCOMPtr mPresContext; + nsCOMPtr mLoadCookie; // the load cookie associated with the window context. nsIURIContentListener* mParentContentListener; // Weak Reference }; diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 820ebc3dcb1..1940aebe05b 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -28,6 +28,7 @@ #include "nsIDOMDocument.h" #include "nsIDOMElement.h" #include "nsIDocumentViewer.h" +#include "nsIDocumentLoaderFactory.h" #include "nsIDeviceContext.h" #include "nsCURILoader.h" #include "nsLayoutCID.h" @@ -147,13 +148,17 @@ NS_IMETHODIMP nsDocShell::LoadURIVia(nsIURI* aUri, // first, open a channel for the url nsCOMPtr channel; nsCOMPtr capabilities (do_QueryInterface(NS_STATIC_CAST(nsIDocShell *, this))); - nsCOMPtr loadGroup(do_QueryInterface(mLoadCookie)); + + // we need to get the load group from our load cookie so we can pass it into open uri... + nsCOMPtr loadGroup; + NS_ENSURE_SUCCESS(uriLoader->GetLoadGroupForContext(NS_STATIC_CAST(nsISupports *, (nsIDocShell *) this), getter_AddRefs(loadGroup)), + NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(NS_OpenURI(getter_AddRefs(channel), aUri, loadGroup, capabilities), NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(uriLoader->OpenURIVia(channel, nsIURILoader::viewNormal, nsnull, - NS_STATIC_CAST(nsIDocShell*, this), mLoadCookie, - getter_AddRefs(mLoadCookie), aAdapterBinding), NS_ERROR_FAILURE); + NS_STATIC_CAST(nsIDocShell*, this), aAdapterBinding), NS_ERROR_FAILURE); return NS_OK; } @@ -356,8 +361,7 @@ NS_IMETHODIMP nsDocShell::GetParentURIContentListener(nsIURIContentListener** NS_ENSURE_ARG_POINTER(aParent); NS_ENSURE_SUCCESS(EnsureContentListener(), NS_ERROR_FAILURE); - mContentListener->GetParentContentListener(aParent); - return NS_OK; + return mContentListener->GetParentContentListener(aParent); } NS_IMETHODIMP nsDocShell::SetParentURIContentListener(nsIURIContentListener* @@ -365,8 +369,7 @@ NS_IMETHODIMP nsDocShell::SetParentURIContentListener(nsIURIContentListener* { NS_ENSURE_SUCCESS(EnsureContentListener(), NS_ERROR_FAILURE); - mContentListener->SetParentContentListener(aParent); - return NS_OK; + return mContentListener->SetParentContentListener(aParent); } NS_IMETHODIMP nsDocShell::GetPrefs(nsIPref** aPrefs)