From 458f5eb38505eda9cd74aa2d0f0d0409051a32c2 Mon Sep 17 00:00:00 2001 From: Martok Date: Sun, 14 Jan 2024 22:38:16 +0100 Subject: [PATCH] Issue #2452 - Fix getter constness https://bugzilla.mozilla.org/show_bug.cgi?id=1443429 Pt. 2 --- xpcom/base/CycleCollectedJSContext.cpp | 4 +++- xpcom/base/CycleCollectedJSContext.h | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index d92283fb20..e9c7e27469 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -1394,6 +1394,8 @@ CycleCollectedJSContext::ProcessStableStateQueue() MOZ_RELEASE_ASSERT(!mDoingStableStates); mDoingStableStates = true; + // When run, one event can add another event to the mStableStateEvents, as + // such you can't use iterators here. for (uint32_t i = 0; i < mStableStateEvents.Length(); ++i) { nsCOMPtr event = mStableStateEvents[i].forget(); event->Run(); @@ -1481,7 +1483,7 @@ CycleCollectedJSContext::AfterProcessMicrotasks() } uint32_t -CycleCollectedJSContext::RecursionDepth() +CycleCollectedJSContext::RecursionDepth() const { return mOwningThread->RecursionDepth(); } diff --git a/xpcom/base/CycleCollectedJSContext.h b/xpcom/base/CycleCollectedJSContext.h index 58f6d97e19..c0d7851568 100644 --- a/xpcom/base/CycleCollectedJSContext.h +++ b/xpcom/base/CycleCollectedJSContext.h @@ -357,7 +357,7 @@ public: virtual void BeforeProcessTask(bool aMightBlock); virtual void AfterProcessTask(uint32_t aRecursionDepth); - uint32_t RecursionDepth(); + uint32_t RecursionDepth() const; // Run in stable state (call through nsContentUtils) void RunInStableState(already_AddRefed&& aRunnable); @@ -397,12 +397,12 @@ public: } } - bool IsInMicroTask() + bool IsInMicroTask() const { return mMicroTaskLevel != 0; } - uint32_t MicroTaskLevel() + uint32_t MicroTaskLevel() const { return mMicroTaskLevel; } @@ -416,7 +416,7 @@ public: void PerformDebuggerMicroTaskCheckpoint(); - bool IsInStableOrMetaStableState() + bool IsInStableOrMetaStableState() const { return mDoingStableStates; }