From 2b59ca520f05532dd198128e6eb033d27bd27530 Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Wed, 6 Feb 2002 07:26:26 +0000 Subject: [PATCH] fixes bug 54349 "stylesheet do not load when in another HTTP auth realm (sometimes)" patch=badami@netscape.com, r/sr=rpotts,darin git-svn-id: svn://10.0.0.236/trunk@113770 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 41 ++++++++++++++++++++++++++++ mozilla/docshell/base/nsDocShell.h | 13 +++++++++ 2 files changed, 54 insertions(+) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index ac6e2a2339a..f619b08d50f 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -5686,6 +5686,16 @@ nsDocShell::SetLoadCookie(nsISupports * aCookie) if (webProgress) { webProgress->AddProgressListener(this); } + + nsCOMPtr loadGroup(do_GetInterface(mLoadCookie)); + NS_ENSURE_TRUE(loadGroup, NS_ERROR_FAILURE); + if (loadGroup) { + nsIInterfaceRequestor *ifPtr = NS_STATIC_CAST(nsIInterfaceRequestor *, this); + nsCOMPtr ptr(new InterfaceRequestorProxy(ifPtr)); + if (ptr) { + loadGroup->SetNotificationCallbacks(ptr); + } + } } return NS_OK; } @@ -6106,3 +6116,34 @@ nsDocShellFocusController::ClosingDown(nsIDocShell* aDocShell) mFocusedDocShell = nsnull; } } + +//***************************************************************************** +// nsDocShell::InterfaceRequestorProxy +//***************************************************************************** +nsDocShell::InterfaceRequestorProxy::InterfaceRequestorProxy(nsIInterfaceRequestor* p) +{ + NS_INIT_REFCNT(); + if (p) { + mWeakPtr = getter_AddRefs(NS_GetWeakReference(p)); + } +} + +nsDocShell::InterfaceRequestorProxy::~InterfaceRequestorProxy() +{ + mWeakPtr = nsnull; +} + +NS_IMPL_THREADSAFE_ISUPPORTS1(nsDocShell::InterfaceRequestorProxy, nsIInterfaceRequestor) + +NS_IMETHODIMP +nsDocShell::InterfaceRequestorProxy::GetInterface(const nsIID & aIID, void **aSink) +{ + NS_ENSURE_ARG_POINTER(aSink); + nsCOMPtr ifReq = do_QueryReferent(mWeakPtr); + if (ifReq) { + return ifReq->GetInterface(aIID, aSink); + } + *aSink = nsnull; + return NS_NOINTERFACE; +} + diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index 500c665889d..99b2600b905 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -354,6 +354,19 @@ protected: nsIDocShellTreeItem * mParent; // Weak Reference nsIDocShellTreeOwner * mTreeOwner; // Weak Reference nsIChromeEventHandler * mChromeEventHandler; //Weak Reference + +private: + class InterfaceRequestorProxy : public nsIInterfaceRequestor { + public: + InterfaceRequestorProxy(nsIInterfaceRequestor* p); + virtual ~InterfaceRequestorProxy(); + NS_DECL_ISUPPORTS + NS_DECL_NSIINTERFACEREQUESTOR + + private: + InterfaceRequestorProxy() {} + nsWeakPtr mWeakPtr; + }; }; #endif /* nsDocShell_h__ */