shouldUpload --> uploadToServer
This commit is contained in:
parent
a7dedb3a13
commit
2bf6f28152
11 changed files with 41 additions and 41 deletions
|
@ -40,10 +40,10 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
base::Bind(&CrashReporter::Start, report));
|
||||
dict.SetMethod("_getUploadedReports",
|
||||
base::Bind(&CrashReporter::GetUploadedReports, report));
|
||||
dict.SetMethod("_setShouldUpload",
|
||||
base::Bind(&CrashReporter::SetShouldUpload, report));
|
||||
dict.SetMethod("_getShouldUpload",
|
||||
base::Bind(&CrashReporter::GetShouldUpload, report));
|
||||
dict.SetMethod("_setUploadToServer",
|
||||
base::Bind(&CrashReporter::SetUploadToServer, report));
|
||||
dict.SetMethod("_getUploadToServer",
|
||||
base::Bind(&CrashReporter::GetUploadToServer, report));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -26,13 +26,13 @@ void CrashReporter::Start(const std::string& product_name,
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler,
|
||||
const StringMap& extra_parameters) {
|
||||
SetUploadParameters(extra_parameters);
|
||||
|
||||
InitBreakpad(product_name, ATOM_VERSION_STRING, company_name, submit_url,
|
||||
crashes_dir, should_upload, skip_system_crash_handler);
|
||||
crashes_dir, upload_to_server, skip_system_crash_handler);
|
||||
}
|
||||
|
||||
void CrashReporter::SetUploadParameters(const StringMap& parameters) {
|
||||
|
@ -43,10 +43,10 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) {
|
|||
SetUploadParameters();
|
||||
}
|
||||
|
||||
void CrashReporter::SetShouldUpload(const bool should_upload) {
|
||||
void CrashReporter::SetUploadToServer(const bool upload_to_server) {
|
||||
}
|
||||
|
||||
bool CrashReporter::GetShouldUpload() {
|
||||
bool CrashReporter::GetUploadToServer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@ class CrashReporter {
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler,
|
||||
const StringMap& extra_parameters);
|
||||
|
||||
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
|
||||
const base::FilePath& crashes_dir);
|
||||
|
||||
virtual void SetShouldUpload(bool should_upload);
|
||||
virtual bool GetShouldUpload();
|
||||
virtual void SetUploadToServer(bool upload_to_server);
|
||||
virtual bool GetUploadToServer();
|
||||
|
||||
protected:
|
||||
CrashReporter();
|
||||
|
@ -45,7 +45,7 @@ class CrashReporter {
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler);
|
||||
virtual void SetUploadParameters();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler) {
|
||||
EnableCrashDumping(crashes_dir);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class CrashReporterLinux : public CrashReporter {
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler) override;
|
||||
void SetUploadParameters() override;
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ class CrashReporterMac : public CrashReporter {
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler) override;
|
||||
void SetUploadParameters() override;
|
||||
void SetShouldUpload(bool should_upload) override;
|
||||
bool GetShouldUpload() override;
|
||||
void SetUploadToServer(bool upload_to_server) override;
|
||||
bool GetUploadToServer() override;
|
||||
|
||||
private:
|
||||
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
|
||||
|
|
|
@ -31,7 +31,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler) {
|
||||
// check whether crashpad has been initialized.
|
||||
// Only need to initialize once.
|
||||
|
@ -75,11 +75,11 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
|
|||
if (is_browser_) {
|
||||
database_ =
|
||||
crashpad::CrashReportDatabase::Initialize(crashes_dir);
|
||||
SetShouldUpload(should_upload);
|
||||
SetUploadToServer(upload_to_server);
|
||||
}
|
||||
}
|
||||
|
||||
bool CrashReporterMac::GetShouldUpload() {
|
||||
bool CrashReporterMac::GetUploadToServer() {
|
||||
bool enabled = true;
|
||||
if (database_) {
|
||||
database_->GetSettings()->GetUploadsEnabled(&enabled);
|
||||
|
@ -87,9 +87,9 @@ bool CrashReporterMac::GetShouldUpload() {
|
|||
return enabled;
|
||||
}
|
||||
|
||||
void CrashReporterMac::SetShouldUpload(const bool should_upload) {
|
||||
void CrashReporterMac::SetUploadToServer(const bool upload_to_server) {
|
||||
if (database_) {
|
||||
database_->GetSettings()->SetUploadsEnabled(should_upload);
|
||||
database_->GetSettings()->SetUploadsEnabled(upload_to_server);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler) {
|
||||
skip_system_crash_handler_ = skip_system_crash_handler;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class CrashReporterWin : public CrashReporter {
|
|||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const base::FilePath& crashes_dir,
|
||||
bool should_upload,
|
||||
bool upload_to_server,
|
||||
bool skip_system_crash_handler) override;
|
||||
void SetUploadParameters() override;
|
||||
|
||||
|
|
|
@ -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()`.
|
||||
* `shouldUpload` Boolean (optional) _macOS_ - Whether crash reports should be sent to the server
|
||||
* `uploadToServer` Boolean (optional) _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
|
||||
|
@ -70,16 +70,16 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
|||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
### `crashReporter.getShouldUpload()` _macOS_
|
||||
### `crashReporter.getUploadToServer()` _macOS_
|
||||
|
||||
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setShouldUpload`.
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**NOTE:** This API can only be used from the main process
|
||||
|
||||
### `crashReporter.setShouldUpload(shouldUpload)` _macOS_
|
||||
### `crashReporter.setUploadToServer(uploadToServer)` _macOS_
|
||||
|
||||
* `shouldUpload` Boolean _macOS_ - Whether reports should be submitted to the server
|
||||
* `uploadToServer` Boolean _macOS_ - Whether reports should be submitted to the server
|
||||
|
||||
This would normally be controlled by user preferences.
|
||||
|
||||
|
|
|
@ -13,16 +13,16 @@ class CrashReporter {
|
|||
options = {}
|
||||
}
|
||||
this.productName = options.productName != null ? options.productName : app.getName()
|
||||
let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL, shouldUpload} = options
|
||||
let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL, uploadToServer} = options
|
||||
|
||||
if (autoSubmit == null && shouldUpload == null) {
|
||||
shouldUpload = true
|
||||
if (autoSubmit == null && uploadToServer == null) {
|
||||
uploadToServer = true
|
||||
} else {
|
||||
if (typeof autoSubmit !== 'undefined') {
|
||||
// TODO: Remove depreceated property in 2.0.0
|
||||
console.warn('The "autoSubmit" attribute on electron.crashReporter.start is depreceated. Please use "shouldUpload" instead.')
|
||||
console.warn('The "autoSubmit" attribute on electron.crashReporter.start is depreceated. Please use "uploadToServer" instead.')
|
||||
}
|
||||
shouldUpload = shouldUpload || autoSubmit
|
||||
uploadToServer = uploadToServer || autoSubmit
|
||||
}
|
||||
if (ignoreSystemCrashHandler == null) {
|
||||
ignoreSystemCrashHandler = false
|
||||
|
@ -62,7 +62,7 @@ class CrashReporter {
|
|||
})
|
||||
}
|
||||
|
||||
binding.start(this.getProductName(), companyName, submitURL, this.getCrashesDirectory(), shouldUpload, ignoreSystemCrashHandler, extra)
|
||||
binding.start(this.getProductName(), companyName, submitURL, this.getCrashesDirectory(), uploadToServer, ignoreSystemCrashHandler, extra)
|
||||
}
|
||||
|
||||
getLastCrashReport () {
|
||||
|
@ -102,19 +102,19 @@ class CrashReporter {
|
|||
return this.tempDirectory
|
||||
}
|
||||
|
||||
getShouldUpload () {
|
||||
getUploadToServer () {
|
||||
if (process.type === 'browser') {
|
||||
return binding._getShouldUpload()
|
||||
return binding._getUploadToServer()
|
||||
} else {
|
||||
throw new Error('getShouldUpload can only be called from the main process')
|
||||
throw new Error('getUploadToServer can only be called from the main process')
|
||||
}
|
||||
}
|
||||
|
||||
setShouldUpload (shouldUpload) {
|
||||
setUploadToServer (uploadToServer) {
|
||||
if (process.type === 'browser') {
|
||||
return binding._setShouldUpload(shouldUpload)
|
||||
return binding._setUploadToServer(uploadToServer)
|
||||
} else {
|
||||
throw new Error('setShouldUpload can only be called from the main process')
|
||||
throw new Error('setUploadToServer can only be called from the main process')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue