Bug 1412048 - Replace some NS_RUNTIMEABORT(var) calls with MOZ_CRASH_UNSAFE_PRINTF. r=froydnj data-review=francois
authorChris Peterson <cpeterson@mozilla.com>
Thu, 26 Oct 2017 00:49:00 -0700
changeset 390022 e85f59ea455dfc915b7d428eaf45a3cfa0b7baba
parent 390021 405cc8ca7f764e985c6ab1e6d4365681b6ff2e10
child 390023 17decbfb072038b166a5f658e60483ebb56742e0
push id96987
push usercpeterson@mozilla.com
push dateSat, 04 Nov 2017 04:46:32 +0000
treeherdermozilla-inbound@17decbfb0720 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1412048
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1412048 - Replace some NS_RUNTIMEABORT(var) calls with MOZ_CRASH_UNSAFE_PRINTF. r=froydnj data-review=francois MOZ_CRASH_UNSAFE_PRINTF 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_PRINTF are already collected with NS_RUNTIMEABORT. MozReview-Commit-ID: 5ujXa9MHH5Z
ipc/glue/ProtocolUtils.cpp
xpcom/string/nsSubstring.cpp
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -311,18 +311,17 @@ void
 LogicError(const char* aMsg)
 {
   MOZ_CRASH_UNSAFE_OOL(aMsg);
 }
 
 void
 ActorIdReadError(const char* aActorDescription)
 {
-  nsPrintfCString message("Error deserializing id for %s", aActorDescription);
-  NS_RUNTIMEABORT(message.get());
+  MOZ_CRASH_UNSAFE_PRINTF("Error deserializing id for %s", aActorDescription);
 }
 
 void
 BadActorIdError(const char* aActorDescription)
 {
   nsPrintfCString message("bad id for %s", aActorDescription);
   ProtocolErrorBreakpoint(message.get());
 }
@@ -340,32 +339,29 @@ MismatchedActorTypeError(const char* aAc
   nsPrintfCString message("actor that should be of type %s has different type",
                           aActorDescription);
   ProtocolErrorBreakpoint(message.get());
 }
 
 void
 UnionTypeReadError(const char* aUnionName)
 {
-  nsPrintfCString message("error deserializing type of union %s", aUnionName);
-  NS_RUNTIMEABORT(message.get());
+  MOZ_CRASH_UNSAFE_PRINTF("error deserializing type of union %s", aUnionName);
 }
 
 void
 ArrayLengthReadError(const char* aElementName)
 {
-  nsPrintfCString message("error deserializing length of %s[]", aElementName);
-  NS_RUNTIMEABORT(message.get());
+  MOZ_CRASH_UNSAFE_PRINTF("error deserializing length of %s[]", aElementName);
 }
 
 void
 SentinelReadError(const char* aClassName)
 {
-  nsPrintfCString message("incorrect sentinel when reading %s", aClassName);
-  NS_RUNTIMEABORT(message.get());
+  MOZ_CRASH_UNSAFE_PRINTF("incorrect sentinel when reading %s", aClassName);
 }
 
 void
 TableToArray(const nsTHashtable<nsPtrHashKey<void>>& aTable,
              nsTArray<void*>& aArray)
 {
   uint32_t i = 0;
   void** elements = aArray.AppendElements(aTable.Count());
--- a/xpcom/string/nsSubstring.cpp
+++ b/xpcom/string/nsSubstring.cpp
@@ -36,17 +36,17 @@
 #include <pthread.h>
 #include <unistd.h>
 #endif
 
 #ifdef STRING_BUFFER_CANARY
 #define CHECK_STRING_BUFFER_CANARY(c)                                     \
   do {                                                                    \
     if ((c) != CANARY_OK) {                                               \
-      NS_RUNTIMEABORT(nsPrintfCString("Bad canary value %d", c).get());   \
+      MOZ_CRASH_UNSAFE_PRINTF("Bad canary value %d", c);                  \
     }                                                                     \
   } while(0)
 #else
 #define CHECK_STRING_BUFFER_CANARY(c)                                     \
   do {                                                                    \
   } while(0)
 #endif