namespace {
+void SetExtraParameter(const std::string& key, mate::Arguments* args) {
+ std::string value;
+ if (args->GetNext(&value))
+ CrashReporter::GetInstance()->SetExtraParameter(key, value);
+ else
+ CrashReporter::GetInstance()->RemoveExtraParameter(key);
+}
+
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
auto reporter = base::Unretained(CrashReporter::GetInstance());
dict.SetMethod("start", base::Bind(&CrashReporter::Start, reporter));
- dict.SetMethod("setExtraParameter",
- base::Bind(&CrashReporter::SetExtraParameter, reporter));
+ dict.SetMethod("setExtraParameter", &SetExtraParameter);
dict.SetMethod("getUploadedReports",
base::Bind(&CrashReporter::GetUploadedReports, reporter));
dict.SetMethod("setUploadToServer",
const std::string& value) {
}
+void CrashReporter::RemoveExtraParameter(const std::string& key) {
+}
+
#if defined(OS_MACOSX) && defined(MAS_BUILD)
// static
CrashReporter* CrashReporter::GetInstance() {
virtual bool GetUploadToServer();
virtual void SetExtraParameter(const std::string& key,
const std::string& value);
+ virtual void RemoveExtraParameter(const std::string& key);
protected:
CrashReporter();
bool GetUploadToServer() override;
void SetExtraParameter(const std::string& key,
const std::string& value) override;
+ void RemoveExtraParameter(const std::string& key) override;
private:
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
upload_parameters_[key] = value;
}
+void CrashReporterMac::RemoveExtraParameter(const std::string& key) {
+ if (simple_string_dictionary_)
+ simple_string_dictionary_->RemoveKey(key.data());
+ else
+ upload_parameters_.erase(key);
+}
+
std::vector<CrashReporter::UploadReportResult>
CrashReporterMac::GetUploadedReports(const base::FilePath& crashes_dir) {
std::vector<CrashReporter::UploadReportResult> uploaded_reports;
### `crashReporter.setExtraParameter(key, value)` _macOS_
* `key` String - Parameter key.
-* `value` String - Parameter value.
+* `value` String - Parameter value. Specifying `null` or `undefined` will
+ remove the key from the extra parameters.
Set an extra data to set be sent with the crash report. The values specified
here will be sent in addition to any values set via the `extra` option to