Bug 1565956 close BackgroundChild before deleting CycleCollectedJSContext r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Sun, 17 Nov 2019 21:16:53 +0000
changeset 502357 370d932f9681bbf85b1c1417b27936a839248be9
parent 502356 75a422b353a50e0367459ae4c7909151deda575e
child 502358 a1849f162702113fc3e66790787e93bc55d46eb0
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1565956
milestone72.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 1565956 close BackgroundChild before deleting CycleCollectedJSContext r=baku Depends on D53131 Differential Revision: https://phabricator.services.mozilla.com/D53132
dom/worklet/WorkletThread.cpp
--- a/dom/worklet/WorkletThread.cpp
+++ b/dom/worklet/WorkletThread.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WorkletThread.h"
 #include "prthread.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollector.h"
 #include "mozilla/dom/AtomList.h"
+#include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventQueue.h"
 #include "mozilla/ThreadEventQueue.h"
 
 namespace mozilla {
 namespace dom {
 
 namespace {
@@ -384,16 +385,19 @@ void WorkletThread::TerminateInternal() 
 
 /* static */
 void WorkletThread::DeleteCycleCollectedJSContext() {
   CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();
   if (!ccjscx) {
     return;
   }
 
+  // Release any MessagePort kept alive by its ipc actor.
+  mozilla::ipc::BackgroundChild::CloseForCurrentThread();
+
   WorkletJSContext* workletjscx = ccjscx->GetAsWorkletJSContext();
   MOZ_ASSERT(workletjscx);
   delete workletjscx;
 }
 
 /* static */
 bool WorkletThread::IsOnWorkletThread() {
   CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();