tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2f4ef5a83cffdefc1685de316d39ff49df06b2a7
parent 86244193a4e232ea93e00f481db063ac6b37f732
Author: agoloman <agoloman@mozilla.com>
Date:   Tue, 30 Sep 2025 15:49:12 +0300

Revert "Bug 1991395 - Better encapsulation for chaos mode r=necko-reviewers,kershaw" for causing build bustages @rules.mk.

This reverts commit e08528cda6e554abaefc3bfa73ee10d96cc53c6d.

Diffstat:
Mmfbt/ChaosMode.cpp | 7+++++--
Mmfbt/ChaosMode.h | 25++++++++++++++-----------
Mnetwerk/protocol/http/ConnectionEntry.cpp | 1+
3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/mfbt/ChaosMode.cpp b/mfbt/ChaosMode.cpp @@ -8,7 +8,10 @@ namespace mozilla { -Atomic<uint32_t, Relaxed> ChaosMode::ChaosModeCounter(0); -ChaosFeature ChaosMode::ChaosFeatures = ChaosFeature::Any; +namespace detail { +Atomic<uint32_t, Relaxed> gChaosModeCounter(0); +ChaosFeature gChaosFeatures = ChaosFeature::Any; + +} /* namespace detail */ } /* namespace mozilla */ diff --git a/mfbt/ChaosMode.h b/mfbt/ChaosMode.h @@ -7,10 +7,11 @@ #ifndef mozilla_ChaosMode_h #define mozilla_ChaosMode_h -#include "mozilla/Assertions.h" #include "mozilla/Atomics.h" +#include "mozilla/EnumSet.h" -#include <cstdint> +#include <stdint.h> +#include <stdlib.h> namespace mozilla { @@ -35,23 +36,25 @@ enum class ChaosFeature : uint32_t { Any = 0xffffffff, }; +namespace detail { +extern MFBT_DATA Atomic<uint32_t, Relaxed> gChaosModeCounter; +extern MFBT_DATA ChaosFeature gChaosFeatures; +} // namespace detail + /** * When "chaos mode" is activated, code that makes implicitly nondeterministic * choices is encouraged to make random and extreme choices, to test more * code paths and uncover bugs. */ class ChaosMode { - static MFBT_DATA Atomic<uint32_t, Relaxed> ChaosModeCounter; - static MFBT_DATA ChaosFeature ChaosFeatures; - public: static void SetChaosFeature(ChaosFeature aChaosFeature) { - ChaosFeatures = aChaosFeature; + detail::gChaosFeatures = aChaosFeature; } static bool isActive(ChaosFeature aFeature) { - return ChaosModeCounter > 0 && - (uint32_t(ChaosFeatures) & uint32_t(aFeature)); + return detail::gChaosModeCounter > 0 && + (uint32_t(detail::gChaosFeatures) & uint32_t(aFeature)); } /** @@ -59,14 +62,14 @@ class ChaosMode { * calls to leaveChaosMode must be made in order to restore the original * chaos mode state. */ - static void enterChaosMode() { ChaosModeCounter++; } + static void enterChaosMode() { detail::gChaosModeCounter++; } /** * Decrease the chaos mode activation level. See enterChaosMode(). */ static void leaveChaosMode() { - MOZ_ASSERT(ChaosModeCounter > 0); - ChaosModeCounter--; + MOZ_ASSERT(detail::gChaosModeCounter > 0); + detail::gChaosModeCounter--; } /** diff --git a/netwerk/protocol/http/ConnectionEntry.cpp b/netwerk/protocol/http/ConnectionEntry.cpp @@ -15,6 +15,7 @@ #include "ConnectionEntry.h" #include "HttpConnectionUDP.h" #include "nsQueryObject.h" +#include "mozilla/ChaosMode.h" #include "mozilla/StaticPrefs_network.h" #include "nsHttpHandler.h" #include "mozilla/net/neqo_glue_ffi_generated.h"