Bug 1007534 - Part 2: Support for multiple upload files in the crash reporter clients. r=ted

This commit is contained in:
David Major 2014-07-14 17:32:24 +12:00
Родитель 9cb7f94c04
Коммит d80937d12e
8 изменённых файлов: 32 добавлений и 25 удалений

Просмотреть файл

@ -637,7 +637,10 @@ int main(int argc, char** argv)
return 0; return 0;
} }
if (!UIShowCrashUI(gReporterDumpFile, queryParameters, sendURL, restartArgs)) StringTable files;
files["upload_file_minidump"] = gReporterDumpFile;
if (!UIShowCrashUI(files, queryParameters, sendURL, restartArgs))
DeleteDump(); DeleteDump();
} }

Просмотреть файл

@ -125,7 +125,7 @@ void UIShowDefaultUI();
// Run the UI for when the app was launched with a dump file // Run the UI for when the app was launched with a dump file
// Return true if the user sent (or tried to send) the crash report, // Return true if the user sent (or tried to send) the crash report,
// false if they chose not to, and it should be deleted. // false if they chose not to, and it should be deleted.
bool UIShowCrashUI(const std::string& dumpfile, bool UIShowCrashUI(const StringTable& files,
const StringTable& queryParameters, const StringTable& queryParameters,
const std::string& sendURL, const std::string& sendURL,
const std::vector<std::string>& restartArgs); const std::vector<std::string>& restartArgs);

Просмотреть файл

@ -47,7 +47,7 @@ GtkWidget* gRestartButton = 0;
bool gInitialized = false; bool gInitialized = false;
bool gDidTrySend = false; bool gDidTrySend = false;
string gDumpFile; StringTable gFiles;
StringTable gQueryParameters; StringTable gQueryParameters;
string gHttpProxy; string gHttpProxy;
string gAuth; string gAuth;
@ -193,13 +193,10 @@ gpointer SendThread(gpointer args)
string response, error; string response, error;
long response_code; long response_code;
std::map<string, string> files;
files["upload_file_minidump"] = gDumpFile;
bool success = google_breakpad::HTTPUpload::SendRequest bool success = google_breakpad::HTTPUpload::SendRequest
(gSendURL, (gSendURL,
gQueryParameters, gQueryParameters,
files, gFiles,
gHttpProxy, gAuth, gHttpProxy, gAuth,
gCACertificateFile, gCACertificateFile,
&response, &response,

Просмотреть файл

@ -26,7 +26,7 @@ extern GThread* gSendThreadID;
extern bool gInitialized; extern bool gInitialized;
extern bool gDidTrySend; extern bool gDidTrySend;
extern std::string gDumpFile; extern StringTable gFiles;
extern StringTable gQueryParameters; extern StringTable gQueryParameters;
extern std::string gHttpProxy; extern std::string gHttpProxy;
extern std::string gAuth; extern std::string gAuth;

Просмотреть файл

@ -377,12 +377,12 @@ void UIShutdown()
// Don't dlclose gnomeLib as libgnomevfs and libORBit-2 use atexit(). // Don't dlclose gnomeLib as libgnomevfs and libORBit-2 use atexit().
} }
bool UIShowCrashUI(const string& dumpfile, bool UIShowCrashUI(const StringTable& files,
const StringTable& queryParameters, const StringTable& queryParameters,
const string& sendURL, const string& sendURL,
const vector<string>& restartArgs) const vector<string>& restartArgs)
{ {
gDumpFile = dumpfile; gFiles = files;
gQueryParameters = queryParameters; gQueryParameters = queryParameters;
gSendURL = sendURL; gSendURL = sendURL;
gRestartArgs = restartArgs; gRestartArgs = restartArgs;

Просмотреть файл

@ -46,10 +46,10 @@
HTTPMultipartUpload* mPost; HTTPMultipartUpload* mPost;
} }
- (void)showCrashUI:(const std::string&)dumpfile - (void)showCrashUI:(const StringTable&)files
queryParameters:(const StringTable&)queryParameters queryParameters:(const StringTable&)queryParameters
sendURL:(const std::string&)sendURL; sendURL:(const std::string&)sendURL;
- (void)showErrorUI:(const std::string&)dumpfile; - (void)showErrorUI:(const std::string&)message;
- (void)showReportInfo; - (void)showReportInfo;
- (void)maybeSubmitReport; - (void)maybeSubmitReport;
- (void)closeMeDown:(id)unused; - (void)closeMeDown:(id)unused;

Просмотреть файл

@ -22,7 +22,7 @@ using namespace CrashReporter;
static NSAutoreleasePool* gMainPool; static NSAutoreleasePool* gMainPool;
static CrashReporterUI* gUI = 0; static CrashReporterUI* gUI = 0;
static string gDumpFile; static StringTable gFiles;
static StringTable gQueryParameters; static StringTable gQueryParameters;
static string gURLParameter; static string gURLParameter;
static string gSendURL; static string gSendURL;
@ -103,11 +103,11 @@ static bool RestartApplication()
objectForInfoDictionaryKey:@"CFBundleName"]]; objectForInfoDictionaryKey:@"CFBundleName"]];
} }
-(void)showCrashUI:(const string&)dumpfile -(void)showCrashUI:(const StringTable&)files
queryParameters:(const StringTable&)queryParameters queryParameters:(const StringTable&)queryParameters
sendURL:(const string&)sendURL sendURL:(const string&)sendURL
{ {
gDumpFile = dumpfile; gFiles = files;
gQueryParameters = queryParameters; gQueryParameters = queryParameters;
gSendURL = sendURL; gSendURL = sendURL;
@ -573,7 +573,12 @@ static bool RestartApplication()
[parameters setObject: value forKey: key]; [parameters setObject: value forKey: key];
} }
[mPost addFileAtPath: NSSTR(gDumpFile) name: @"upload_file_minidump"]; for (StringTable::const_iterator i = gFiles.begin();
i != gFiles.end();
i++) {
[mPost addFileAtPath: NSSTR(i->second) name: NSSTR(i->first)];
}
[mPost setParameters: parameters]; [mPost setParameters: parameters];
[parameters release]; [parameters release];
@ -773,14 +778,14 @@ void UIShowDefaultUI()
[NSApp run]; [NSApp run];
} }
bool UIShowCrashUI(const string& dumpfile, bool UIShowCrashUI(const StringTable& files,
const StringTable& queryParameters, const StringTable& queryParameters,
const string& sendURL, const string& sendURL,
const vector<string>& restartArgs) const vector<string>& restartArgs)
{ {
gRestartArgs = restartArgs; gRestartArgs = restartArgs;
[gUI showCrashUI: dumpfile [gUI showCrashUI: files
queryParameters: queryParameters queryParameters: queryParameters
sendURL: sendURL]; sendURL: sendURL];
[NSApp run]; [NSApp run];

Просмотреть файл

@ -52,8 +52,8 @@ using namespace CrashReporter;
typedef struct { typedef struct {
HWND hDlg; HWND hDlg;
wstring dumpFile;
map<wstring,wstring> queryParameters; map<wstring,wstring> queryParameters;
map<wstring,wstring> files;
wstring sendURL; wstring sendURL;
wstring serverResponse; wstring serverResponse;
@ -397,12 +397,9 @@ static DWORD WINAPI SendThreadProc(LPVOID param)
LogMessage("No server URL, not sending report"); LogMessage("No server URL, not sending report");
} else { } else {
google_breakpad::CrashReportSender sender(L""); google_breakpad::CrashReportSender sender(L"");
std::map<wstring, wstring> files;
files[L"upload_file_minidump"] = td->dumpFile;
finishedOk = (sender.SendCrashReport(td->sendURL, finishedOk = (sender.SendCrashReport(td->sendURL,
td->queryParameters, td->queryParameters,
files, td->files,
&td->serverResponse) &td->serverResponse)
== google_breakpad::RESULT_SUCCEEDED); == google_breakpad::RESULT_SUCCEEDED);
if (finishedOk) { if (finishedOk) {
@ -1296,15 +1293,20 @@ void UIShowDefaultUI()
MB_OK | MB_ICONSTOP); MB_OK | MB_ICONSTOP);
} }
bool UIShowCrashUI(const string& dumpFile, bool UIShowCrashUI(const StringTable& files,
const StringTable& queryParameters, const StringTable& queryParameters,
const string& sendURL, const string& sendURL,
const vector<string>& restartArgs) const vector<string>& restartArgs)
{ {
gSendData.hDlg = nullptr; gSendData.hDlg = nullptr;
gSendData.dumpFile = UTF8ToWide(dumpFile);
gSendData.sendURL = UTF8ToWide(sendURL); gSendData.sendURL = UTF8ToWide(sendURL);
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(); for (StringTable::const_iterator i = queryParameters.begin();
i != queryParameters.end(); i != queryParameters.end();
i++) { i++) {