From 86e6830169ec00ad8902efef793d075e3f4778ed Mon Sep 17 00:00:00 2001 From: Aubrey Keus Date: Fri, 7 Oct 2016 09:04:54 -0400 Subject: [PATCH] Handle renderer crash initialization using crash reporting preferences * Turn on renderer crash handling if selected in preferences and the platform is darwin Auditors: @bbondy, @bridiver Test Plan: In previous commit --- js/entry.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/js/entry.js b/js/entry.js index d3d0f43e2cf..eb88fb00a6f 100644 --- a/js/entry.js +++ b/js/entry.js @@ -21,11 +21,21 @@ require('../less/notificationBar.less') require('../less/addEditBookmark.less') require('../node_modules/font-awesome/css/font-awesome.css') -if (process.platform === 'darwin') { - // Setup the crash handling for mac renderer processes - // https://github.com/electron/electron/blob/master/docs/api/crash-reporter.md#crashreporterstartoptions - const CrashHerald = require('../app/crash-herald') - CrashHerald.init() +// Enable or disable crash reporting based on platform +const setupCrashReporting = () => { + if (process.platform === 'darwin') { + // Setup the crash handling for mac renderer processes + // https://github.com/electron/electron/blob/master/docs/api/crash-reporter.md#crashreporterstartoptions + console.log('Renderer crash reporting initialized') + require('../app/crash-herald').init() + } else { + console.log(`Unsupported crash reporting platform ${process.platform} for renderer crashes`) + } +} + +// Notify that renderer crash reporting is disabled +const disableCrashReporting = () => { + console.log('Disabling renderer crash reporting') } const React = require('react') @@ -77,6 +87,12 @@ window.addEventListener('beforeunload', function () { // get appStore from url ipc.on(messages.INITIALIZE_WINDOW, (e, disposition, appState, frames, initWindowState) => { + // Configure renderer crash reporting + if (appState.settings[require('./constants/settings').SEND_CRASH_REPORTS] !== false) { + setupCrashReporting() + } else { + disableCrashReporting() + } appStoreRenderer.state = Immutable.fromJS(appState) ReactDOM.render( ,