Bug 1412048 - Replace NS_RUNTIMEABORT(var) with MOZ_CRASH_UNSAFE_OOL(var). r=froydnj data-review=francois

And remove unreachable code after MOZ_CRASH_UNSAFE_OOL().

MOZ_CRASH_UNSAFE_OOL causes data collection because crash strings are annotated to crash-stats and are publicly visible. Firefox data stewards must do data review on usages of this macro. However, all the crash strings this patch collects with MOZ_CRASH_UNSAFE_OOL are already collected with NS_RUNTIMEABORT.

MozReview-Commit-ID: IHmJfuxXSqw

--HG--
extra : rebase_source : 031f30934b58a7b87f960e57179641d44aefe5c5
extra : source : fe9f638a56a53c8721eecc4273dcc074c988546e
This commit is contained in:
Chris Peterson 2017-10-24 23:38:38 -07:00
parent 1df202b177
commit 73037a0f6a
10 changed files with 20 additions and 20 deletions

View File

@ -189,7 +189,7 @@ GLBlitTextureImageHelper::SetBlitFramebufferForDestTexture(GLuint aTexture)
// 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.
NS_RUNTIMEABORT(msg.get());
MOZ_CRASH_UNSAFE_OOL(msg.get());
}
}

View File

@ -2095,7 +2095,7 @@ gfxFontGroup::GetDefaultFont()
mFamilyList.ToString(familiesString);
SprintfLiteral(msg, "unable to find a usable font (%.220s)",
NS_ConvertUTF16toUTF8(familiesString).get());
NS_RUNTIMEABORT(msg);
MOZ_CRASH_UNSAFE_OOL(msg);
}
return mDefaultFont.get();

View File

@ -2784,7 +2784,7 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
pending.popFirst();
}
NS_RUNTIMEABORT(why);
MOZ_CRASH_UNSAFE_OOL(why);
}
void

View File

@ -303,14 +303,14 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
MOZ_CRASH("IPC FatalError in the parent process!");
} else {
formattedMessage.AppendLiteral("\". abort()ing as a result.");
NS_RUNTIMEABORT(formattedMessage.get());
MOZ_CRASH_UNSAFE_OOL(formattedMessage.get());
}
}
void
LogicError(const char* aMsg)
{
NS_RUNTIMEABORT(aMsg);
MOZ_CRASH_UNSAFE_OOL(aMsg);
}
void

View File

@ -773,7 +773,8 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
#ifdef MOZ_CRASHREPORTER
AnnotateCrashReport(aURI);
#endif
NS_RUNTIMEABORT(errorMessage.get());
MOZ_CRASH_UNSAFE_OOL(errorMessage.get());
}
void

View File

@ -37,7 +37,7 @@ class TabChild;
if (abort) { \
msg.AppendLiteral(" (set NECKO_ERRORS_ARE_FATAL=0 in your environment " \
"to convert this error into a warning.)"); \
NS_RUNTIMEABORT(msg.get()); \
MOZ_CRASH_UNSAFE_OOL(msg.get()); \
} else { \
msg.AppendLiteral(" (set NECKO_ERRORS_ARE_FATAL=1 in your environment " \
"to convert this warning into a fatal error.)"); \

View File

@ -40,42 +40,42 @@ GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
NS_NAMED_LITERAL_CSTRING(serialString, "(Details: serial ");
int32_t start = buffer.Find(serialString);
if (start == kNotFound)
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
start += serialString.Length();
errno = 0;
event.serial = strtol(buffer.BeginReading() + start, &endptr, 10);
if (errno)
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
NS_NAMED_LITERAL_CSTRING(errorCodeString, " error_code ");
if (!StringBeginsWith(Substring(endptr, buffer.EndReading()), errorCodeString))
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
errno = 0;
event.error_code = strtol(endptr + errorCodeString.Length(), &endptr, 10);
if (errno)
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
NS_NAMED_LITERAL_CSTRING(requestCodeString, " request_code ");
if (!StringBeginsWith(Substring(endptr, buffer.EndReading()), requestCodeString))
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
errno = 0;
event.request_code = strtol(endptr + requestCodeString.Length(), &endptr, 10);
if (errno)
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
NS_NAMED_LITERAL_CSTRING(minorCodeString, " minor_code ");
start = buffer.Find(minorCodeString, /* aIgnoreCase = */ false,
endptr - buffer.BeginReading());
if (!start)
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
errno = 0;
event.minor_code = strtol(buffer.BeginReading() + start + minorCodeString.Length(), nullptr, 10);
if (errno)
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
event.display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
// Gdk does not provide resource ID
@ -84,7 +84,7 @@ GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
X11Error(event.display, &event);
} else {
g_log_default_handler(log_domain, log_level, message, user_data);
NS_RUNTIMEABORT(message);
MOZ_CRASH_UNSAFE_OOL(message);
}
}

View File

@ -144,8 +144,7 @@ X11Error(Display *display, XErrorEvent *event) {
#endif
#endif
NS_RUNTIMEABORT(notes.get());
return 0; // not reached
MOZ_CRASH_UNSAFE_OOL(notes.get());
}
}

View File

@ -166,7 +166,7 @@ AssertActivityIsLegal()
{
if (gActivityTLS == BAD_TLS_INDEX || PR_GetThreadPrivate(gActivityTLS)) {
if (PR_GetEnv("MOZ_FATAL_STATIC_XPCOM_CTORS_DTORS")) {
NS_RUNTIMEABORT(kStaticCtorDtorWarning);
MOZ_CRASH_UNSAFE_OOL(kStaticCtorDtorWarning);
} else {
NS_WARNING(kStaticCtorDtorWarning);
}

View File

@ -671,7 +671,7 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
// Initialize the JS engine.
const char* jsInitFailureReason = JS_InitWithFailureDiagnostic();
if (jsInitFailureReason) {
NS_RUNTIMEABORT(jsInitFailureReason);
MOZ_CRASH_UNSAFE_OOL(jsInitFailureReason);
}
sInitializedJS = true;