Bug 1485320 - Use SetLength() instead of GetMutableData() throwing away the pointer in MemoryOutputStream::Create(). r=asuth
authorHenri Sivonen <hsivonen@hsivonen.fi>
Wed, 22 Aug 2018 11:32:41 +0000
changeset 490528 c2616aee4d444980703769f85056d48cd4f1483d
parent 490527 02647608ed585de04dd8d78fcfc1263675c7d958
child 490529 28d5979962b7aacb307fbbaf1ce438d5560044ce
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1485320
milestone63.0a1
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
Bug 1485320 - Use SetLength() instead of GetMutableData() throwing away the pointer in MemoryOutputStream::Create(). r=asuth MozReview-Commit-ID: zZmGlE30kz Differential Revision: https://phabricator.services.mozilla.com/D3964
dom/quota/MemoryOutputStream.cpp
--- a/dom/quota/MemoryOutputStream.cpp
+++ b/dom/quota/MemoryOutputStream.cpp
@@ -19,19 +19,17 @@ MemoryOutputStream::Create(uint64_t aSiz
   MOZ_ASSERT(aSize, "Passed zero size!");
 
   if (NS_WARN_IF(aSize > UINT32_MAX)) {
     return nullptr;
   }
 
   RefPtr<MemoryOutputStream> stream = new MemoryOutputStream();
 
-  char* dummy;
-  uint32_t length = stream->mData.GetMutableData(&dummy, aSize, fallible);
-  if (NS_WARN_IF(length != aSize)) {
+  if (NS_WARN_IF(!stream->mData.SetLength(aSize, fallible))) {
     return nullptr;
   }
 
   return stream.forget();
 }
 
 NS_IMPL_ISUPPORTS(MemoryOutputStream, nsIOutputStream)