From adf3efde5dcda55e4ea9bcf4fb74febfdc049a47 Mon Sep 17 00:00:00 2001 From: "serge%netscape.com" Date: Fri, 9 Aug 2002 01:36:39 +0000 Subject: [PATCH] fix 146748 No Visual Progress When Downloading Large PDF Files, r=peterl, sr=darin git-svn-id: svn://10.0.0.236/trunk@126855 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/nsPluginHostImpl.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 012b70b8b59..e70d357face 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -1361,7 +1361,8 @@ private: public: PRBool mAbort; PRInt32 mPendingRequests; - + nsWeakPtr mWeakPtrChannelCallbacks; + nsWeakPtr mWeakPtrChannelLoadGroup; }; //////////////////////////////////////////////////////////////////////// @@ -1568,8 +1569,10 @@ nsPluginStreamInfo::RequestRead(nsByteRange* rangeList) rv = NS_NewURI(getter_AddRefs(url), nsDependentCString(mURL)); + nsCOMPtr callbacks = do_QueryReferent(mPluginStreamListenerPeer->mWeakPtrChannelCallbacks); + nsCOMPtr loadGroup = do_QueryReferent(mPluginStreamListenerPeer->mWeakPtrChannelLoadGroup); nsCOMPtr channel; - rv = NS_NewChannel(getter_AddRefs(channel), url, nsnull, nsnull, nsnull); + rv = NS_NewChannel(getter_AddRefs(channel), url, nsnull, loadGroup, callbacks); if (NS_FAILED(rv)) return rv; @@ -2104,6 +2107,19 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, nsISupports* aCo nsCaseInsensitiveCStringComparator())) { useCacheAsFile = PR_FALSE; } + + // Get the notification callbacks from the channel and save it as week ref + // we'll use it in nsPluginStreamInfo::RequestRead() + // when we'll create channel for byte range request. + nsCOMPtr callbacks; + channel->GetNotificationCallbacks(getter_AddRefs(callbacks)); + if (callbacks) + mWeakPtrChannelCallbacks = getter_AddRefs(NS_GetWeakReference(callbacks)); + + nsCOMPtr loadGroup; + channel->GetLoadGroup(getter_AddRefs(loadGroup)); + if (loadGroup) + mWeakPtrChannelLoadGroup = getter_AddRefs(NS_GetWeakReference(loadGroup)); } if (useCacheAsFile) {