Bug 1138794: Use an alternate crash report server on Windows XP SP2. r=ted a=lmandel
authorDavid Major <dmajor@mozilla.com>
Thu, 19 Mar 2015 14:31:57 +1300
changeset 250432 caf324dbb13f
parent 250431 f0a0d5d2d525
child 250433 c54687cb7086
push id4588
push userdmajor@mozilla.com
push date2015-03-19 01:48 +0000
treeherdermozilla-beta@caf324dbb13f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, lmandel
bugs1138794
milestone37.0
Bug 1138794: Use an alternate crash report server on Windows XP SP2. r=ted a=lmandel
toolkit/crashreporter/client/crashreporter_win.cpp
--- a/toolkit/crashreporter/client/crashreporter_win.cpp
+++ b/toolkit/crashreporter/client/crashreporter_win.cpp
@@ -7,16 +7,17 @@
 #undef WIN32_LEAN_AND_MEAN
 #endif
 
 #define NOMINMAX
 
 #include "crashreporter.h"
 
 #include <windows.h>
+#include <versionhelpers.h>
 #include <commctrl.h>
 #include <richedit.h>
 #include <shellapi.h>
 #include <shlobj.h>
 #include <shlwapi.h>
 #include <math.h>
 #include <set>
 #include <algorithm>
@@ -27,16 +28,19 @@
 #define CRASH_REPORTER_VALUE L"Enabled"
 #define SUBMIT_REPORT_VALUE  L"SubmitCrashReport"
 #define SUBMIT_REPORT_OLD    L"SubmitReport"
 #define INCLUDE_URL_VALUE    L"IncludeURL"
 #define EMAIL_ME_VALUE       L"EmailMe"
 #define EMAIL_VALUE          L"Email"
 #define MAX_EMAIL_LENGTH     1024
 
+#define SENDURL_ORIGINAL L"https://crash-reports.mozilla.com/submit"
+#define SENDURL_XPSP2 L"https://crash-reports-xpsp2.mozilla.com/submit"
+
 #define WM_UPLOADCOMPLETE WM_APP
 
 // Thanks, Windows.h :(
 #undef min
 #undef max
 
 using std::string;
 using std::wstring;
@@ -1295,16 +1299,24 @@ void UIShowDefaultUI()
 bool UIShowCrashUI(const StringTable& files,
                    const StringTable& queryParameters,
                    const string& sendURL,
                    const vector<string>& restartArgs)
 {
   gSendData.hDlg = nullptr;
   gSendData.sendURL = UTF8ToWide(sendURL);
 
+  // Windows XP SP2 doesn't support the crash report server's crypto.
+  // This is a hack to use an alternate server.
+  if (!IsWindowsXPSP3OrGreater() &&
+      gSendData.sendURL.find(SENDURL_ORIGINAL) == 0) {
+    gSendData.sendURL.replace(0, ARRAYSIZE(SENDURL_ORIGINAL) - 1,
+                              SENDURL_XPSP2);
+  }
+
   for (StringTable::const_iterator i = files.begin();
        i != files.end();
        i++) {
     gSendData.files[UTF8ToWide(i->first)] = UTF8ToWide(i->second);
   }
 
   for (StringTable::const_iterator i = queryParameters.begin();
        i != queryParameters.end();