electron-17: added an event to capture a renderer crash for child windows and initialized the crash reporter there too.

This commit is contained in:
Vishwas Shashidhar 2017-09-25 16:10:03 +05:30
parent a647c0d3cd
commit 40cf6b6d73
3 changed files with 23 additions and 3 deletions

View File

@ -32,7 +32,7 @@ require('./memoryMonitor.js');
const windowMgr = require('./windowMgr.js');
crashReporter.start({companyName: 'Symphony', uploadToServer: false, extra: {'process': 'main'}});
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'main'}});
// only allow a single instance of app.
const shouldQuit = app.makeSingleInstance((argv) => {

View File

@ -53,7 +53,7 @@ const throttledSetBadgeCount = throttle(1000, function(count) {
});
});
crashReporter.start({companyName: 'Symphony', uploadToServer: false, extra: {'process': 'preload script / renderer'}});
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'preload script / renderer'}});
createAPI();
// creates API exposed from electron.

View File

@ -93,7 +93,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
let url = initialUrl;
let key = getGuid();
crashReporter.start({companyName: 'Symphony', uploadToServer: false, extra: {'process': 'renderer / window manager'}});
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'renderer / main window'}});
log.send(logLevels.INFO, 'creating main window url: ' + url);
let newWinOpts = {
@ -336,6 +336,8 @@ function doCreateMainWindow(initialUrl, initialBounds) {
if (browserWin) {
log.send(logLevels.INFO, 'loaded pop-out window url: ' + newWinParsedUrl);
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'renderer / pop out window - winKey -> ' + newWinKey}});
browserWin.winName = frameName;
browserWin.setAlwaysOnTop(alwaysOnTop);
@ -345,6 +347,24 @@ function doCreateMainWindow(initialUrl, initialBounds) {
browserWin.removeListener('resize', throttledBoundsChange);
});
browserWin.webContents.on('crashed', function () {
const options = {
type: 'error',
title: 'Renderer Process Crashed',
message: 'Oops! Looks like we have had a crash. Please reload or close this window.',
buttons: ['Reload', 'Close']
};
electron.dialog.showMessageBox(options, function (index) {
if (index === 0) {
mainWindow.reload();
}
else {
mainWindow.close();
}
});
});
addWindowKey(newWinKey, browserWin);
// throttle changes so we don't flood client.