Bug 1340425 - Add back the magic GC in DoShutdown() to avoid intermittent leaks. r=smaug
MozReview-Commit-ID: CNkjPk9FLKj
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -1096,16 +1096,24 @@ nsXREDirProvider::DoShutdown()
if (mProfileNotified) {
nsCOMPtr<nsIObserverService> obsSvc =
mozilla::services::GetObserverService();
NS_ASSERTION(obsSvc, "No observer service?");
if (obsSvc) {
static const char16_t kShutdownPersist[] = u"shutdown-persist";
obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist);
obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist);
+
+#ifdef DEBUG
+ // Not having this causes large intermittent leaks. See bug 1340425.
+ if (JSContext* cx = dom::danger::GetJSContext()) {
+ JS_GC(cx);
+ }
+#endif
+
obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
obsSvc->NotifyObservers(nullptr, "profile-before-change-qm", kShutdownPersist);
obsSvc->NotifyObservers(nullptr, "profile-before-change-telemetry", kShutdownPersist);
}
mProfileNotified = false;
}
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)