Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: log hint on renderer crash #25473

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/browser/api/web-contents.js
Expand Up @@ -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.
Expand Down Expand Up @@ -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) => {
Expand Down