Bug 1266184 - Implement nsIMIMEInputStream.data getter. r?mcmanus
MozReview-Commit-ID: EAfSPGDSZfW
--- a/netwerk/base/nsIMIMEInputStream.idl
+++ b/netwerk/base/nsIMIMEInputStream.idl
@@ -34,9 +34,14 @@ interface nsIMIMEInputStream : nsIInputS
* Sets data-stream. May not be called once the stream has been started
* to be read.
* The cursor of the new stream should be located at the beginning of the
* stream if the implementation of the nsIMIMEInputStream also is used as
* an nsISeekableStream.
* @param stream stream containing the data for the stream
*/
void setData(in nsIInputStream stream);
+
+ /**
+ * Get the wrapped data stream
+ */
+ readonly attribute nsIInputStream data;
};
--- a/netwerk/base/nsMIMEInputStream.cpp
+++ b/netwerk/base/nsMIMEInputStream.cpp
@@ -154,16 +154,25 @@ nsMIMEInputStream::SetData(nsIInputStrea
mStream->RemoveStream(2);
mData = aStream;
if (aStream)
mStream->AppendStream(mData);
return NS_OK;
}
+NS_IMETHODIMP
+nsMIMEInputStream::GetData(nsIInputStream **aStream)
+{
+ NS_ENSURE_ARG_POINTER(aStream);
+ *aStream = mData;
+ NS_IF_ADDREF(*aStream);
+ return NS_OK;
+}
+
// set up the internal streams
void nsMIMEInputStream::InitStreams()
{
NS_ASSERTION(!mStartedReading,
"Don't call initStreams twice without rewinding");
mStartedReading = true;