diff --git a/src/main-process/atom-window.js b/src/main-process/atom-window.js index ba090d5f807..47f41e6cb53 100644 --- a/src/main-process/atom-window.js +++ b/src/main-process/atom-window.js @@ -236,37 +236,32 @@ module.exports = class AtomWindow extends EventEmitter { if (result.response === 0) this.browserWindow.destroy(); }); - this.browserWindow.webContents.on( - 'render-process-gone', - async (event, { reason }) => { - if (reason === 'crashed') { - if (this.headless) { - console.log('Renderer process crashed, exiting'); - this.atomApplication.exit(100); - return; - } + this.browserWindow.webContents.on('render-process-gone', async () => { + if (this.headless) { + console.log('Renderer process crashed, exiting'); + this.atomApplication.exit(100); + return; + } - await this.fileRecoveryService.didCrashWindow(this); - - const result = await dialog.showMessageBox(this.browserWindow, { - type: 'warning', - buttons: ['Close Window', 'Reload', 'Keep It Open'], - cancelId: 2, // Canceling should be the least destructive action - message: 'The editor has crashed', - detail: 'Please report this issue to https://github.com/atom/atom' - }); - - switch (result.response) { - case 0: - this.browserWindow.destroy(); - break; - case 1: - this.browserWindow.reload(); - break; - } - } + await this.fileRecoveryService.didCrashWindow(this); + + const result = await dialog.showMessageBox(this.browserWindow, { + type: 'warning', + buttons: ['Close Window', 'Reload', 'Keep It Open'], + cancelId: 2, // Canceling should be the least destructive action + message: 'The editor has crashed', + detail: 'Please report this issue to https://github.com/atom/atom' + }); + + switch (result.response) { + case 0: + this.browserWindow.destroy(); + break; + case 1: + this.browserWindow.reload(); + break; } - ); + }); this.browserWindow.webContents.on('will-navigate', (event, url) => { if (url !== this.browserWindow.webContents.getURL())