diff --git a/common/crash_reporter/crash_reporter_win.cc b/common/crash_reporter/crash_reporter_win.cc index 4a7f6012f45e..39837ecf08b9 100644 --- a/common/crash_reporter/crash_reporter_win.cc +++ b/common/crash_reporter/crash_reporter_win.cc @@ -53,7 +53,6 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name, if (waiting_event != INVALID_HANDLE_VALUE) WaitForSingleObject(waiting_event, 1000); - google_breakpad::CustomClientInfo custom_info = { NULL, 0 }; breakpad_.reset(new google_breakpad::ExceptionHandler( temp_dir.value(), FilterCallback, @@ -62,7 +61,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name, google_breakpad::ExceptionHandler::HANDLER_ALL, kSmallDumpType, pipe_name.c_str(), - &custom_info)); + GetCustomInfo(product_name, version, company_name))); if (!breakpad_->IsOutOfProcess()) LOG(ERROR) << "Cannot initialize out-of-process crash handler"; @@ -93,6 +92,30 @@ bool CrashReporterWin::MinidumpCallback(const wchar_t* dump_path, return false; } +google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo( + const std::string& product_name, + const std::string& version, + const std::string& company_name) { + custom_info_entries_.clear(); + custom_info_entries_.reserve(2 + upload_parameters_.size()); + + custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( + L"prod", UTF8ToWide(product_name).c_str())); + custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( + L"ver", UTF8ToWide(version).c_str())); + + for (StringMap::const_iterator iter = upload_parameters_.begin(); + iter != upload_parameters_.end(); ++iter) { + custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( + UTF8ToWide(iter->first).c_str(), + UTF8ToWide(iter->second).c_str())); + } + + custom_info_.entries = &custom_info_entries_.front(); + custom_info_.count = custom_info_entries_.size(); + return &custom_info_; +} + // static CrashReporterWin* CrashReporterWin::GetInstance() { return Singleton::get(); diff --git a/common/crash_reporter/crash_reporter_win.h b/common/crash_reporter/crash_reporter_win.h index ebd85624d699..6786975546dc 100644 --- a/common/crash_reporter/crash_reporter_win.h +++ b/common/crash_reporter/crash_reporter_win.h @@ -43,6 +43,16 @@ class CrashReporterWin : public CrashReporter { MDRawAssertionInfo* assertion, bool succeeded); + // Returns the custom info structure based on parameters. + google_breakpad::CustomClientInfo* GetCustomInfo( + const std::string& product_name, + const std::string& version, + const std::string& company_name); + + // Custom information to be passed to crash handler. + std::vector custom_info_entries_; + google_breakpad::CustomClientInfo custom_info_; + bool skip_system_crash_handler_; scoped_ptr breakpad_; diff --git a/spec/api/crash-reporter.coffee b/spec/api/crash-reporter.coffee index 0b5d1450d003..ec66402ff01d 100644 --- a/spec/api/crash-reporter.coffee +++ b/spec/api/crash-reporter.coffee @@ -13,13 +13,13 @@ describe 'crash-reporter module', -> server = http.createServer (req, res) -> form = new formidable.IncomingForm() form.parse req, (error, fields, files) -> - assert.equal fields['prod'], 'atom-shell' + assert.equal fields['prod'], 'Atom-Shell' assert.equal fields['ver'], process.versions['atom-shell'] assert.equal fields['process_type'], 'renderer' assert.equal fields['platform'], process.platform assert.equal fields['extra1'], 'extra1' assert.equal fields['extra2'], 'extra2' - assert.equal files['upload_file_minidump']['name'], 'minidump.dmp' + assert files['upload_file_minidump']['name']? w.destroy() res.end()