diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 7addbb91994a..b273d00c9094 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2124,11 +2124,13 @@ DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress, const JS::GCDescrip } } - if (sPostGCEventsToObserver) { - nsString json; - json.Adopt(aDesc.formatJSON(aCx, PR_Now())); - RefPtr notify = new NotifyGCEndRunnable(json); - NS_DispatchToMainThread(notify); + if (!sShuttingDown) { + if (sPostGCEventsToObserver || Telemetry::CanRecordExtended()) { + nsString json; + json.Adopt(aDesc.formatJSON(aCx, PR_Now())); + RefPtr notify = new NotifyGCEndRunnable(json); + NS_DispatchToMainThread(notify); + } } sCCLockedOut = false;