Expose argv to preload process object
This commit is contained in:
parent
cf392e402c
commit
14178d9826
3 changed files with 7 additions and 1 deletions
|
@ -80,6 +80,10 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate, v8::Local<v8::String> key,
|
||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::CommandLine::StringVector GetArgv() {
|
||||||
|
return base::CommandLine::ForCurrentProcess()->argv();
|
||||||
|
}
|
||||||
|
|
||||||
void InitializeBindings(v8::Local<v8::Object> binding,
|
void InitializeBindings(v8::Local<v8::Object> binding,
|
||||||
v8::Local<v8::Context> context) {
|
v8::Local<v8::Context> context) {
|
||||||
auto isolate = context->GetIsolate();
|
auto isolate = context->GetIsolate();
|
||||||
|
@ -87,6 +91,7 @@ void InitializeBindings(v8::Local<v8::Object> binding,
|
||||||
b.SetMethod("get", GetBinding);
|
b.SetMethod("get", GetBinding);
|
||||||
b.SetMethod("crash", AtomBindings::Crash);
|
b.SetMethod("crash", AtomBindings::Crash);
|
||||||
b.SetMethod("hang", AtomBindings::Hang);
|
b.SetMethod("hang", AtomBindings::Hang);
|
||||||
|
b.SetMethod("getArgv", GetArgv);
|
||||||
b.SetMethod("getProcessMemoryInfo", &AtomBindings::GetProcessMemoryInfo);
|
b.SetMethod("getProcessMemoryInfo", &AtomBindings::GetProcessMemoryInfo);
|
||||||
b.SetMethod("getSystemMemoryInfo", &AtomBindings::GetSystemMemoryInfo);
|
b.SetMethod("getSystemMemoryInfo", &AtomBindings::GetSystemMemoryInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ preloadProcess.crash = () => binding.crash()
|
||||||
preloadProcess.hang = () => binding.hang()
|
preloadProcess.hang = () => binding.hang()
|
||||||
preloadProcess.getProcessMemoryInfo = () => binding.getProcessMemoryInfo()
|
preloadProcess.getProcessMemoryInfo = () => binding.getProcessMemoryInfo()
|
||||||
preloadProcess.getSystemMemoryInfo = () => binding.getSystemMemoryInfo()
|
preloadProcess.getSystemMemoryInfo = () => binding.getSystemMemoryInfo()
|
||||||
|
preloadProcess.argv = binding.getArgv()
|
||||||
process.platform = preloadProcess.platform = electron.remote.process.platform
|
process.platform = preloadProcess.platform = electron.remote.process.platform
|
||||||
process.execPath = preloadProcess.execPath = electron.remote.process.execPath
|
process.execPath = preloadProcess.execPath = electron.remote.process.execPath
|
||||||
process.on('exit', () => preloadProcess.emit('exit'))
|
process.on('exit', () => preloadProcess.emit('exit'))
|
||||||
|
|
|
@ -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)
|
this.timeout(120000)
|
||||||
|
|
||||||
let state = 'none'
|
let state = 'none'
|
||||||
|
|
Loading…
Reference in a new issue