Backed out changeset 469060293380 (bug 1518774) for failing test_invalid_mime_type_blob.html on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Wed, 13 Feb 2019 03:02:40 +0200
changeset 458822 1a7809015b49
parent 458821 36ae1038bf8c
child 458823 64ebb085a6b3
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1518774
milestone67.0a1
backs out469060293380
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 469060293380 (bug 1518774) for failing test_invalid_mime_type_blob.html on a CLOSED TREE
xpcom/io/nsStringStream.cpp
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -17,17 +17,16 @@
 #include "nsISeekableStream.h"
 #include "nsISupportsPrimitives.h"
 #include "nsCRT.h"
 #include "prerror.h"
 #include "plstr.h"
 #include "nsIClassInfoImpl.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ipc/InputStreamUtils.h"
-#include "mozilla/ReentrantMonitor.h"
 #include "nsIIPCSerializableInputStream.h"
 
 using namespace mozilla::ipc;
 using mozilla::Maybe;
 using mozilla::Some;
 
 //-----------------------------------------------------------------------------
 // nsIStringInputStream implementation
@@ -44,17 +43,17 @@ class nsStringInputStream final : public
   NS_DECL_NSISTRINGINPUTSTREAM
   NS_DECL_NSISEEKABLESTREAM
   NS_DECL_NSITELLABLESTREAM
   NS_DECL_NSISUPPORTSPRIMITIVE
   NS_DECL_NSISUPPORTSCSTRING
   NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
   NS_DECL_NSICLONEABLEINPUTSTREAM
 
-  nsStringInputStream() : mOffset(0), mMon("nsStringInputStream") { Clear(); }
+  nsStringInputStream() : mOffset(0) { Clear(); }
 
   nsresult Init(nsCString&& aString);
 
  private:
   ~nsStringInputStream() {}
 
   template <typename M>
   void SerializeInternal(InputStreamParams& aParams, bool aDelayedStart,
@@ -65,23 +64,19 @@ class nsStringInputStream final : public
   uint32_t LengthRemaining() const { return Length() - mOffset; }
 
   void Clear() { mData.SetIsVoid(true); }
 
   bool Closed() { return mData.IsVoid(); }
 
   nsDependentCSubstring mData;
   uint32_t mOffset;
-
-  mozilla::ReentrantMonitor mMon;
 };
 
 nsresult nsStringInputStream::Init(nsCString&& aString) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (!mData.Assign(std::move(aString), fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   mOffset = 0;
   return NS_OK;
 }
 
@@ -109,33 +104,29 @@ NS_IMPL_CI_INTERFACE_GETTER(nsStringInpu
 NS_IMETHODIMP
 nsStringInputStream::GetType(uint16_t* aType) {
   *aType = TYPE_CSTRING;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::GetData(nsACString& data) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   // The stream doesn't have any data when it is closed.  We could fake it
   // and return an empty string here, but it seems better to keep this return
   // value consistent with the behavior of the other 'getter' methods.
   if (NS_WARN_IF(Closed())) {
     return NS_BASE_STREAM_CLOSED;
   }
 
   data.Assign(mData);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::SetData(const nsACString& aData) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (NS_WARN_IF(!mData.Assign(aData, fallible))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   mOffset = 0;
   return NS_OK;
 }
 
@@ -146,84 +137,72 @@ nsStringInputStream::ToString(char** aRe
 }
 
 /////////
 // nsIStringInputStream implementation
 /////////
 
 NS_IMETHODIMP
 nsStringInputStream::SetData(const char* aData, int32_t aDataLen) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (NS_WARN_IF(!aData)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (NS_WARN_IF(!mData.Assign(aData, aDataLen, fallible))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   mOffset = 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::AdoptData(char* aData, int32_t aDataLen) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (NS_WARN_IF(!aData)) {
     return NS_ERROR_INVALID_ARG;
   }
   mData.Adopt(aData, aDataLen);
   mOffset = 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::ShareData(const char* aData, int32_t aDataLen) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (NS_WARN_IF(!aData)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (aDataLen < 0) {
     aDataLen = strlen(aData);
   }
 
   mData.Rebind(aData, aDataLen);
   mOffset = 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP_(size_t)
 nsStringInputStream::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   size_t n = aMallocSizeOf(this);
   n += mData.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
   return n;
 }
 
 /////////
 // nsIInputStream implementation
 /////////
 
 NS_IMETHODIMP
 nsStringInputStream::Close() {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   Clear();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::Available(uint64_t* aLength) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   NS_ASSERTION(aLength, "null ptr");
 
   if (Closed()) {
     return NS_BASE_STREAM_CLOSED;
   }
 
   *aLength = LengthRemaining();
   return NS_OK;
@@ -233,18 +212,16 @@ NS_IMETHODIMP
 nsStringInputStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount) {
   NS_ASSERTION(aBuf, "null ptr");
   return ReadSegments(NS_CopySegmentToBuffer, aBuf, aCount, aReadCount);
 }
 
 NS_IMETHODIMP
 nsStringInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
                                   uint32_t aCount, uint32_t* aResult) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   NS_ASSERTION(aResult, "null ptr");
   NS_ASSERTION(Length() >= mOffset, "bad stream state");
 
   if (Closed()) {
     return NS_BASE_STREAM_CLOSED;
   }
 
   // We may be at end-of-file
@@ -276,18 +253,16 @@ nsStringInputStream::IsNonBlocking(bool*
 }
 
 /////////
 // nsISeekableStream implementation
 /////////
 
 NS_IMETHODIMP
 nsStringInputStream::Seek(int32_t aWhence, int64_t aOffset) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (Closed()) {
     return NS_BASE_STREAM_CLOSED;
   }
 
   // Compute new stream position.  The given offset may be a negative value.
 
   int64_t newPos = aOffset;
   switch (aWhence) {
@@ -309,34 +284,30 @@ nsStringInputStream::Seek(int32_t aWhenc
   }
 
   mOffset = (uint32_t)newPos;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::SetEOF() {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (Closed()) {
     return NS_BASE_STREAM_CLOSED;
   }
 
   mOffset = Length();
   return NS_OK;
 }
 
 /////////
 // nsITellableStream implementation
 /////////
 
 NS_IMETHODIMP
 nsStringInputStream::Tell(int64_t* aOutWhere) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   if (Closed()) {
     return NS_BASE_STREAM_CLOSED;
   }
 
   *aOutWhere = mOffset;
   return NS_OK;
 }
 
@@ -376,18 +347,16 @@ void nsStringInputStream::Serialize(Inpu
   SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
 }
 
 template <typename M>
 void nsStringInputStream::SerializeInternal(InputStreamParams& aParams,
                                             bool aDelayedStart,
                                             uint32_t aMaxSize,
                                             uint32_t* aSizeUsed, M* aManager) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   MOZ_ASSERT(aSizeUsed);
   *aSizeUsed = 0;
 
   if (Length() >= aMaxSize) {
     InputStreamHelper::SerializeInputStreamAsPipe(this, aParams, aDelayedStart,
                                                   aManager);
     return;
   }
@@ -423,18 +392,16 @@ bool nsStringInputStream::Deserialize(co
 NS_IMETHODIMP
 nsStringInputStream::GetCloneable(bool* aCloneableOut) {
   *aCloneableOut = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringInputStream::Clone(nsIInputStream** aCloneOut) {
-  ReentrantMonitorAutoEnter lock(mMon);
-
   RefPtr<nsStringInputStream> ref = new nsStringInputStream();
   nsresult rv = ref->SetData(mData);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // mOffset is overwritten by SetData().
   ref->mOffset = mOffset;