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
parent ea839c7e22
commit 9111470b4f
8 changed files with 32 additions and 25 deletions

View File

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

View File

@ -125,7 +125,7 @@ void UIShowDefaultUI();
// 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,
// 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 std::string& sendURL,
const std::vector<std::string>& restartArgs);

View File

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

View File

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

View File

@ -377,12 +377,12 @@ void UIShutdown()
// 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 string& sendURL,
const vector<string>& restartArgs)
{
gDumpFile = dumpfile;
gFiles = files;
gQueryParameters = queryParameters;
gSendURL = sendURL;
gRestartArgs = restartArgs;

View File

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

View File

@ -22,7 +22,7 @@ using namespace CrashReporter;
static NSAutoreleasePool* gMainPool;
static CrashReporterUI* gUI = 0;
static string gDumpFile;
static StringTable gFiles;
static StringTable gQueryParameters;
static string gURLParameter;
static string gSendURL;
@ -103,11 +103,11 @@ static bool RestartApplication()
objectForInfoDictionaryKey:@"CFBundleName"]];
}
-(void)showCrashUI:(const string&)dumpfile
-(void)showCrashUI:(const StringTable&)files
queryParameters:(const StringTable&)queryParameters
sendURL:(const string&)sendURL
{
gDumpFile = dumpfile;
gFiles = files;
gQueryParameters = queryParameters;
gSendURL = sendURL;
@ -573,7 +573,12 @@ static bool RestartApplication()
[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];
[parameters release];
@ -773,14 +778,14 @@ void UIShowDefaultUI()
[NSApp run];
}
bool UIShowCrashUI(const string& dumpfile,
bool UIShowCrashUI(const StringTable& files,
const StringTable& queryParameters,
const string& sendURL,
const vector<string>& restartArgs)
{
gRestartArgs = restartArgs;
[gUI showCrashUI: dumpfile
[gUI showCrashUI: files
queryParameters: queryParameters
sendURL: sendURL];
[NSApp run];

View File

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