mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 595785. Make sure the right channel is always passed to download progress listeners' onStateChange methods. r=sdwilsh,bzbarsky
This commit is contained in:
parent
58a96f2303
commit
79bfebf67e
@ -1243,6 +1243,7 @@ nsExternalAppHandler::nsExternalAppHandler(nsIMIMEInfo * aMIMEInfo,
|
||||
, mContentLength(-1)
|
||||
, mProgress(0)
|
||||
, mDataBuffer(nsnull)
|
||||
, mKeepRequestAlive(PR_FALSE)
|
||||
, mRequest(nsnull)
|
||||
{
|
||||
|
||||
@ -1744,6 +1745,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
|
||||
// do this first! make sure we don't try to take an action until the user tells us what they want to do
|
||||
// with it...
|
||||
mReceivedDispositionInfo = PR_FALSE;
|
||||
mKeepRequestAlive = PR_TRUE;
|
||||
|
||||
// invoke the dialog!!!!! use mWindowContext as the window context parameter for the dialog request
|
||||
mDialog = do_CreateInstance( NS_HELPERAPPLAUNCHERDLG_CONTRACTID, &rv );
|
||||
@ -1994,7 +1996,10 @@ NS_IMETHODIMP nsExternalAppHandler::OnStopRequest(nsIRequest *request, nsISuppor
|
||||
nsresult aStatus)
|
||||
{
|
||||
mStopRequestIssued = PR_TRUE;
|
||||
mRequest = nsnull;
|
||||
|
||||
if (!mKeepRequestAlive)
|
||||
mRequest = nsnull;
|
||||
|
||||
// Cancel if the request did not complete successfully.
|
||||
if (!mCanceled && NS_FAILED(aStatus))
|
||||
{
|
||||
@ -2135,6 +2140,8 @@ nsresult nsExternalAppHandler::CreateProgressListener()
|
||||
// OnStopRequest.
|
||||
SetWebProgressListener(tr);
|
||||
|
||||
mRequest = nsnull;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -2468,6 +2475,9 @@ NS_IMETHODIMP nsExternalAppHandler::Cancel(nsresult aReason)
|
||||
// Break our reference cycle with the helper app dialog (set up in
|
||||
// OnStartRequest)
|
||||
mDialog = nsnull;
|
||||
|
||||
mRequest = nsnull;
|
||||
|
||||
// shutdown our stream to the temp file
|
||||
if (mOutStream)
|
||||
{
|
||||
|
@ -437,6 +437,12 @@ protected:
|
||||
nsCOMPtr<nsIChannel> mOriginalChannel; /**< in the case of a redirect, this will be the pre-redirect channel. */
|
||||
nsCOMPtr<nsIHelperAppLauncherDialog> mDialog;
|
||||
|
||||
/**
|
||||
* Keep request alive in case when helper non-modal dialog shown.
|
||||
* Thus in OnStopRequest the mRequest will not be set to null (it will be set to null further).
|
||||
*/
|
||||
PRBool mKeepRequestAlive;
|
||||
|
||||
/**
|
||||
* The request that's being loaded. Not used after OnStopRequest, so a weak
|
||||
* reference suffices. Initialized in OnStartRequest.
|
||||
|
Loading…
Reference in New Issue
Block a user