mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: log hint on renderer crash (#25473)
* chore: log hint on renderer crash * Address feedback from review Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -459,6 +459,11 @@ const addReturnValueToEvent = (event) => {
|
||||
});
|
||||
};
|
||||
|
||||
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.
|
||||
@@ -525,6 +530,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) => {
|
||||
|
||||
Reference in New Issue
Block a user