Expose argv to preload process object

This commit is contained in:
Kevin Sawicki 2017-06-26 13:52:19 -07:00
parent cf392e402c
commit 14178d9826
3 changed files with 7 additions and 1 deletions

View file

@ -80,6 +80,10 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate, v8::Local<v8::String> key,
return exports;
}
base::CommandLine::StringVector GetArgv() {
return base::CommandLine::ForCurrentProcess()->argv();
}
void InitializeBindings(v8::Local<v8::Object> binding,
v8::Local<v8::Context> context) {
auto isolate = context->GetIsolate();
@ -87,6 +91,7 @@ void InitializeBindings(v8::Local<v8::Object> binding,
b.SetMethod("get", GetBinding);
b.SetMethod("crash", AtomBindings::Crash);
b.SetMethod("hang", AtomBindings::Hang);
b.SetMethod("getArgv", GetArgv);
b.SetMethod("getProcessMemoryInfo", &AtomBindings::GetProcessMemoryInfo);
b.SetMethod("getSystemMemoryInfo", &AtomBindings::GetSystemMemoryInfo);
}

View file

@ -41,6 +41,7 @@ preloadProcess.crash = () => binding.crash()
preloadProcess.hang = () => binding.hang()
preloadProcess.getProcessMemoryInfo = () => binding.getProcessMemoryInfo()
preloadProcess.getSystemMemoryInfo = () => binding.getSystemMemoryInfo()
preloadProcess.argv = binding.getArgv()
process.platform = preloadProcess.platform = electron.remote.process.platform
process.execPath = preloadProcess.execPath = electron.remote.process.execPath
process.on('exit', () => preloadProcess.emit('exit'))

View file

@ -1286,7 +1286,7 @@ describe('BrowserWindow module', function () {
})
})
it('enable-mixed-sandbox', (done) => {
it('adds --enable-sandbox to render processes created with sandbox: true', (done) => {
this.timeout(120000)
let state = 'none'