Backed out changeset 75935042f60b (bug 1920080) for causing assertion failure on FetchUtil.cpp

This commit is contained in:
Norisz Fay 2024-11-13 01:47:14 +02:00
parent 9f119b8fc8
commit 68c83a72df
11 changed files with 24 additions and 17 deletions

View File

@ -655,7 +655,7 @@ class JSStreamConsumer final : public nsIInputStreamCallback,
NS_IMPL_ISUPPORTS(JSStreamConsumer, nsIInputStreamCallback)
// static
MOZ_CONSTINIT const nsCString FetchUtil::WasmAltDataType;
MOZ_RUNINIT const nsCString FetchUtil::WasmAltDataType;
// static
void FetchUtil::InitWasmAltDataType() {

View File

@ -86,7 +86,7 @@ void gfxAndroidPlatform::FontAPIInitializeCallback(void* aUnused) {
}
PRThread* gfxAndroidPlatform::sFontAPIInitializeThread = nullptr;
MOZ_CONSTINIT nsCString gfxAndroidPlatform::sManufacturer;
MOZ_RUNINIT nsCString gfxAndroidPlatform::sManufacturer;
// static
bool gfxAndroidPlatform::IsFontAPIDisabled(bool aDontCheckPref) {

View File

@ -29,7 +29,7 @@ namespace ipc {
ProcessChild* ProcessChild::gProcessChild;
StaticMutex ProcessChild::gIPCShutdownStateLock;
MOZ_CONSTINIT nsCString ProcessChild::gIPCShutdownStateAnnotation;
MOZ_RUNINIT nsCString ProcessChild::gIPCShutdownStateAnnotation;
static Atomic<bool> sExpectingShutdown(false);

View File

@ -2045,7 +2045,7 @@ static void TestParseErrorHandlePref(const char* aPrefName, PrefType aType,
PrefValueKind aKind, PrefValue aValue,
bool aIsSticky, bool aIsLocked) {}
MOZ_CONSTINIT static nsCString gTestParseErrorMsgs;
MOZ_RUNINIT static nsCString gTestParseErrorMsgs;
static void TestParseErrorHandleError(const char* aMsg) {
gTestParseErrorMsgs.Append(aMsg);

View File

@ -20,7 +20,7 @@
#define GETTING_NETWORK_PROXY_TYPE_FAILED (-1)
static mozilla::StaticMutex sMutex;
MOZ_CONSTINIT nsCString WPADOptionResult MOZ_GUARDED_BY(sMutex);
MOZ_RUNINIT nsCString WPADOptionResult MOZ_GUARDED_BY(sMutex);
namespace mozilla {
namespace net {

View File

@ -207,7 +207,7 @@ static const char kCrashMainID[] = "crash.main.3\n";
static google_breakpad::ExceptionHandler* gExceptionHandler = nullptr;
static mozilla::Atomic<bool> gEncounteredChildException(false);
MOZ_CONSTINIT static nsCString gServerURL;
MOZ_RUNINIT static nsCString gServerURL;
MOZ_RUNINIT static xpstring pendingDirectory;
MOZ_RUNINIT static xpstring crashReporterPath;

View File

@ -328,10 +328,10 @@ int gKioskMonitor = -1;
bool gAllowContentAnalysisArgPresent = false;
MOZ_CONSTINIT nsString gAbsoluteArgv0Path;
MOZ_RUNINIT nsString gAbsoluteArgv0Path;
#if defined(XP_WIN)
MOZ_CONSTINIT nsString gProcessStartupShortcut;
MOZ_RUNINIT nsString gProcessStartupShortcut;
#endif
#if defined(MOZ_WIDGET_GTK)
@ -1287,8 +1287,8 @@ nsXULAppInfo::GetRemoteType(nsACString& aRemoteType) {
return NS_OK;
}
MOZ_CONSTINIT static nsCString gLastAppVersion;
MOZ_CONSTINIT static nsCString gLastAppBuildID;
MOZ_RUNINIT static nsCString gLastAppVersion;
MOZ_RUNINIT static nsCString gLastAppBuildID;
NS_IMETHODIMP
nsXULAppInfo::GetLastAppVersion(nsACString& aResult) {

View File

@ -94,8 +94,7 @@ struct nsCharTraits<char16_t> {
typedef uint16_t unsigned_char_type;
typedef char incompatible_char_type;
static constexpr char_type gNullChar = 0;
static constexpr char_type* sEmptyBuffer = const_cast<char_type*>(&gNullChar);
static char_type* const sEmptyBuffer;
// integer representation of characters:
typedef int int_type;
@ -283,8 +282,7 @@ struct nsCharTraits<char> {
typedef unsigned char unsigned_char_type;
typedef char16_t incompatible_char_type;
static constexpr char_type gNullChar = 0;
static constexpr char_type* sEmptyBuffer = const_cast<char_type*>(&gNullChar);
static char_type* const sEmptyBuffer;
// integer representation of characters:

View File

@ -68,7 +68,7 @@ class nsTString : public nsTSubstring<T> {
* constructors
*/
constexpr nsTString() : substring_type(ClassFlags::NULL_TERMINATED) {}
nsTString() : substring_type(ClassFlags::NULL_TERMINATED) {}
explicit nsTString(const char_type* aData, size_type aLength = size_type(-1))
: substring_type(ClassFlags::NULL_TERMINATED) {

View File

@ -44,6 +44,15 @@ using double_conversion::DoubleToStringConverter;
// ---------------------------------------------------------------------------
static const char16_t gNullChar = 0;
char* const nsCharTraits<char>::sEmptyBuffer =
(char*)const_cast<char16_t*>(&gNullChar);
char16_t* const nsCharTraits<char16_t>::sEmptyBuffer =
const_cast<char16_t*>(&gNullChar);
// ---------------------------------------------------------------------------
static void ReleaseData(void* aData, nsAString::DataFlags aFlags) {
if (aFlags & nsAString::DataFlags::REFCOUNTED) {
mozilla::StringBuffer::FromData(aData)->Release();

View File

@ -1182,7 +1182,7 @@ class nsTSubstring : public mozilla::detail::nsTStringRepr<T> {
}
protected:
constexpr void AssertValid() {
void AssertValid() {
MOZ_DIAGNOSTIC_ASSERT(!(this->mClassFlags & ClassFlags::INVALID_MASK));
MOZ_DIAGNOSTIC_ASSERT(!(this->mDataFlags & DataFlags::INVALID_MASK));
MOZ_ASSERT(!(this->mClassFlags & ClassFlags::NULL_TERMINATED) ||
@ -1251,7 +1251,7 @@ class nsTSubstring : public mozilla::detail::nsTStringRepr<T> {
}
// initialization with ClassFlags
constexpr explicit nsTSubstring(ClassFlags aClassFlags)
explicit nsTSubstring(ClassFlags aClassFlags)
: base_string_type(char_traits::sEmptyBuffer, 0, DataFlags::TERMINATED,
aClassFlags) {
AssertValid();