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

Commit

Permalink
Revert "use new crash reporter api"
Browse files Browse the repository at this point in the history
This reverts commit 111a46b.
  • Loading branch information
bbondy committed Oct 11, 2017
1 parent 78ea1c2 commit 7db1d67
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 114 deletions.
77 changes: 0 additions & 77 deletions app/common/tracing.js

This file was deleted.

40 changes: 13 additions & 27 deletions app/crash-herald.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const appConfig = require('../js/constants/appConfig')
const buildConfig = require('../js/constants/buildConfig')
const Channel = require('./channel')
const crashReporter = require('electron').crashReporter

const version = buildConfig.BROWSER_LAPTOP_REV || 'unknown'
const channel = Channel.channel()

const crashKeys = {
'node-env': process.env.NODE_ENV,
'_version': version,
'channel': channel
}

const initCrashKeys = () => {
for (let key in crashKeys) {
muon.crashReporter.setCrashKeyValue(key, crashKeys[key])
}
}

exports.init = (enabled) => {
initCrashKeys()
const {app} = require('electron')
// set muon-app-version switch to pass version to renderer processes
app.commandLine.appendSwitch('muon-app-version', version)
app.commandLine.appendSwitch('muon-app-channel', channel)
muon.crashReporter.setEnabled(enabled)
if (enabled) {
console.log('Crash reporting enabled')
} else {
console.log('Crash reporting disabled')
exports.init = () => {
const options = {
productName: 'Brave Developers',
companyName: 'Brave.com',
submitURL: appConfig.crashes.crashSubmitUrl,
autoSubmit: true,
extra: {
node_env: process.env.NODE_ENV,
rev: buildConfig.BROWSER_LAPTOP_REV || 'unknown'
}
}
crashReporter.start(options)
}
20 changes: 11 additions & 9 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

let ready = false

// Setup the crash handling
const CrashHerald = require('./crash-herald')
const telemetry = require('./telemetry')

Expand All @@ -19,8 +20,7 @@ const handleUncaughtError = (error) => {
message = 'Uncaught Exception:\n' + stack
console.error('An uncaught exception occurred in the main process ' + message)

muon.crashReporter.setCrashKeyValue('javascript-info', JSON.stringify({stack}))
muon.crashReporter.dumpWithoutCrashing()
// TODO(bridiver) - this should also send a notification to Brave

if (!ready) {
console.error('Waiting 60 seconds for process to load')
Expand Down Expand Up @@ -71,7 +71,6 @@ const locale = require('./locale')
const contentSettings = require('../js/state/contentSettings')
const privacy = require('../js/state/privacy')
const settings = require('../js/constants/settings')
const {getSetting} = require('../js/settings')
const BookmarksExporter = require('./browser/bookmarksExporter')
const siteUtil = require('../js/state/siteUtil')

Expand All @@ -97,15 +96,18 @@ let loadAppStatePromise = SessionStore.loadAppState()

// Some settings must be set right away on startup, those settings should be handled here.
loadAppStatePromise.then((initialImmutableState) => {
const {HARDWARE_ACCELERATION_ENABLED, SMOOTH_SCROLL_ENABLED, SEND_CRASH_REPORTS} = require('../js/constants/settings')
CrashHerald.init(getSetting(SEND_CRASH_REPORTS, initialImmutableState.get('settings')))

telemetry.setCheckpointAndReport('state-loaded')
if (getSetting(HARDWARE_ACCELERATION_ENABLED, initialImmutableState.get('settings')) === false) {
const {HARDWARE_ACCELERATION_ENABLED, SMOOTH_SCROLL_ENABLED, SEND_CRASH_REPORTS} = require('../js/constants/settings')
if (initialImmutableState.getIn(['settings', HARDWARE_ACCELERATION_ENABLED]) === false) {
app.disableHardwareAcceleration()
}

if (getSetting(SMOOTH_SCROLL_ENABLED, initialImmutableState.get('settings')) === false) {
if (initialImmutableState.getIn(['settings', SEND_CRASH_REPORTS]) !== false) {
console.log('Crash reporting enabled')
CrashHerald.init()
} else {
console.log('Crash reporting disabled')
}
if (initialImmutableState.getIn(['settings', SMOOTH_SCROLL_ENABLED]) === false) {
app.commandLine.appendSwitch('disable-smooth-scrolling')
}
})
Expand Down
4 changes: 4 additions & 0 deletions js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {getTargetAboutUrl} = require('../lib/appUrlUtil')
// BRAVE_UPDATE_HOST should be set to the host name for the auto-updater server
const updateHost = process.env.BRAVE_UPDATE_HOST || 'https://brave-laptop-updates.global.ssl.fastly.net'
const winUpdateHost = process.env.BRAVE_WIN_UPDATE_HOST || 'https://brave-download.global.ssl.fastly.net'
const crashURL = process.env.BRAVE_CRASH_URL || 'https://brave-laptop-updates.herokuapp.com/1/crashes'
const adHost = process.env.AD_HOST || 'https://oip.brave.com'
const isTest = process.env.NODE_ENV === 'test'

Expand Down Expand Up @@ -90,6 +91,9 @@ module.exports = {
enabled: false,
url: adHost
},
crashes: {
crashSubmitUrl: crashURL
},
payments: {
delayNotificationTryPayments: 1000 * 60 * 60 * 24 * 10 // 10 days (from firstRunTimestamp)
},
Expand Down
2 changes: 1 addition & 1 deletion tools/utilAppRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function runUtilApp (cmd, file, stdioOptions) {
}
cmd = cmd.split(' ')
if (process.env.NODE_ENV === 'development') {
cmd.push('--user-data-dir-name=brave-development')
cmd.push('--user-data-dir=brave-development')
}
const utilApp = proc.spawnSync('electron', [utilAppDir].concat(cmd), options)
if (utilApp.error) {
Expand Down

0 comments on commit 7db1d67

Please sign in to comment.