Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Handle renderer crash initialization using crash reporting preferences
Browse files Browse the repository at this point in the history
  * Turn on renderer crash handling if selected in preferences and the platform is darwin

Auditors: @bbondy, @bridiver

Test Plan:

  In previous commit
  • Loading branch information
aekeus committed Oct 7, 2016
1 parent 637a886 commit 86e6830
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions js/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

This comment has been minimized.

Copy link
@bridiver

bridiver Oct 8, 2016

Collaborator

other platforms provide renderer crashes, but only macos requires this init

This comment has been minimized.

Copy link
@aekeus

aekeus Oct 8, 2016

Author Member

Thanks for the clarification

}
}

// Notify that renderer crash reporting is disabled
const disableCrashReporting = () => {
console.log('Disabling renderer crash reporting')
}

const React = require('react')
Expand Down Expand Up @@ -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(
<Window includePinnedSites={disposition !== 'new-popup'} frames={frames} initWindowState={initWindowState} />,
Expand Down

0 comments on commit 86e6830

Please sign in to comment.