Backed out 2 changesets (bug 1539261) for multiple build bustages on /fuzz-tests/testStructuredCloneReader.cpp CLOSED TREE
authorarthur.iakab <aiakab@mozilla.com>
Wed, 27 Mar 2019 21:59:29 +0200
changeset 466443 bf00743b877bb5848b5e7f97851813cb26c3e37b
parent 466442 a0084ecbf6719531544190109d9a59ffa6747fe2
child 466444 30d00ba2923587b2b82f7fe05a85d37532168210
push id81605
push useraiakab@mozilla.com
push dateWed, 27 Mar 2019 20:03:47 +0000
treeherderautoland@30d00ba29235 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1539261
milestone68.0a1
backs out526daf87fff9637b1acd7b0381e59378c6dde443
5b070b6ae224de2ba67c668e41e1f828dec6ed63
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 2 changesets (bug 1539261) for multiple build bustages on /fuzz-tests/testStructuredCloneReader.cpp CLOSED TREE Backed out changeset 526daf87fff9 (bug 1539261) Backed out changeset 5b070b6ae224 (bug 1539261)
dom/base/nsStructuredCloneContainer.cpp
dom/indexedDB/ActorsParent.cpp
dom/ipc/StructuredCloneData.h
ipc/glue/IPCMessageUtils.h
js/public/StructuredClone.h
js/src/builtin/TestingFunctions.cpp
--- a/dom/base/nsStructuredCloneContainer.cpp
+++ b/dom/base/nsStructuredCloneContainer.cpp
@@ -125,19 +125,17 @@ nsStructuredCloneContainer::GetDataAsBas
   if (HasClonedDOMObjects()) {
     return NS_ERROR_FAILURE;
   }
 
   auto iter = Data().Start();
   size_t size = Data().Size();
   nsAutoCString binaryData;
   binaryData.SetLength(size);
-  if (!Data().ReadBytes(iter, binaryData.BeginWriting(), size)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  Data().ReadBytes(iter, binaryData.BeginWriting(), size);
   nsAutoCString base64Data;
   nsresult rv = Base64Encode(binaryData, base64Data);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (!CopyASCIItoUTF16(base64Data, aOut, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -23995,20 +23995,17 @@ nsresult ObjectStoreAddOrPutRequestOp::D
     rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("data"), data);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   } else {
     nsCString flatCloneData;
     flatCloneData.SetLength(cloneDataSize);
     auto iter = cloneData.Start();
-    if (NS_WARN_IF(!cloneData.ReadBytes(iter, flatCloneData.BeginWriting(),
-                                        cloneDataSize))) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    cloneData.ReadBytes(iter, flatCloneData.BeginWriting(), cloneDataSize);
 
     // Compress the bytes before adding into the database.
     const char* uncompressed = flatCloneData.BeginReading();
     size_t uncompressedLength = cloneDataSize;
 
     size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength);
 
     UniqueFreePtr<char> compressed(
@@ -24237,20 +24234,17 @@ ObjectStoreAddOrPutRequestOp::SCInputStr
     }
 
     // Writer should write what we asked it to write.
     MOZ_ASSERT(written == count);
 
     *_retval += count;
     aCount -= count;
 
-    if (NS_WARN_IF(!mData.Advance(mIter, count))) {
-      // InputStreams do not propagate errors to caller.
-      return NS_OK;
-    }
+    mData.Advance(mIter, count);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ObjectStoreAddOrPutRequestOp::SCInputStream::IsNonBlocking(bool* _retval) {
   *_retval = false;
--- a/dom/ipc/StructuredCloneData.h
+++ b/dom/ipc/StructuredCloneData.h
@@ -47,26 +47,26 @@ namespace ipc {
 class SharedJSAllocatedData final {
  public:
   explicit SharedJSAllocatedData(JSStructuredCloneData&& aData)
       : mData(std::move(aData)) {}
 
   static already_AddRefed<SharedJSAllocatedData> CreateFromExternalData(
       const char* aData, size_t aDataLength) {
     JSStructuredCloneData buf(JS::StructuredCloneScope::DifferentProcess);
-    NS_ENSURE_TRUE(buf.AppendBytes(aData, aDataLength), nullptr);
+    buf.AppendBytes(aData, aDataLength);
     RefPtr<SharedJSAllocatedData> sharedData =
         new SharedJSAllocatedData(std::move(buf));
     return sharedData.forget();
   }
 
   static already_AddRefed<SharedJSAllocatedData> CreateFromExternalData(
       const JSStructuredCloneData& aData) {
     JSStructuredCloneData buf(aData.scope());
-    NS_ENSURE_TRUE(buf.Append(aData), nullptr);
+    buf.Append(aData);
     RefPtr<SharedJSAllocatedData> sharedData =
         new SharedJSAllocatedData(std::move(buf));
     return sharedData.forget();
   }
 
   NS_INLINE_DECL_REFCOUNTING(SharedJSAllocatedData)
 
   JSStructuredCloneData& Data() { return mData; }
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -79,17 +79,17 @@ struct SerializedStructuredCloneBuffer f
       : SerializedStructuredCloneBuffer() {
     *this = aOther;
   }
 
   SerializedStructuredCloneBuffer& operator=(
       const SerializedStructuredCloneBuffer& aOther) {
     data.Clear();
     data.initScope(aOther.data.scope());
-    MOZ_RELEASE_ASSERT(data.Append(aOther.data), "out of memory");
+    data.Append(aOther.data);
     return *this;
   }
 
   bool operator==(const SerializedStructuredCloneBuffer& aOther) const {
     // The copy assignment operator and the equality operator are
     // needed by the IPDL generated code. We relied on the copy
     // assignment operator at some places but we never use the
     // equality operator.
--- a/js/public/StructuredClone.h
+++ b/js/public/StructuredClone.h
@@ -434,17 +434,17 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API J
 
   void setCallbacks(const JSStructuredCloneCallbacks* callbacks, void* closure,
                     OwnTransferablePolicy policy) {
     callbacks_ = callbacks;
     closure_ = closure;
     ownTransferables_ = policy;
   }
 
-  MOZ_MUST_USE bool Init(size_t initialCapacity = 0) {
+  bool Init(size_t initialCapacity = 0) {
     return bufList_.Init(0, initialCapacity);
   }
 
   JS::StructuredCloneScope scope() const { return scope_; }
 
   void initScope(JS::StructuredCloneScope scope) {
     MOZ_ASSERT(Size() == 0, "initScope() of nonempty JSStructuredCloneData");
     if (scope_ != JS::StructuredCloneScope::Unassigned) {
@@ -453,34 +453,33 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API J
     }
     scope_ = scope;
   }
 
   size_t Size() const { return bufList_.Size(); }
 
   const Iterator Start() const { return bufList_.Iter(); }
 
-  MOZ_MUST_USE bool Advance(Iterator& iter, size_t distance) const {
+  bool Advance(Iterator& iter, size_t distance) const {
     return iter.AdvanceAcrossSegments(bufList_, distance);
   }
 
-  MOZ_MUST_USE bool ReadBytes(Iterator& iter, char* buffer, size_t size) const {
+  bool ReadBytes(Iterator& iter, char* buffer, size_t size) const {
     return bufList_.ReadBytes(iter, buffer, size);
   }
 
   // Append new data to the end of the buffer.
-  MOZ_MUST_USE bool AppendBytes(const char* data, size_t size) {
+  bool AppendBytes(const char* data, size_t size) {
     MOZ_ASSERT(scope_ != JS::StructuredCloneScope::Unassigned);
     return bufList_.WriteBytes(data, size);
   }
 
   // Update data stored within the existing buffer. There must be at least
   // 'size' bytes between the position of 'iter' and the end of the buffer.
-  MOZ_MUST_USE bool UpdateBytes(Iterator& iter, const char* data,
-                                size_t size) const {
+  bool UpdateBytes(Iterator& iter, const char* data, size_t size) const {
     MOZ_ASSERT(scope_ != JS::StructuredCloneScope::Unassigned);
     while (size > 0) {
       size_t remaining = iter.RemainingInSegment();
       size_t nbytes = std::min(remaining, size);
       memcpy(iter.Data(), data, nbytes);
       data += nbytes;
       size -= nbytes;
       iter.Advance(bufList_, nbytes);
@@ -520,17 +519,17 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API J
         return false;
       }
       iter.Advance(bufList_, iter.RemainingInSegment());
     }
     return true;
   }
 
   // Append the entire contents of other's bufList_ to our own.
-  MOZ_MUST_USE bool Append(const JSStructuredCloneData& other) {
+  bool Append(const JSStructuredCloneData& other) {
     MOZ_ASSERT(scope_ == other.scope());
     return other.ForEachDataChunk(
         [&](const char* data, size_t size) { return AppendBytes(data, size); });
   }
 
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) {
     return bufList_.SizeOfExcludingThis(mallocSizeOf);
   }
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -2939,20 +2939,17 @@ class CloneBufferObject : public NativeO
 
     size_t size = data->Size();
     UniqueChars buffer(js_pod_malloc<char>(size));
     if (!buffer) {
       ReportOutOfMemory(cx);
       return false;
     }
     auto iter = data->Start();
-    if (!data->ReadBytes(iter, buffer.get(), size)) {
-      ReportOutOfMemory(cx);
-      return false;
-    }
+    data->ReadBytes(iter, buffer.get(), size);
     JSString* str = JS_NewStringCopyN(cx, buffer.get(), size);
     if (!str) {
       return false;
     }
     args.rval().setString(str);
     return true;
   }
 
@@ -2974,20 +2971,17 @@ class CloneBufferObject : public NativeO
 
     size_t size = data->Size();
     UniqueChars buffer(js_pod_malloc<char>(size));
     if (!buffer) {
       ReportOutOfMemory(cx);
       return false;
     }
     auto iter = data->Start();
-    if (!data->ReadBytes(iter, buffer.get(), size)) {
-      ReportOutOfMemory(cx);
-      return false;
-    }
+    data->ReadBytes(iter, buffer.get(), size);
 
     auto* rawBuffer = buffer.release();
     JSObject* arrayBuffer = JS::NewArrayBufferWithContents(cx, size, rawBuffer);
     if (!arrayBuffer) {
       js_free(rawBuffer);
       return false;
     }