diff --git a/netwerk/base/src/nsFileStreams.cpp b/netwerk/base/src/nsFileStreams.cpp index 26f51256e9e4..0f13105d0ed7 100644 --- a/netwerk/base/src/nsFileStreams.cpp +++ b/netwerk/base/src/nsFileStreams.cpp @@ -104,6 +104,10 @@ nsFileIO::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) NS_IMETHODIMP nsFileIO::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm) { + NS_ASSERTION(file, "File must not be null"); + if (file == nsnull) + return NS_ERROR_NOT_INITIALIZED; + mFile = file; mIOFlags = ioFlags; mPerm = perm; @@ -125,6 +129,10 @@ nsFileIO::GetFile(nsIFile* *aFile) NS_IMETHODIMP nsFileIO::Open(char **contentType, PRInt32 *contentLength) { + NS_ASSERTION(mFile, "File must not be null"); + if (mFile == nsnull) + return NS_ERROR_NOT_INITIALIZED; + // don't actually open the file here -- we'll do it on demand in the // GetInputStream/GetOutputStream methods nsresult rv = NS_OK; @@ -188,6 +196,10 @@ nsFileIO::Close(nsresult status) NS_IMETHODIMP nsFileIO::GetInputStream(nsIInputStream * *aInputStream) { + NS_ASSERTION(mFile, "File must not be null"); + if (mFile == nsnull) + return NS_ERROR_NOT_INITIALIZED; + nsresult rv; PRBool isDir; rv = mFile->IsDirectory(&isDir); @@ -224,6 +236,10 @@ nsFileIO::GetInputStream(nsIInputStream * *aInputStream) NS_IMETHODIMP nsFileIO::GetOutputStream(nsIOutputStream * *aOutputStream) { + NS_ASSERTION(mFile, "File must not be null"); + if (mFile == nsnull) + return NS_ERROR_NOT_INITIALIZED; + nsresult rv; PRBool isDir; rv = mFile->IsDirectory(&isDir); @@ -257,6 +273,10 @@ nsFileIO::GetOutputStream(nsIOutputStream * *aOutputStream) NS_IMETHODIMP nsFileIO::GetName(char* *aName) { + NS_ASSERTION(mFile, "File must not be null"); + if (mFile == nsnull) + return NS_ERROR_NOT_INITIALIZED; + return mFile->GetPath(aName); } diff --git a/netwerk/base/src/nsSocketTransport.cpp b/netwerk/base/src/nsSocketTransport.cpp index 581de323c031..1d38a64cf2f6 100644 --- a/netwerk/base/src/nsSocketTransport.cpp +++ b/netwerk/base/src/nsSocketTransport.cpp @@ -1920,6 +1920,8 @@ nsSocketBOS::Write(const char *aBuf, PRUint32 aCount, PRUint32 *aBytesWritten) tryWrite: total = PR_Write(mSock, aBuf, aCount); + LOG(("nsSocketBOS PR_Write [this=%x] wrote %d\n", this, total)); + if (total < 0) { if (PR_GetError() == PR_WOULD_BLOCK_ERROR) { // @@ -1933,6 +1935,7 @@ tryWrite: LOG(("nsSocketBOS::Write [this=%x] Poll succeeded; looping back to PR_Write\n", this)); goto tryWrite; } + LOG(("nsSocketBOS::Write [this=%x] Write Failed [rv=%x]\n", this, PR_GetError())); return NS_ERROR_FAILURE; } /*