Bug 526623: Send channel with crash data. r=dtownsend
authorDavid Dahl <ddahl@mozilla.com>
Fri, 13 Nov 2009 15:05:14 -0800
changeset 34844 87417297cb3c4f3dd2f6c6146a8ad4b573c943ea
parent 34843 0179bc1932e0e9e94827d9e82c1d233df817df98
child 34845 20d4d539beb1a49e7ec2c0451e8cbe3d790924a1
push idunknown
push userunknown
push dateunknown
reviewersdtownsend
bugs526623
milestone1.9.3a1pre
Bug 526623: Send channel with crash data. r=dtownsend
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -200,16 +200,17 @@
 #ifdef MOZ_JPROF
 #include "jprof.h"
 #endif
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #include "nsICrashReporter.h"
 #define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
+#include "nsIPrefService.h"
 #endif
 
 #ifdef WINCE
 class WindowsMutex {
 public:
   WindowsMutex(const wchar_t *name) {
     mHandle = CreateMutexW(0, FALSE, name);
   }
@@ -3279,16 +3280,33 @@ XRE_main(int argc, char* argv[], const n
       ScopedXPCOMStartup xpcom;
       rv = xpcom.Initialize();
       NS_ENSURE_SUCCESS(rv, 1); 
       rv = xpcom.DoAutoreg();
       rv |= xpcom.RegisterProfileService();
       rv |= xpcom.SetWindowCreator(nativeApp);
       NS_ENSURE_SUCCESS(rv, 1);
 
+#ifdef MOZ_CRASHREPORTER
+      // tell the crash reporter to also send the release channel
+      nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
+      if (NS_SUCCEEDED(rv)) {
+        nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
+        rv = prefs->GetDefaultBranch(nsnull, getter_AddRefs(defaultPrefBranch));
+
+        if (NS_SUCCEEDED(rv)) {
+          nsXPIDLCString sval;
+          rv = defaultPrefBranch->GetCharPref("app.update.channel", getter_Copies(sval));
+          if (NS_SUCCEEDED(rv)) {
+            CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
+                                               sval);
+          }
+        }
+      }
+#endif
       {
         if (startOffline) {
           nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1"));
           NS_ENSURE_TRUE(io, 1);
           io->SetManageOfflineStatus(PR_FALSE);
           io->SetOffline(PR_TRUE);
         }