зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1507049 - Rename MOZ_CRASH_UNSAFE_OOL MOZ_CRASH_UNSAFE. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D18515 --HG-- extra : rebase_source : e8ef6eec0f7542bb381e2da81ae6431b2828aabc extra : source : a8c262b4a2579e6def1b3a5a8220f5197b443e34
This commit is contained in:
Родитель
c032c54b84
Коммит
8e1848413c
|
@ -1819,7 +1819,7 @@ void RuntimeService::CrashIfHanging() {
|
|||
}
|
||||
|
||||
// This string will be leaked.
|
||||
MOZ_CRASH_UNSAFE_OOL(strdup(msg.BeginReading()));
|
||||
MOZ_CRASH_UNSAFE(strdup(msg.BeginReading()));
|
||||
}
|
||||
|
||||
// This spins the event loop until all workers are finished and their threads
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace {
|
|||
|
||||
void AssertOnOwningThread(void* aThread) {
|
||||
if (MOZ_UNLIKELY(aThread != GetCurrentVirtualThread())) {
|
||||
MOZ_CRASH_UNSAFE_OOL("WorkerHolder on the wrong thread.");
|
||||
MOZ_CRASH_UNSAFE("WorkerHolder on the wrong thread.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ void GLBlitTextureImageHelper::SetBlitFramebufferForDestTexture(
|
|||
// your texture is not texture complete -- that is, you
|
||||
// allocated a texture name, but didn't actually define its
|
||||
// size via a call to TexImage2D.
|
||||
MOZ_CRASH_UNSAFE_OOL(msg.get());
|
||||
MOZ_CRASH_UNSAFE(msg.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1957,7 +1957,7 @@ gfxFont* gfxFontGroup::GetDefaultFont() {
|
|||
mFamilyList.ToString(familiesString);
|
||||
SprintfLiteral(msg, "unable to find a usable font (%.220s)",
|
||||
familiesString.get());
|
||||
MOZ_CRASH_UNSAFE_OOL(msg);
|
||||
MOZ_CRASH_UNSAFE(msg);
|
||||
}
|
||||
|
||||
return mDefaultFont.get();
|
||||
|
|
|
@ -2751,7 +2751,7 @@ void MessageChannel::DebugAbort(const char* file, int line, const char* cond,
|
|||
pending.popFirst();
|
||||
}
|
||||
|
||||
MOZ_CRASH_UNSAFE_OOL(why);
|
||||
MOZ_CRASH_UNSAFE(why);
|
||||
}
|
||||
|
||||
void MessageChannel::DumpInterruptStack(const char* const pfx) const {
|
||||
|
|
|
@ -261,12 +261,12 @@ void FatalError(const char* aMsg, bool aIsParent) {
|
|||
} else {
|
||||
formattedMessage.AppendLiteral("\". abort()ing as a result.");
|
||||
#ifndef FUZZING
|
||||
MOZ_CRASH_UNSAFE_OOL(formattedMessage.get());
|
||||
MOZ_CRASH_UNSAFE(formattedMessage.get());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void LogicError(const char* aMsg) { MOZ_CRASH_UNSAFE_OOL(aMsg); }
|
||||
void LogicError(const char* aMsg) { MOZ_CRASH_UNSAFE(aMsg); }
|
||||
|
||||
void ActorIdReadError(const char* aActorDescription) {
|
||||
#ifndef FUZZING
|
||||
|
|
|
@ -3699,7 +3699,7 @@ static bool Crash(JSContext* cx, unsigned argc, Value* vp) {
|
|||
#ifndef DEBUG
|
||||
MOZ_ReportCrash(utf8chars.get(), __FILE__, __LINE__);
|
||||
#endif
|
||||
MOZ_CRASH_UNSAFE_OOL(utf8chars.get());
|
||||
MOZ_CRASH_UNSAFE(utf8chars.get());
|
||||
}
|
||||
|
||||
static bool GetSLX(JSContext* cx, unsigned argc, Value* vp) {
|
||||
|
|
|
@ -274,7 +274,7 @@ static void ErrorLoadingSheet(nsIURI* aURI, const char* aMsg,
|
|||
}
|
||||
}
|
||||
|
||||
MOZ_CRASH_UNSAFE_OOL(errorMessage.get());
|
||||
MOZ_CRASH_UNSAFE(errorMessage.get());
|
||||
}
|
||||
|
||||
void nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
|
||||
|
|
|
@ -293,12 +293,12 @@ MOZ_NoReturn(int aLine) {
|
|||
#endif
|
||||
|
||||
/*
|
||||
* MOZ_CRASH_UNSAFE_OOL(explanation-string) can be used if the explanation
|
||||
* string cannot be a string literal (but no other processing needs to be done
|
||||
* on it). A regular MOZ_CRASH() is preferred wherever possible, as passing
|
||||
* arbitrary strings from a potentially compromised process is not without risk.
|
||||
* If the string being passed is the result of a printf-style function,
|
||||
* consider using MOZ_CRASH_UNSAFE_PRINTF instead.
|
||||
* MOZ_CRASH_UNSAFE(explanation-string) can be used if the explanation string
|
||||
* cannot be a string literal (but no other processing needs to be done on it).
|
||||
* A regular MOZ_CRASH() is preferred wherever possible, as passing arbitrary
|
||||
* strings from a potentially compromised process is not without risk. If the
|
||||
* string being passed is the result of a printf-style function, consider using
|
||||
* MOZ_CRASH_UNSAFE_PRINTF instead.
|
||||
*
|
||||
* @note This macro causes data collection because crash strings are annotated
|
||||
* to crash-stats and are publicly visible. Firefox data stewards must do data
|
||||
|
@ -313,7 +313,7 @@ static inline MOZ_COLD MOZ_NORETURN void MOZ_Crash(const char* aFilename,
|
|||
MOZ_CRASH_ANNOTATE(aReason);
|
||||
MOZ_REALLY_CRASH(aLine);
|
||||
}
|
||||
#define MOZ_CRASH_UNSAFE_OOL(reason) MOZ_Crash(__FILE__, __LINE__, reason)
|
||||
#define MOZ_CRASH_UNSAFE(reason) MOZ_Crash(__FILE__, __LINE__, reason)
|
||||
|
||||
static const size_t sPrintfMaxArgs = 4;
|
||||
static const size_t sPrintfCrashReasonSize = 1024;
|
||||
|
|
|
@ -38,7 +38,7 @@ class TabChild;
|
|||
msg.AppendLiteral( \
|
||||
" (set NECKO_ERRORS_ARE_FATAL=0 in your environment " \
|
||||
"to convert this error into a warning.)"); \
|
||||
MOZ_CRASH_UNSAFE_OOL(msg.get()); \
|
||||
MOZ_CRASH_UNSAFE(msg.get()); \
|
||||
} else { \
|
||||
msg.AppendLiteral( \
|
||||
" (set NECKO_ERRORS_ARE_FATAL=1 in your environment " \
|
||||
|
|
|
@ -148,7 +148,7 @@ static already_AddRefed<nsIPrincipal> GetRequestingPrincipal(
|
|||
// We prefer to crash on the parent, so we get the reason in the crash report.
|
||||
static MOZ_COLD void CrashWithReason(const char* reason) {
|
||||
#ifndef RELEASE_OR_BETA
|
||||
MOZ_CRASH_UNSAFE_OOL(reason);
|
||||
MOZ_CRASH_UNSAFE(reason);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ void RunWatchdog(void* arg) {
|
|||
"Something is blocking the main-thread.",
|
||||
lastStep);
|
||||
// This string will be leaked.
|
||||
MOZ_CRASH_UNSAFE_OOL(strdup(msg.BeginReading()));
|
||||
MOZ_CRASH_UNSAFE(strdup(msg.BeginReading()));
|
||||
}
|
||||
|
||||
MOZ_CRASH("Shutdown hanging before starting.");
|
||||
|
|
|
@ -37,41 +37,43 @@ static void GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
|
|||
*/
|
||||
NS_NAMED_LITERAL_CSTRING(serialString, "(Details: serial ");
|
||||
int32_t start = buffer.Find(serialString);
|
||||
if (start == kNotFound) MOZ_CRASH_UNSAFE_OOL(message);
|
||||
if (start == kNotFound) { MOZ_CRASH_UNSAFE(message); }
|
||||
|
||||
start += serialString.Length();
|
||||
errno = 0;
|
||||
event.serial = strtol(buffer.BeginReading() + start, &endptr, 10);
|
||||
if (errno) MOZ_CRASH_UNSAFE_OOL(message);
|
||||
if (errno) { MOZ_CRASH_UNSAFE(message); }
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(errorCodeString, " error_code ");
|
||||
if (!StringBeginsWith(Substring(endptr, buffer.EndReading()),
|
||||
errorCodeString))
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
errorCodeString)) {
|
||||
MOZ_CRASH_UNSAFE(message);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
event.error_code = strtol(endptr + errorCodeString.Length(), &endptr, 10);
|
||||
if (errno) MOZ_CRASH_UNSAFE_OOL(message);
|
||||
if (errno) { MOZ_CRASH_UNSAFE(message); }
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(requestCodeString, " request_code ");
|
||||
if (!StringBeginsWith(Substring(endptr, buffer.EndReading()),
|
||||
requestCodeString))
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
requestCodeString)) {
|
||||
MOZ_CRASH_UNSAFE(message);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
event.request_code =
|
||||
strtol(endptr + requestCodeString.Length(), &endptr, 10);
|
||||
if (errno) MOZ_CRASH_UNSAFE_OOL(message);
|
||||
if (errno) { MOZ_CRASH_UNSAFE(message); }
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(minorCodeString, " minor_code ");
|
||||
start = buffer.Find(minorCodeString, /* aIgnoreCase = */ false,
|
||||
endptr - buffer.BeginReading());
|
||||
if (!start) MOZ_CRASH_UNSAFE_OOL(message);
|
||||
if (!start) { MOZ_CRASH_UNSAFE(message); }
|
||||
|
||||
errno = 0;
|
||||
event.minor_code = strtol(
|
||||
buffer.BeginReading() + start + minorCodeString.Length(), nullptr, 10);
|
||||
if (errno) MOZ_CRASH_UNSAFE_OOL(message);
|
||||
if (errno) { MOZ_CRASH_UNSAFE(message); }
|
||||
|
||||
event.display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||
// Gdk does not provide resource ID
|
||||
|
@ -80,7 +82,7 @@ static void GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
|
|||
X11Error(event.display, &event);
|
||||
} else {
|
||||
g_log_default_handler(log_domain, log_level, message, user_data);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
MOZ_CRASH_UNSAFE(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ int X11Error(Display *display, XErrorEvent *event) {
|
|||
# endif
|
||||
#endif
|
||||
|
||||
MOZ_CRASH_UNSAFE_OOL(notes.get());
|
||||
MOZ_CRASH_UNSAFE(notes.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ nsAutoOwningThread::nsAutoOwningThread() : mThread(GetCurrentVirtualThread()) {}
|
|||
void nsAutoOwningThread::AssertCurrentThreadOwnsMe(const char* msg) const {
|
||||
if (MOZ_UNLIKELY(!IsCurrentThread())) {
|
||||
// `msg` is a string literal by construction.
|
||||
MOZ_CRASH_UNSAFE_OOL(msg);
|
||||
MOZ_CRASH_UNSAFE(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,11 +50,10 @@ class nsAutoOwningThread {
|
|||
nsAutoOwningThread();
|
||||
|
||||
// We move the actual assertion checks out-of-line to minimize code bloat,
|
||||
// but that means we have to pass a non-literal string to
|
||||
// MOZ_CRASH_UNSAFE_OOL. To make that more safe, the public interface
|
||||
// requires a literal string and passes that to the private interface; we
|
||||
// can then be assured that we effectively are passing a literal string
|
||||
// to MOZ_CRASH_UNSAFE_OOL.
|
||||
// but that means we have to pass a non-literal string to MOZ_CRASH_UNSAFE.
|
||||
// To make that more safe, the public interface requires a literal string
|
||||
// and passes that to the private interface; we can then be assured that we
|
||||
// effectively are passing a literal string to MOZ_CRASH_UNSAFE.
|
||||
template <int N>
|
||||
void AssertOwnership(const char (&aMsg)[N]) const {
|
||||
AssertCurrentThreadOwnsMe(aMsg);
|
||||
|
|
|
@ -189,7 +189,7 @@ static void AssertActivityIsLegal() {
|
|||
}
|
||||
if (gActivityTLS == BAD_TLS_INDEX || PR_GetThreadPrivate(gActivityTLS)) {
|
||||
if (PR_GetEnv("MOZ_FATAL_STATIC_XPCOM_CTORS_DTORS")) {
|
||||
MOZ_CRASH_UNSAFE_OOL(kStaticCtorDtorWarning);
|
||||
MOZ_CRASH_UNSAFE(kStaticCtorDtorWarning);
|
||||
} else {
|
||||
NS_WARNING(kStaticCtorDtorWarning);
|
||||
}
|
||||
|
|
|
@ -443,7 +443,7 @@ NS_InitXPCOM2(nsIServiceManager** aResult, nsIFile* aBinDirectory,
|
|||
// Initialize the JS engine.
|
||||
const char* jsInitFailureReason = JS_InitWithFailureDiagnostic();
|
||||
if (jsInitFailureReason) {
|
||||
MOZ_CRASH_UNSAFE_OOL(jsInitFailureReason);
|
||||
MOZ_CRASH_UNSAFE(jsInitFailureReason);
|
||||
}
|
||||
sInitializedJS = true;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче