diff --git a/atom/common/crash_reporter/crash_reporter_linux.cc b/atom/common/crash_reporter/crash_reporter_linux.cc index 9020977716e..d14c15de195 100644 --- a/atom/common/crash_reporter/crash_reporter_linux.cc +++ b/atom/common/crash_reporter/crash_reporter_linux.cc @@ -38,7 +38,8 @@ static const off_t kMaxMinidumpFileSize = 1258291; CrashReporterLinux::CrashReporterLinux() : process_start_time_(0), - pid_(getpid()) { + pid_(getpid()), + upload_to_server_(true) { // Set the base process start time value. struct timeval tv; if (!gettimeofday(&tv, NULL)) { @@ -69,6 +70,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name, crash_keys_->SetKeyValue("prod", ATOM_PRODUCT_NAME); crash_keys_->SetKeyValue("ver", version.c_str()); upload_url_ = submit_url; + upload_to_server_ = upload_to_server; for (StringMap::const_iterator iter = upload_parameters_.begin(); iter != upload_parameters_.end(); ++iter) @@ -79,6 +81,14 @@ void CrashReporterLinux::SetUploadParameters() { upload_parameters_["platform"] = "linux"; } +void CrashReporterLinux::SetUploadToServer(const bool upload_to_server) { + upload_to_server_ = upload_to_server; +} + +bool CrashReporterLinux::GetUploadToServer() { + return upload_to_server_; +} + void CrashReporterLinux::EnableCrashDumping(const base::FilePath& crashes_dir) { base::CreateDirectory(crashes_dir); @@ -117,7 +127,7 @@ bool CrashReporterLinux::CrashDone(const MinidumpDescriptor& minidump, info.fd = minidump.fd(); info.distro = base::g_linux_distro; info.distro_length = my_strlen(base::g_linux_distro); - info.upload = true; + info.upload = self->upload_to_server_; info.process_start_time = self->process_start_time_; info.oom_size = base::g_oom_size; info.pid = self->pid_; diff --git a/atom/common/crash_reporter/crash_reporter_linux.h b/atom/common/crash_reporter/crash_reporter_linux.h index 997caf1c271..75a57ec1c17 100644 --- a/atom/common/crash_reporter/crash_reporter_linux.h +++ b/atom/common/crash_reporter/crash_reporter_linux.h @@ -34,7 +34,9 @@ class CrashReporterLinux : public CrashReporter { const base::FilePath& crashes_dir, bool upload_to_server, bool skip_system_crash_handler) override; + void SetUploadToServer(bool upload_to_server) override; void SetUploadParameters() override; + bool GetUploadToServer() override; private: friend struct base::DefaultSingletonTraits; @@ -54,6 +56,7 @@ class CrashReporterLinux : public CrashReporter { uint64_t process_start_time_; pid_t pid_; std::string upload_url_; + bool upload_to_server_; DISALLOW_COPY_AND_ASSIGN(CrashReporterLinux); }; diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 818aa8e7b54..98bf0f3662f 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -40,7 +40,7 @@ The `crashReporter` module has the following methods: * `companyName` String (optional) * `submitURL` String - URL that crash reports will be sent to as POST. * `productName` String (optional) - Defaults to `app.getName()`. - * `uploadToServer` Boolean (optional) _macOS_ - Whether crash reports should be sent to the server + * `uploadToServer` Boolean (optional) _Linux_ _macOS_ - Whether crash reports should be sent to the server Default is `true`. * `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`. * `extra` Object (optional) - An object you can define that will be sent along with the @@ -99,14 +99,14 @@ Returns [`CrashReport[]`](structures/crash-report.md): Returns all uploaded crash reports. Each report contains the date and uploaded ID. -### `crashReporter.getUploadToServer()` _macOS_ +### `crashReporter.getUploadToServer()` _Linux_ _macOS_ Returns `Boolean` - Whether reports should be submitted to the server. Set through the `start` method or `setUploadToServer`. **Note:** This API can only be called from the main process. -### `crashReporter.setUploadToServer(uploadToServer)` _macOS_ +### `crashReporter.setUploadToServer(uploadToServer)` _Linux_ _macOS_ * `uploadToServer` Boolean _macOS_ - Whether reports should be submitted to the server