Bug 1266184 - Implement nsIMIMEInputStream.data getter. r=mcmanus
authorGiorgio Maone <g.maone@informaction.com>
Wed, 20 Apr 2016 21:36:43 +0200
changeset 318487 cecb988dcacb3532adca881a93ef3fb0585f90f0
parent 318486 4965b4f209335d05855c813e772e5ec45ba2df0c
child 318488 35edab8d84dbe447525af059eb79f528cd2db24a
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1266184
milestone48.0a1
Bug 1266184 - Implement nsIMIMEInputStream.data getter. r=mcmanus MozReview-Commit-ID: EAfSPGDSZfW
netwerk/base/nsIMIMEInputStream.idl
netwerk/base/nsMIMEInputStream.cpp
--- 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;