Bug 921293 - Don't print NS_WARNINGs if an environment variable is set (r=bsmedberg)
authorBill McCloskey <wmccloskey@mozilla.com>
Mon, 30 Sep 2013 13:30:39 -0700
changeset 163192 2cda3246c311be3fafb5fb1ff958eafef1b08ebd
parent 163191 e43f1bac03c150e327352f6a80ce0e30562128ca
child 163193 e0994d28e8b301a3e9c2688b05cbe23d251aa86b
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs921293
milestone27.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 921293 - Don't print NS_WARNINGs if an environment variable is set (r=bsmedberg)
xpcom/base/nsDebugImpl.cpp
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -350,19 +350,22 @@ NS_DebugBreak(uint32_t aSeverity, const 
    if (ll != PR_LOG_WARNING)
      fprintf(stderr, "\07");
 #endif
 
 #ifdef ANDROID
    __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", buf.buffer);
 #endif
 
-   // Write the message to stderr
-   fprintf(stderr, "%s\n", buf.buffer);
-   fflush(stderr);
+   // Write the message to stderr unless it's a warning and MOZ_IGNORE_WARNINGS
+   // is set.
+   if (!(PR_GetEnv("MOZ_IGNORE_WARNINGS") && aSeverity == NS_DEBUG_WARNING)) {
+     fprintf(stderr, "%s\n", buf.buffer);
+     fflush(stderr);
+   }
 
    switch (aSeverity) {
    case NS_DEBUG_WARNING:
      return;
 
    case NS_DEBUG_BREAK:
      Break(buf.buffer);
      return;