From 9818272c767424e78f183c965edb5c227ebf4ddf Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 2 May 2019 11:35:52 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- js/src/vm/Realm.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/src/vm/Realm.cpp b/js/src/vm/Realm.cpp index b0c4a33800bf..30a24c226ca8 100644 --- a/js/src/vm/Realm.cpp +++ b/js/src/vm/Realm.cpp @@ -66,9 +66,10 @@ Realm::~Realm() { 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--;