Bug 1548223 - Don't assert in Realm's destructor if we have shutdown GC leaks. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 02 May 2019 11:35:52 +0000
changeset 531079 31bc333e0431801d1252d779905f87e501751e16
parent 531078 082c0dba73cbd801b3a17409723e128c7c075009
child 531080 45cb80d21409f5d883ce12c0487772a261bf3080
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1548223
milestone68.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 1548223 - Don't assert in Realm's destructor if we have shutdown GC leaks. r=jonco Differential Revision: https://phabricator.services.mozilla.com/D29623
js/src/vm/Realm.cpp
--- a/js/src/vm/Realm.cpp
+++ b/js/src/vm/Realm.cpp
@@ -61,19 +61,20 @@ Realm::Realm(Compartment* comp, const JS
 Realm::~Realm() {
   MOZ_ASSERT(!hasBeenEnteredIgnoringJit());
 
   // Write the code coverage information in a file.
   if (coverage::IsLCovEnabled()) {
     runtime_->lcovOutput().writeLCovResult(lcovOutput);
   }
 
-  // We cannot have a debuggee realm here so we don't have to call
-  // runtime->decrementNumDebuggeeRealms().
-  MOZ_ASSERT(!isDebuggee());
+  // We can have a debuggee realm here only if we are destroying the runtime and
+  // leaked GC things.
+  MOZ_ASSERT_IF(runtime_->gc.shutdownCollectedEverything(), !isDebuggee());
+  unsetIsDebuggee();
 
   MOZ_ASSERT(runtime_->numRealms > 0);
   runtime_->numRealms--;
 }
 
 bool ObjectRealm::init(JSContext* cx) {
   NativeIteratorSentinel sentinel(NativeIterator::allocateSentinel(cx));
   if (!sentinel) {