tor-browser

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

commit c22d71ab11f06ad5bf2ab9dc9427749a003436c3
parent 1bacc90000e4476dfd8ddec95052fb4720f50ada
Author: Chris Peterson <cpeterson@mozilla.com>
Date:   Tue,  9 Dec 2025 00:01:27 +0000

Bug 2002864 - Replace MOZ_CONSTINIT with C++20 constinit in desktop app code. r=firefox-desktop-core-reviewers ,mossop

Differential Revision: https://phabricator.services.mozilla.com/D274497

Diffstat:
Mbrowser/app/nsBrowserApp.cpp | 2+-
Mmodules/libpref/Preferences.cpp | 2+-
Mtoolkit/xre/nsAppRunner.cpp | 16++++++++--------
Mtoolkit/xre/nsX11ErrorHandler.cpp | 2+-
Mtoolkit/xre/nsXREDirProvider.cpp | 4++--
Mxpfe/appshell/AppWindow.cpp | 3+--
6 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp @@ -194,7 +194,7 @@ static bool HasFlag(int argc, char* argv[], const char* s) { return false; } -MOZ_CONSTINIT Bootstrap::UniquePtr gBootstrap; +constinit Bootstrap::UniquePtr gBootstrap; static int do_main(int argc, char* argv[], char* envp[]) { // Allow firefox.exe to launch XULRunner apps via -app <application.ini> diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp @@ -2114,7 +2114,7 @@ static void TestParseErrorHandlePref(const char* aPrefName, PrefType aType, PrefValueKind aKind, PrefValue aValue, bool aIsSticky, bool aIsLocked) {} -MOZ_CONSTINIT static nsCString gTestParseErrorMsgs; +constinit static nsCString gTestParseErrorMsgs; static void TestParseErrorHandleError(const char* aMsg) { gTestParseErrorMsgs.Append(aMsg); diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp @@ -310,8 +310,8 @@ extern const char gToolkitBuildID[]; static nsIProfileLock* gProfileLock; #if defined(MOZ_HAS_REMOTE) -MOZ_CONSTINIT static RefPtr<nsRemoteService> gRemoteService; -MOZ_CONSTINIT static RefPtr<nsStartupLock> gStartupLock; +constinit static RefPtr<nsRemoteService> gRemoteService; +constinit static RefPtr<nsStartupLock> gStartupLock; #endif int gRestartArgc; @@ -327,10 +327,10 @@ int gKioskMonitor = -1; bool gAllowContentAnalysisArgPresent = false; -MOZ_CONSTINIT nsString gAbsoluteArgv0Path; +constinit nsString gAbsoluteArgv0Path; #if defined(XP_WIN) -MOZ_CONSTINIT nsString gProcessStartupShortcut; +constinit nsString gProcessStartupShortcut; #endif #if defined(MOZ_WIDGET_GTK) @@ -348,7 +348,7 @@ MOZ_CONSTINIT nsString gProcessStartupShortcut; #endif #if defined(MOZ_WAYLAND) -MOZ_CONSTINIT std::unique_ptr<WaylandProxy> gWaylandProxy; +constinit std::unique_ptr<WaylandProxy> gWaylandProxy; #endif #include "BinaryPath.h" @@ -1269,8 +1269,8 @@ nsXULAppInfo::GetRemoteType(nsACString& aRemoteType) { return NS_OK; } -MOZ_CONSTINIT static nsCString gLastAppVersion; -MOZ_CONSTINIT static nsCString gLastAppBuildID; +constinit static nsCString gLastAppVersion; +constinit static nsCString gLastAppBuildID; NS_IMETHODIMP nsXULAppInfo::GetLastAppVersion(nsACString& aResult) { @@ -3026,7 +3026,7 @@ static ReturnAbortOnError ShowProfileSelector( static bool gDoMigration = false; static bool gDoProfileReset = false; -MOZ_CONSTINIT static nsCOMPtr<nsIToolkitProfile> gResetOldProfile; +constinit static nsCOMPtr<nsIToolkitProfile> gResetOldProfile; static nsresult LockProfile(nsINativeAppSupport* aNative, nsIFile* aRootDir, nsIFile* aLocalDir, nsIToolkitProfile* aProfile, diff --git a/toolkit/xre/nsX11ErrorHandler.cpp b/toolkit/xre/nsX11ErrorHandler.cpp @@ -24,7 +24,7 @@ struct XExtension { XExtension(const char* aName, int aCode) : name(aName), major_opcode(aCode) {} }; -MOZ_CONSTINIT static nsTArray<XExtension> sXExtensions; +constinit static nsTArray<XExtension> sXExtensions; // man XSetErrorHandler says "the error handler should not call any // functions (directly or indirectly) on the display that will generate diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp @@ -99,8 +99,8 @@ nsXREDirProvider* gDirServiceProvider = nullptr; nsIFile* gDataDirHomeLocal = nullptr; nsIFile* gDataDirHome = nullptr; -MOZ_CONSTINIT nsCOMPtr<nsIFile> gDataDirProfileLocal{}; -MOZ_CONSTINIT nsCOMPtr<nsIFile> gDataDirProfile{}; +constinit nsCOMPtr<nsIFile> gDataDirProfileLocal{}; +constinit nsCOMPtr<nsIFile> gDataDirProfile{}; #if defined(MOZ_WIDGET_GTK) nsXREDirProvider::legacyOrXDGHomeTelemetry gXdgTelemetry = diff --git a/xpfe/appshell/AppWindow.cpp b/xpfe/appshell/AppWindow.cpp @@ -2900,8 +2900,7 @@ static bool sWaitingForHiddenWindowToLoadNativeMenus = # endif ; -MOZ_CONSTINIT static nsTArray<LoadNativeMenusListener> - sLoadNativeMenusListeners; +constinit static nsTArray<LoadNativeMenusListener> sLoadNativeMenusListeners; static void BeginLoadNativeMenus(Document* aDoc, nsIWidget* aParentWindow);