fix: crash in sandbox on linux when getting execPath (#15701)
This commit is contained in:
parent
c8860d006b
commit
0642be296d
5 changed files with 2 additions and 12 deletions
|
@ -80,12 +80,6 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
|
||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::FilePath::StringType GetExecPath() {
|
|
||||||
base::FilePath path;
|
|
||||||
base::PathService::Get(base::FILE_EXE, &path);
|
|
||||||
return path.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
|
v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
|
||||||
v8::Local<v8::String> preloadSrc) {
|
v8::Local<v8::String> preloadSrc) {
|
||||||
auto script = v8::Script::Compile(preloadSrc);
|
auto script = v8::Script::Compile(preloadSrc);
|
||||||
|
@ -157,9 +151,7 @@ void AtomSandboxedRendererClient::InitializeBindings(
|
||||||
process.SetMethod("getIOCounters", &AtomBindings::GetIOCounters);
|
process.SetMethod("getIOCounters", &AtomBindings::GetIOCounters);
|
||||||
|
|
||||||
process.Set("argv", base::CommandLine::ForCurrentProcess()->argv());
|
process.Set("argv", base::CommandLine::ForCurrentProcess()->argv());
|
||||||
process.Set("execPath", GetExecPath());
|
|
||||||
process.SetReadOnly("pid", base::GetCurrentProcId());
|
process.SetReadOnly("pid", base::GetCurrentProcId());
|
||||||
process.Set("resourcesPath", NodeBindings::GetHelperResourcesPath());
|
|
||||||
process.SetReadOnly("sandboxed", true);
|
process.SetReadOnly("sandboxed", true);
|
||||||
process.SetReadOnly("type", "renderer");
|
process.SetReadOnly("type", "renderer");
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
|
||||||
- `pid`
|
- `pid`
|
||||||
- `arch`
|
- `arch`
|
||||||
- `platform`
|
- `platform`
|
||||||
- `resourcesPath`
|
|
||||||
- `sandboxed`
|
- `sandboxed`
|
||||||
- `type`
|
- `type`
|
||||||
- `version`
|
- `version`
|
||||||
|
|
|
@ -540,7 +540,8 @@ ipcMain.on('ELECTRON_BROWSER_SANDBOX_LOAD', function (event) {
|
||||||
platform: process.platform,
|
platform: process.platform,
|
||||||
env: process.env,
|
env: process.env,
|
||||||
version: process.version,
|
version: process.version,
|
||||||
versions: process.versions
|
versions: process.versions,
|
||||||
|
execPath: process.helperExecPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1830,7 +1830,6 @@ describe('BrowserWindow module', () => {
|
||||||
assert.strictEqual(test.platform, remote.process.platform)
|
assert.strictEqual(test.platform, remote.process.platform)
|
||||||
assert.deepStrictEqual(...resolveGetters(test.env, remote.process.env))
|
assert.deepStrictEqual(...resolveGetters(test.env, remote.process.env))
|
||||||
assert.strictEqual(test.execPath, remote.process.helperExecPath)
|
assert.strictEqual(test.execPath, remote.process.helperExecPath)
|
||||||
assert.strictEqual(test.resourcesPath, remote.process.resourcesPath)
|
|
||||||
assert.strictEqual(test.sandboxed, true)
|
assert.strictEqual(test.sandboxed, true)
|
||||||
assert.strictEqual(test.type, 'renderer')
|
assert.strictEqual(test.type, 'renderer')
|
||||||
assert.strictEqual(test.version, remote.process.version)
|
assert.strictEqual(test.version, remote.process.version)
|
||||||
|
|
1
spec/fixtures/module/preload-sandbox.js
vendored
1
spec/fixtures/module/preload-sandbox.js
vendored
|
@ -14,7 +14,6 @@
|
||||||
pid: process.pid,
|
pid: process.pid,
|
||||||
arch: process.arch,
|
arch: process.arch,
|
||||||
platform: process.platform,
|
platform: process.platform,
|
||||||
resourcesPath: process.resourcesPath,
|
|
||||||
sandboxed: process.sandboxed,
|
sandboxed: process.sandboxed,
|
||||||
type: process.type,
|
type: process.type,
|
||||||
version: process.version,
|
version: process.version,
|
||||||
|
|
Loading…
Reference in a new issue