Bug 1401171 - Make nsIMultiplexInputStream not inherit from nsIInputStream. r=bkelly
This is a preexisting issue that makes nsMultiplexInputStream multiple-inherit from nsIInputStream: once via nsIMultipartInputStream and once via nsIAsyncInputStream. This causes problems once we end up with more multiplex streams that are async streams, because then some assingments to nsCOMPtr<nsIInputStream> start asserting. This patch just removes the footgun by getting rid of the multiple inheritance.
This commit is contained in:
@@ -394,8 +394,13 @@ FSMultipartFormData::FSMultipartFormData(NotNull<const Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement)
|
||||
: EncodingFormSubmission(aEncoding, aOriginatingElement)
|
||||
{
|
||||
mPostDataStream =
|
||||
mPostData =
|
||||
do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1");
|
||||
|
||||
nsCOMPtr<nsIInputStream> inputStream = do_QueryInterface(mPostData);
|
||||
MOZ_ASSERT(SameCOMIdentity(mPostData, inputStream));
|
||||
mPostDataStream = inputStream;
|
||||
|
||||
mTotalLength = 0;
|
||||
|
||||
mBoundary.AssignLiteral("---------------------------");
|
||||
@@ -600,7 +605,7 @@ FSMultipartFormData::AddDataChunk(const nsACString& aName,
|
||||
// here, since we're about to add the file input stream
|
||||
AddPostDataStream();
|
||||
|
||||
mPostDataStream->AppendStream(aInputStream);
|
||||
mPostData->AppendStream(aInputStream);
|
||||
mTotalLength += aInputStreamSize;
|
||||
}
|
||||
|
||||
@@ -640,7 +645,7 @@ FSMultipartFormData::AddPostDataStream()
|
||||
mPostDataChunk);
|
||||
NS_ASSERTION(postDataChunkStream, "Could not open a stream for POST!");
|
||||
if (postDataChunkStream) {
|
||||
mPostDataStream->AppendStream(postDataChunkStream);
|
||||
mPostData->AppendStream(postDataChunkStream);
|
||||
mTotalLength += mPostDataChunk.Length();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user