From cb84cd313d72a40f0cf313ae4e3ea8157651c3f2 Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Thu, 16 Aug 2001 06:47:32 +0000 Subject: [PATCH] fixes bug 93582 "nsFileChannel::AsyncOpen synchronously stat's the file before returning" r=gordon, sr=dougt git-svn-id: svn://10.0.0.236/trunk@101194 18797224-902f-48f8-a5cc-f745e15eee43 --- .../protocol/file/src/nsFileChannel.cpp | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp index f9645e79c84..e3023806cdb 100644 --- a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp +++ b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp @@ -218,14 +218,6 @@ nsFileChannel::EnsureTransport() { nsresult rv = NS_OK; - PRBool exist; - rv = mFile->Exists(&exist); - if (NS_FAILED(rv)) - return rv; - - if (!exist) - return NS_ERROR_FILE_NOT_FOUND; - nsCOMPtr fts = do_GetService(kFileTransportServiceCID, &rv); if (NS_FAILED(rv)) return rv; @@ -236,7 +228,6 @@ nsFileChannel::EnsureTransport() mFileTransport->SetNotificationCallbacks(mCallbacks, (mLoadFlags & LOAD_BACKGROUND)); - return rv; } @@ -280,14 +271,13 @@ nsFileChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) NS_ASSERTION(listener, "null listener"); mRealListener = listener; - nsCOMPtr tempListener = this; if (mLoadGroup) { rv = mLoadGroup->AddRequest(this, nsnull); if (NS_FAILED(rv)) return rv; } - rv = mFileTransport->AsyncRead(tempListener, ctxt, 0, -1, 0, + rv = mFileTransport->AsyncRead(this, ctxt, 0, -1, 0, getter_AddRefs(mCurrentRequest)); if (NS_FAILED(rv)) { @@ -445,6 +435,8 @@ nsFileChannel::GetSecurityInfo(nsISupports * *aSecurityInfo) NS_IMETHODIMP nsFileChannel::OnStartRequest(nsIRequest* request, nsISupports* context) { + // unconditionally inherit the status of the file transport + request->GetStatus(&mStatus); #ifdef DEBUG NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread calling this routine"); @@ -461,6 +453,8 @@ NS_IMETHODIMP nsFileChannel::OnStopRequest(nsIRequest* request, nsISupports* context, nsresult aStatus) { + // unconditionally inherit the status of the file transport + mStatus = aStatus; #ifdef DEBUG NS_ASSERTION(mInitiator == PR_CurrentThread(), "wrong thread calling this routine"); @@ -497,14 +491,6 @@ nsFileChannel::OnDataAvailable(nsIRequest* request, nsISupports* context, rv = mRealListener->OnDataAvailable(this, context, aIStream, aSourceOffset, aLength); } - // - // If the connection is being aborted cancel the transport. This will - // insure that the transport will go away even if it is blocked waiting - // for the consumer to empty the pipe... - // - if (NS_FAILED(rv) && mCurrentRequest) { - mCurrentRequest->Cancel(rv); - } return rv; }