chore: log hint on renderer crash (#25317)

This commit is contained in:
Shelley Vohr 2020-09-15 13:01:50 -06:00 committed by GitHub
parent e5933c6910
commit fa7a29e84b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -461,6 +461,11 @@ const addReturnValueToEvent = (event: any) => {
});
};
const loggingEnabled = () => {
return Object.prototype.hasOwnProperty.call(process.env, 'ELECTRON_ENABLE_LOGGING') ||
process.argv.some(arg => arg.toLowerCase().startsWith('--enable-logging'));
};
// Add JavaScript wrappers for WebContents class.
WebContents.prototype._init = function () {
// The navigation controller.
@ -543,6 +548,11 @@ WebContents.prototype._init = function () {
this.on('crashed', (event, ...args) => {
app.emit('renderer-process-crashed', event, this, ...args);
// Log out a hint to help users better debug renderer crashes.
if (loggingEnabled()) {
console.info('Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.');
}
});
this.on('render-process-gone', (event, ...args) => {