electron-17: changed logic to use the electron crash reporter directly in all the processes

This commit is contained in:
Vishwas Shashidhar 2017-09-18 21:17:45 +05:30
parent a1c2de3621
commit 511d616e74
3 changed files with 9 additions and 26 deletions

View File

@ -3,6 +3,7 @@
// Third Party Dependencies
const electron = require('electron');
const app = electron.app;
const crashReporter = electron.crashReporter;
const nodeURL = require('url');
const squirrelStartup = require('electron-squirrel-startup');
const AutoLaunch = require('auto-launch');
@ -13,7 +14,6 @@ const {getConfigField, updateUserConfigWin, updateUserConfigMac} = require('./co
const { isMac, isDevEnv } = require('./utils/misc.js');
const protocolHandler = require('./protocolHandler');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
const crashReporter = require('./crashReporter');
require('electron-dl')();
@ -32,6 +32,8 @@ require('./memoryMonitor.js');
const windowMgr = require('./windowMgr.js');
crashReporter.start({companyName: 'Symphony', uploadToServer: false, submitURL: 'http://localhost:3000/', extra: {'process': 'main'}});
// only allow a single instance of app.
const shouldQuit = app.makeSingleInstance((argv) => {
// Someone tried to run a second instance, we should focus our window.
@ -214,21 +216,6 @@ function createWin(urlFromConfig) {
windowMgr.createMainWindow(url);
}
/**
* Get crash info from global config and setup crash reporter for Main Process.
*/
function initializeCrashReporter () {
getConfigField('crashReporterDetails').then(
function (data) {
crashReporter.setCrashReporterDetails(data);
crashReporter.setupCrashReporter({'window': 'main'});
}
).catch(function (err) {
let title = 'Error loading configuration';
electron.dialog.showErrorBox(title, title + ': ' + err);
});
}
/**
* processes protocol action for windows clients
* @param argv {Array} an array of command line arguments
@ -269,7 +256,4 @@ function handleProtocolAction(uri) {
// app is already open, so, just trigger the protocol action method
protocolHandler.processProtocolAction(uri);
}
}
// Initialize the crash reporter
initializeCrashReporter();
}

View File

@ -11,14 +11,13 @@
// also to bring pieces of node.js:
// https://github.com/electron/electron/issues/2984
//
const { ipcRenderer, remote } = require('electron');
const { ipcRenderer, remote, crashReporter } = require('electron');
const throttle = require('../utils/throttle.js');
const apiEnums = require('../enums/api.js');
const apiCmds = apiEnums.cmds;
const apiName = apiEnums.apiName;
const getMediaSources = require('../desktopCapturer/getSources');
const crashReporter = require('../crashReporter');
require('../downloadManager');
@ -54,7 +53,7 @@ const throttledSetBadgeCount = throttle(1000, function(count) {
});
});
crashReporter.setupCrashReporter({'window': 'preloadMain'});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, submitURL: 'http://localhost:3000/', extra: {'process': 'preload script / renderer'}});
createAPI();
// creates API exposed from electron.

View File

@ -2,6 +2,7 @@
const electron = require('electron');
const app = electron.app;
const crashReporter = electron.crashReporter;
const BrowserWindow = electron.BrowserWindow;
const path = require('path');
const nodeURL = require('url');
@ -19,7 +20,6 @@ const eventEmitter = require('./eventEmitter');
const throttle = require('./utils/throttle.js');
const { getConfigField, updateConfigField } = require('./config.js');
const { isMac, isNodeEnv } = require('./utils/misc');
const crashReporter = require('./crashReporter');
// show dialog when certificate errors occur
require('./dialogs/showCertError.js');
@ -81,7 +81,7 @@ function createMainWindow(initialUrl) {
// failed, use default bounds
doCreateMainWindow(initialUrl, null);
}
)
);
}
/**
@ -93,7 +93,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
let url = initialUrl;
let key = getGuid();
crashReporter.setupCrashReporter({'window': 'windowMgr'});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, submitURL: 'http://localhost:3000/', extra: {'process': 'renderer / window manager'}});
log.send(logLevels.INFO, 'creating main window url: ' + url);
let newWinOpts = {