2020-05-07 20:31:26 +00:00
|
|
|
import { invokeSync } from '../ipc-renderer-internal-utils';
|
|
|
|
import { deprecate } from 'electron';
|
2020-10-13 21:11:06 +00:00
|
|
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
2020-05-07 20:31:26 +00:00
|
|
|
|
2020-06-23 03:32:45 +00:00
|
|
|
const binding = process._linkedBinding('electron_renderer_crash_reporter');
|
2020-05-07 20:31:26 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
start (options: Electron.CrashReporterStartOptions) {
|
|
|
|
deprecate.log('crashReporter.start is deprecated in the renderer process. Call it from the main process instead.');
|
|
|
|
for (const [k, v] of Object.entries(options.extra || {})) {
|
|
|
|
binding.addExtraParameter(k, String(v));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getLastCrashReport (): Electron.CrashReport | null {
|
|
|
|
deprecate.log('crashReporter.getLastCrashReport is deprecated in the renderer process. Call it from the main process instead.');
|
2020-10-13 21:11:06 +00:00
|
|
|
return invokeSync(IPC_MESSAGES.CRASH_REPORTER_GET_LAST_CRASH_REPORT);
|
2020-05-07 20:31:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getUploadedReports () {
|
|
|
|
deprecate.log('crashReporter.getUploadedReports is deprecated in the renderer process. Call it from the main process instead.');
|
2020-10-13 21:11:06 +00:00
|
|
|
return invokeSync(IPC_MESSAGES.CRASH_REPORTER_GET_UPLOADED_REPORTS);
|
2020-05-07 20:31:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getUploadToServer () {
|
|
|
|
deprecate.log('crashReporter.getUploadToServer is deprecated in the renderer process. Call it from the main process instead.');
|
2020-10-13 21:11:06 +00:00
|
|
|
return invokeSync(IPC_MESSAGES.CRASH_REPORTER_GET_UPLOAD_TO_SERVER);
|
2020-05-07 20:31:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setUploadToServer (uploadToServer: boolean) {
|
|
|
|
deprecate.log('crashReporter.setUploadToServer is deprecated in the renderer process. Call it from the main process instead.');
|
2020-10-13 21:11:06 +00:00
|
|
|
return invokeSync(IPC_MESSAGES.CRASH_REPORTER_SET_UPLOAD_TO_SERVER, uploadToServer);
|
2020-05-07 20:31:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getCrashesDirectory () {
|
|
|
|
deprecate.log('crashReporter.getCrashesDirectory is deprecated in the renderer process. Call it from the main process instead.');
|
2020-10-13 21:11:06 +00:00
|
|
|
return invokeSync(IPC_MESSAGES.CRASH_REPORTER_GET_CRASHES_DIRECTORY);
|
2020-05-07 20:31:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
addExtraParameter (key: string, value: string) {
|
|
|
|
binding.addExtraParameter(key, value);
|
|
|
|
},
|
|
|
|
|
|
|
|
removeExtraParameter (key: string) {
|
|
|
|
binding.removeExtraParameter(key);
|
|
|
|
},
|
|
|
|
|
|
|
|
getParameters () {
|
|
|
|
return binding.getParameters();
|
|
|
|
}
|
|
|
|
};
|