bug 1328964 don't try to cycle collect after worklet cycle collector has been shut down r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 06 Mar 2018 19:23:07 +1300
changeset 412958 6c5c5d824c234a268b433b3167cf68cd8d9e77b4
parent 412957 55823ab4098ad331e48a4caad64ea422d4e232cd
child 412959 a81b45daf248ae7b8a47fce6439812df520f3f11
push id33828
push userarchaeopteryx@coole-files.de
push dateThu, 12 Apr 2018 19:19:41 +0000
treeherdermozilla-central@6e22c4a726c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1328964
milestone61.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 1328964 don't try to cycle collect after worklet cycle collector has been shut down r=baku MozReview-Commit-ID: 5BTcAOZwvIU
dom/worklet/WorkletThread.cpp
--- a/dom/worklet/WorkletThread.cpp
+++ b/dom/worklet/WorkletThread.cpp
@@ -132,17 +132,22 @@ public:
   {
     MOZ_ASSERT(!aContinuation);
     nsCycleCollector_doDeferredDeletion();
   }
 
   virtual void
   CustomGCCallback(JSGCStatus aStatus) override
   {
-    if (aStatus == JSGC_END) {
+    // nsCycleCollector_collect() requires a cycle collector but
+    // ~WorkletJSContext calls nsCycleCollector_shutdown() and the base class
+    // destructor will trigger a final GC.  The nsCycleCollector_collect()
+    // call can be skipped in this GC as ~CycleCollectedJSContext removes the
+    // context from |this|.
+    if (aStatus == JSGC_END && !Contexts().isEmpty()) {
       nsCycleCollector_collect(nullptr);
     }
   }
 };
 
 class WorkletJSContext final : public CycleCollectedJSContext
 {
 public: