From 287c2883a116ebc7687863318579361facf6e5d4 Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Thu, 9 Sep 1999 05:13:31 +0000 Subject: [PATCH] bug #11376. I added GetContentLength to nsIChannel so the content length can be gotten from a channel... git-svn-id: svn://10.0.0.236/trunk@46515 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/nsPluginHostImpl.cpp | 27 +++++++++++-------- .../plugin/nglsrc/nsPluginHostImpl.cpp | 27 +++++++++++-------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index dfe7e7a4873..9f6e471e254 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -974,15 +974,23 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartRequest(nsIURI* aURL, const cha } } - // only set up the stream listener if we have both the mimetype and - // have mLength set (as indicated by the mGotProgress bool) - if(mGotProgress == PR_TRUE && mSetUpListener == PR_FALSE) - rv = SetUpStreamListener(aURL); - - mOnStartRequest = PR_TRUE; #ifdef NECKO nsCRT::free(aContentType); #endif //NECKO + + // + // Set up the stream listener... + // + PRInt32 length; + + rv = channel->GetContentLength(&length); + if (NS_FAILED(rv)) return rv; + mPluginStreamInfo->SetLength(length); + + rv = SetUpStreamListener(aURL); + if (NS_FAILED(rv)) return rv; + + mOnStartRequest = PR_TRUE; return rv; } @@ -998,16 +1006,13 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIURI* aURL, PRUint32 aPro { nsresult rv = NS_OK; -#ifdef NECKO - nsCOMPtr aURL; - rv = channel->GetURI(getter_AddRefs(aURL)); - if (NS_FAILED(rv)) return rv; -#endif +#ifndef NECKO mPluginStreamInfo->SetLength(aProgressMax); if(mOnStartRequest == PR_TRUE && mSetUpListener == PR_FALSE) rv = SetUpStreamListener(aURL); mGotProgress = PR_TRUE; +#endif return rv; } diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index dfe7e7a4873..9f6e471e254 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -974,15 +974,23 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartRequest(nsIURI* aURL, const cha } } - // only set up the stream listener if we have both the mimetype and - // have mLength set (as indicated by the mGotProgress bool) - if(mGotProgress == PR_TRUE && mSetUpListener == PR_FALSE) - rv = SetUpStreamListener(aURL); - - mOnStartRequest = PR_TRUE; #ifdef NECKO nsCRT::free(aContentType); #endif //NECKO + + // + // Set up the stream listener... + // + PRInt32 length; + + rv = channel->GetContentLength(&length); + if (NS_FAILED(rv)) return rv; + mPluginStreamInfo->SetLength(length); + + rv = SetUpStreamListener(aURL); + if (NS_FAILED(rv)) return rv; + + mOnStartRequest = PR_TRUE; return rv; } @@ -998,16 +1006,13 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIURI* aURL, PRUint32 aPro { nsresult rv = NS_OK; -#ifdef NECKO - nsCOMPtr aURL; - rv = channel->GetURI(getter_AddRefs(aURL)); - if (NS_FAILED(rv)) return rv; -#endif +#ifndef NECKO mPluginStreamInfo->SetLength(aProgressMax); if(mOnStartRequest == PR_TRUE && mSetUpListener == PR_FALSE) rv = SetUpStreamListener(aURL); mGotProgress = PR_TRUE; +#endif return rv; }