Bug 1180988 - Don't leak when freeing transferables for MessagePort. r=smaug, a=abillings
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 28 Jul 2015 16:52:25 -0400
changeset 281737 619f2707ec0de0dcc6924e7437a44ddb4b927bc4
parent 281736 d2b1d8febf2cf245f7049118bc81281be2df95e2
child 281738 e936bc5444ad1d5b0abd6c45c7eb9cd1c3f52e86
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, abillings
bugs1180988
milestone41.0a2
Bug 1180988 - Don't leak when freeing transferables for MessagePort. r=smaug, a=abillings
dom/messagechannel/MessagePortUtils.cpp
--- a/dom/messagechannel/MessagePortUtils.cpp
+++ b/dom/messagechannel/MessagePortUtils.cpp
@@ -277,15 +277,16 @@ WriteStructuredCloneWithTransfer(JSConte
 
 void
 FreeStructuredClone(nsTArray<uint8_t>& aData, StructuredCloneClosure& aClosure)
 {
   auto* data = reinterpret_cast<uint64_t*>(aData.Elements());
   size_t dataLen = aData.Length();
   MOZ_ASSERT(!(dataLen % sizeof(*data)));
 
-  JS_ClearStructuredClone(data, dataLen, &gCallbacks, &aClosure, false);
+  StructuredCloneClosureInternal internalClosure(aClosure, nullptr);
+  JS_ClearStructuredClone(data, dataLen, &gCallbacks, &internalClosure, false);
   aData.Clear();
 }
 
 } // messageport namespace
 } // dom namespace
 } // mozilla namespace