зеркало из https://github.com/mozilla/pjs.git
Fixes two FTP bugs 148881 cancelling ftp download before save file dialog is present and 169214 Viewing an HTML page with a missing CSS file via FTP crash. r=rpotts@netscape.com, sr=darin@netscape.com
This commit is contained in:
Родитель
30d4ca5c78
Коммит
179bab7a56
|
@ -630,17 +630,18 @@ nsFTPChannel::OnStopRequest(nsIRequest *request, nsISupports* aContext,
|
|||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (NS_SUCCEEDED(mStatus))
|
||||
mStatus = aStatus;
|
||||
|
||||
if (mListener) {
|
||||
(void) mListener->OnStopRequest(this, mUserContext, aStatus);
|
||||
(void) mListener->OnStopRequest(this, mUserContext, mStatus);
|
||||
}
|
||||
if (mLoadGroup) {
|
||||
(void) mLoadGroup->RemoveRequest(this, nsnull, aStatus);
|
||||
(void) mLoadGroup->RemoveRequest(this, nsnull, mStatus);
|
||||
}
|
||||
|
||||
if (mCacheEntry) {
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
if (NS_SUCCEEDED(mStatus)) {
|
||||
(void) mCacheEntry->SetExpirationTime( NowInSeconds() + 900 ); // valid for 15 minutes.
|
||||
(void) mCacheEntry->MarkValid();
|
||||
}
|
||||
|
@ -666,12 +667,14 @@ nsFTPChannel::OnStartRequest(nsIRequest *request, nsISupports *aContext)
|
|||
("nsFTPChannel::OnStartRequest() called [this=%x, request=%x]\n",
|
||||
this, request));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (NS_SUCCEEDED(mStatus))
|
||||
request->GetStatus(&mStatus);
|
||||
|
||||
nsCOMPtr<nsIResumableChannel> resumable = do_QueryInterface(request);
|
||||
if (resumable)
|
||||
resumable->GetEntityID(getter_AddRefs(mEntityID));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (mListener) {
|
||||
rv = mListener->OnStartRequest(this, mUserContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -115,7 +115,6 @@ public:
|
|||
PRUint32 GetBytesTransfered() {return mBytesTransfered;} ;
|
||||
void Uploading(PRBool value);
|
||||
void SetRetrying(PRBool retry);
|
||||
PRBool HaveFiredNotification() { return mFired; };
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -130,7 +129,7 @@ protected:
|
|||
PRPackedBool mDelayedOnStartFired;
|
||||
PRPackedBool mUploading;
|
||||
PRPackedBool mRetrying;
|
||||
PRPackedBool mFired;
|
||||
|
||||
nsresult DelayedOnStartRequest(nsIRequest *request, nsISupports *ctxt);
|
||||
};
|
||||
|
||||
|
@ -154,7 +153,6 @@ DataRequestForwarder::DataRequestForwarder()
|
|||
{
|
||||
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) DataRequestForwarder CREATED\n", this));
|
||||
|
||||
mFired = PR_FALSE;
|
||||
mBytesTransfered = 0;
|
||||
mRetrying = mUploading = mDelayedOnStartFired = PR_FALSE;
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
@ -278,7 +276,6 @@ nsresult
|
|||
DataRequestForwarder::DelayedOnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) DataRequestForwarder DelayedOnStartRequest \n", this));
|
||||
mFired = PR_TRUE;
|
||||
return mListener->OnStartRequest(this, ctxt);
|
||||
}
|
||||
|
||||
|
@ -1963,19 +1960,8 @@ nsFtpState::Cancel(nsresult status)
|
|||
if (NS_SUCCEEDED(mControlStatus))
|
||||
mControlStatus = status;
|
||||
|
||||
// kill the data connection immediately. But first, save it's
|
||||
// notification-firing state
|
||||
PRBool fired = PR_FALSE;
|
||||
if (mDRequestForwarder) {
|
||||
fired = mDRequestForwarder->HaveFiredNotification();
|
||||
NS_RELEASE(mDRequestForwarder);
|
||||
}
|
||||
if (mDPipeRequest) {
|
||||
mDPipeRequest->Cancel(status);
|
||||
mDPipeRequest = 0;
|
||||
}
|
||||
|
||||
(void) StopProcessing(fired);
|
||||
if (mKeepRunning)
|
||||
(void) StopProcessing();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2374,7 +2360,7 @@ nsFtpState::KillControlConnection() {
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsFtpState::StopProcessing(PRBool aPreventNotification) {
|
||||
nsFtpState::StopProcessing() {
|
||||
PR_LOG(gFTPLog, PR_LOG_ALWAYS, ("(%x) nsFtpState stopping", this));
|
||||
|
||||
#ifdef DEBUG_dougt
|
||||
|
@ -2395,17 +2381,28 @@ nsFtpState::StopProcessing(PRBool aPreventNotification) {
|
|||
if ( NS_SUCCEEDED(broadcastErrorCode))
|
||||
broadcastErrorCode = mInternalError;
|
||||
|
||||
if (mChannel && !aPreventNotification &&
|
||||
( (!mDRequestForwarder) ||
|
||||
( mDRequestForwarder && !mDRequestForwarder->HaveFiredNotification() ))) {
|
||||
nsCOMPtr<nsIStreamListener> channelListener = do_QueryInterface(mChannel);
|
||||
NS_ASSERTION(channelListener, "ftp channel should be a stream listener");
|
||||
nsCOMPtr<nsIStreamListener> asyncListener;
|
||||
NS_NewAsyncStreamListener(getter_AddRefs(asyncListener), channelListener, NS_UI_THREAD_EVENTQ);
|
||||
if(asyncListener) {
|
||||
(void) asyncListener->OnStartRequest(this, nsnull);
|
||||
(void) asyncListener->OnStopRequest(this, nsnull, broadcastErrorCode);
|
||||
if (mDPipeRequest && NS_FAILED(broadcastErrorCode))
|
||||
mDPipeRequest->Cancel(broadcastErrorCode);
|
||||
|
||||
if (mDRequestForwarder) {
|
||||
NS_RELEASE(mDRequestForwarder);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The forwarding object was never created which means that we never sent our notifications.
|
||||
|
||||
nsCOMPtr<nsIRequestObserver> asyncObserver = do_QueryInterface(mChannel);
|
||||
nsCOMPtr<nsIRequestObserver> arg = do_QueryInterface(mChannel);
|
||||
|
||||
NS_NewRequestObserverProxy(getter_AddRefs(asyncObserver),
|
||||
arg,
|
||||
NS_CURRENT_EVENTQ);
|
||||
if(asyncObserver) {
|
||||
(void) asyncObserver->OnStartRequest(this, nsnull);
|
||||
(void) asyncObserver->OnStopRequest(this, nsnull, broadcastErrorCode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Clean up the event loop
|
||||
|
|
|
@ -161,9 +161,7 @@ private:
|
|||
nsresult Process();
|
||||
|
||||
void KillControlConnection();
|
||||
// Set aPreventNotification to true if StopProcessing should not
|
||||
// notify the listener.
|
||||
nsresult StopProcessing(PRBool aPreventNotification = PR_FALSE);
|
||||
nsresult StopProcessing();
|
||||
nsresult EstablishControlConnection();
|
||||
nsresult SendFTPCommand(nsCString& command);
|
||||
void ConvertFilespecToVMS(nsCString& fileSpec);
|
||||
|
|
Загрузка…
Ссылка в новой задаче