diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 43c622cb6b9d..29a2da5907c9 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -2764,6 +2764,12 @@ void WorkerPrivate::DoRunLoop(JSContext* aCx) { !(debuggerRunnablesPending = !mDebuggerQueue.IsEmpty()) && !(normalRunnablesPending = NS_HasPendingEvents(mThread)) && !(mStatus != Running && !HasActiveWorkerRefs())) { + // We pop out to this loop when there are no pending events. + // If we don't reset these, we may not re-enter ProcessNextEvent() + // until we have events to process, and it may seem like we have + // an event running for a very long time. + mThread->SetRunningEventDelay(TimeDuration(), TimeStamp()); + WaitForWorkerEvents(); } diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 6160cd0b7988..f2b155b22350 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -961,6 +961,11 @@ nsSocketTransportService::Run() { startOfNextIteration = TimeStamp::NowLoRes(); } pollDuration = nullptr; + // We pop out to this loop when there are no pending events. + // If we don't reset these, we may not re-enter ProcessNextEvent() + // until we have events to process, and it may seem like we have + // an event running for a very long time. + mRawThread->SetRunningEventDelay(TimeDuration(), TimeStamp()); do { if (Telemetry::CanRecordPrereleaseData()) {