From 65568d3c7ff8ec98f905d56cac58d4a482f072e9 Mon Sep 17 00:00:00 2001 From: Nico Grunbaum Date: Tue, 13 Jun 2023 16:30:40 +0000 Subject: [PATCH] Bug 1837333 - webrtc stats history should be cleared on parent process only;r=pehrsons, a=dmeehan The stats history only lives on the parent process. Clearing the logs from about:webrtc causes a (non-release) assertion. This was missed in testing. I will look into changing that in a follow up Bug 1837335. Differential Revision: https://phabricator.services.mozilla.com/D180299 --- dom/media/webrtc/jsapi/WebrtcGlobalInformation.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/media/webrtc/jsapi/WebrtcGlobalInformation.cpp b/dom/media/webrtc/jsapi/WebrtcGlobalInformation.cpp index 46f9479472ff7..7d0a9e64b1ae8 100644 --- a/dom/media/webrtc/jsapi/WebrtcGlobalInformation.cpp +++ b/dom/media/webrtc/jsapi/WebrtcGlobalInformation.cpp @@ -25,6 +25,7 @@ #include "nsLiteralString.h" #include "nsNetCID.h" // NS_SOCKETTRANSPORTSERVICE_CONTRACTID #include "nsServiceManagerUtils.h" // do_GetService +#include "nsXULAppAPI.h" #include "mozilla/ErrorResult.h" #include "nsProxyRelease.h" // nsMainThreadPtrHolder #include "mozilla/Telemetry.h" @@ -174,7 +175,9 @@ static void ClearLongTermStats() { } GetWebrtcGlobalStatsStash().Clear(); - WebrtcGlobalStatsHistory::Clear(); + if (XRE_IsParentProcess()) { + WebrtcGlobalStatsHistory::Clear(); + } if (auto* ctx = GetPeerConnectionCtx()) { ctx->ClearClosedStats(); } @@ -739,7 +742,6 @@ mozilla::ipc::IPCResult WebrtcGlobalChild::RecvClearStats() { } ClearLongTermStats(); - WebrtcGlobalStatsHistory::Clear(); return IPC_OK(); }