From cbd257817be133463cc51c43c5b6ae882f06113a Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Sat, 14 May 2011 16:37:41 -0700 Subject: [PATCH] Bug 656640: DOM File objects should DEFER_OPEN their streams. r=sicking --- content/base/src/nsDOMFile.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index ee0103fc1085..82c28859be3a 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -324,17 +324,18 @@ nsDOMFile::MozSlice(PRInt64 aStart, PRInt64 aEnd, return NS_OK; } +const PRUint32 sFileStreamFlags = + nsIFileInputStream::CLOSE_ON_EOF | + nsIFileInputStream::REOPEN_ON_REWIND | + nsIFileInputStream::DEFER_OPEN; + NS_IMETHODIMP nsDOMFile::GetInternalStream(nsIInputStream **aStream) { return mIsFullFile ? - NS_NewLocalFileInputStream(aStream, mFile, -1, -1, - nsIFileInputStream::CLOSE_ON_EOF | - nsIFileInputStream::REOPEN_ON_REWIND) : + NS_NewLocalFileInputStream(aStream, mFile, -1, -1, sFileStreamFlags) : NS_NewPartialLocalFileInputStream(aStream, mFile, mStart, mLength, - -1, -1, - nsIFileInputStream::CLOSE_ON_EOF | - nsIFileInputStream::REOPEN_ON_REWIND); + -1, -1, sFileStreamFlags); } NS_IMETHODIMP