Merge pull request #8391 from electron/read-only-versions

Make process.versions.electron/chrome read-only
This commit is contained in:
Kevin Sawicki 2017-01-12 14:58:01 -08:00 committed by GitHub
commit ec71440f09
4 changed files with 14 additions and 1 deletions

2
.gitmodules vendored
View file

@ -12,7 +12,7 @@
url = https://github.com/electron/chromium-breakpad.git url = https://github.com/electron/chromium-breakpad.git
[submodule "vendor/native_mate"] [submodule "vendor/native_mate"]
path = vendor/native_mate path = vendor/native_mate
url = https://github.com/zcbenz/native-mate.git url = https://github.com/electron/native-mate.git
[submodule "vendor/crashpad"] [submodule "vendor/crashpad"]
path = vendor/crashpad path = vendor/crashpad
url = https://github.com/electron/crashpad.git url = https://github.com/electron/crashpad.git

View file

@ -112,6 +112,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
mate::Dictionary versions; mate::Dictionary versions;
if (dict.Get("versions", &versions)) { if (dict.Get("versions", &versions)) {
// TODO(kevinsawicki): Make read-only in 2.0 to match node
versions.Set(ATOM_PROJECT_NAME, ATOM_VERSION_STRING); versions.Set(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
versions.Set("chrome", CHROME_VERSION_STRING); versions.Set("chrome", CHROME_VERSION_STRING);

View file

@ -87,6 +87,10 @@ process.versions['atom-shell']
process.versions.electron process.versions.electron
``` ```
* `process.versions.electron` and `process.version.chrome` will be made
read-only properties for consistency with the other `process.versions`
properties set by Node.
## `Tray` ## `Tray`
```js ```js

View file

@ -290,4 +290,12 @@ describe('node feature', function () {
require('vm').runInNewContext('') require('vm').runInNewContext('')
}) })
}) })
it('includes the electron version in process.versions', () => {
assert(/^\d+\.\d+\.\d+$/.test(process.versions.electron))
})
it('includes the chrome version in process.versions', () => {
assert(/^\d+\.\d+\.\d+\.\d+$/.test(process.versions.chrome))
})
}) })