fix: make certain values on process read-only (#15628)

* docs: Add 'worker' as a possible value for `process.type`

* fix: make certain properties on `process` read only:

* `mas`
* `windowsStore`
* `versions.electron`
* `versions.chrome`
* `type`
* `pid`
* `sandboxed`
This commit is contained in:
Michelle Tilley 2018-11-08 06:28:06 -08:00 committed by John Kleinschmidt
parent 4e53019b75
commit 2a8e8a0603
4 changed files with 11 additions and 12 deletions

View file

@ -72,19 +72,18 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process) {
base::Unretained(this)));
#if defined(MAS_BUILD)
dict.Set("mas", true);
dict.SetReadOnly("mas", true);
#endif
#if defined(OS_WIN)
if (IsRunningInDesktopBridge())
dict.Set("windowsStore", true);
dict.SetReadOnly("windowsStore", true);
#endif
mate::Dictionary 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("chrome", CHROME_VERSION_STRING);
versions.SetReadOnly(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
versions.SetReadOnly("chrome", CHROME_VERSION_STRING);
}
}