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

Commit 8633ebf

Browse files
authored
Merge pull request #5692 from bsclifton/about-brave
Fix about:brave; version information is always set (regardless of errors)
2 parents 78a2fb6 + 41dcb22 commit 8633ebf

File tree

2 files changed

+82
-19
lines changed

2 files changed

+82
-19
lines changed

app/sessionStore.js

+30-19
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,34 @@ module.exports.cleanSessionDataOnShutdown = () => {
348348
return p
349349
}
350350

351+
/**
352+
* version information (shown on about:brave)
353+
*/
354+
const setVersionInformation = (data) => {
355+
try {
356+
const os = require('os')
357+
const versionInformation = [
358+
{name: 'Brave', version: app.getVersion()},
359+
{name: 'Muon', version: process.versions['atom-shell']},
360+
{name: 'libchromiumcontent', version: process.versions['chrome']},
361+
{name: 'V8', version: process.versions.v8},
362+
{name: 'Node.js', version: process.versions.node},
363+
{name: 'Update Channel', version: Channel.channel()},
364+
{name: 'os.platform', version: os.platform()},
365+
{name: 'os.release', version: os.release()},
366+
{name: 'os.arch', version: os.arch()}
367+
// TODO(bsclifton): read the latest commit hash from a file, etc.
368+
]
369+
data.about = data.about || {}
370+
data.about.brave = {
371+
versionInformation: versionInformation
372+
}
373+
} catch (e) {
374+
console.log('ERROR calling sessionStore::setVersionInformation(): ', e)
375+
}
376+
return data
377+
}
378+
351379
/**
352380
* Loads the browser state from storage.
353381
*
@@ -434,30 +462,13 @@ module.exports.loadAppState = () => {
434462
return
435463
}
436464
}
437-
438-
// version information (shown on about:brave)
439-
const os = require('os')
440-
const versionInformation = [
441-
{name: 'Brave', version: app.getVersion()},
442-
{name: 'Muon', version: process.versions['atom-shell']},
443-
{name: 'libchromiumcontent', version: process.versions['chrome']},
444-
{name: 'V8', version: process.versions.v8},
445-
{name: 'Node.js', version: process.versions.node},
446-
{name: 'Update Channel', version: Channel.channel()},
447-
{name: 'os.platform', version: os.platform()},
448-
{name: 'os.release', version: os.release()},
449-
{name: 'os.arch', version: os.arch()}
450-
// TODO(bsclifton): read the latest commit hash from a file, etc.
451-
]
452-
data.about = data.about || {}
453-
data.about.brave = {
454-
versionInformation: versionInformation
455-
}
465+
data = setVersionInformation(data)
456466
} catch (e) {
457467
// TODO: Session state is corrupted, maybe we should backup this
458468
// corrupted value for people to report into support.
459469
console.log('could not parse data: ', data)
460470
data = exports.defaultAppState()
471+
data = setVersionInformation(data)
461472
}
462473
locale.init(data.settings[settings.LANGUAGE]).then((locale) => {
463474
app.setLocale(locale)

test/about/braveTest.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* global describe, it, before */
2+
3+
const Brave = require('../lib/brave')
4+
const {urlInput} = require('../lib/selectors')
5+
const {getTargetAboutUrl} = require('../../js/lib/appUrlUtil')
6+
7+
describe('about:brave tests', function () {
8+
Brave.beforeAll(this)
9+
before(function * () {
10+
const url = getTargetAboutUrl('about:brave')
11+
yield this.app.client
12+
.waitForUrl(Brave.newTabUrl)
13+
.waitForBrowserWindow()
14+
.waitForVisible(urlInput)
15+
.waitForExist('.tab[data-frame-key="1"]')
16+
.tabByIndex(0)
17+
.loadUrl(url)
18+
})
19+
20+
describe('when showing versions', function () {
21+
it('lists Brave', function * () {
22+
yield this.app.client
23+
.waitUntil(function () {
24+
return this.getText('table.sortableTable td[data-sort="Brave"]')
25+
.then((textValue) => {
26+
console.log(textValue)
27+
return textValue && String(textValue).length > 0 && String(textValue) !== 'null'
28+
})
29+
})
30+
})
31+
it('lists Muon', function * () {
32+
yield this.app.client
33+
.waitUntil(function () {
34+
return this.getText('table.sortableTable td[data-sort="Muon"]')
35+
.then((textValue) => {
36+
console.log(textValue)
37+
return textValue && String(textValue).length > 0 && String(textValue) !== 'null'
38+
})
39+
})
40+
})
41+
it('lists Update Channel', function * () {
42+
yield this.app.client
43+
.waitUntil(function () {
44+
return this.getText('table.sortableTable td[data-sort="Update Channel"]')
45+
.then((textValue) => {
46+
console.log(textValue)
47+
return textValue && String(textValue).length > 0 && String(textValue) !== 'null'
48+
})
49+
})
50+
})
51+
})
52+
})

0 commit comments

Comments
 (0)