Fix process.execPath returning parent process path instead of the helper in sandboxed renderer (#13839)
This commit is contained in:
parent
aacbd76baa
commit
db38c8b620
6 changed files with 35 additions and 8 deletions
|
@ -12,8 +12,10 @@
|
|||
#include "atom/common/options_switches.h"
|
||||
#include "atom/renderer/api/atom_api_renderer_ipc.h"
|
||||
#include "atom/renderer/atom_render_frame_observer.h"
|
||||
#include "base/base_paths.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/renderer/printing/print_web_view_helper.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
@ -81,6 +83,12 @@ base::CommandLine::StringVector GetArgv() {
|
|||
return base::CommandLine::ForCurrentProcess()->argv();
|
||||
}
|
||||
|
||||
base::FilePath::StringType GetExecPath() {
|
||||
base::FilePath path;
|
||||
PathService::Get(base::FILE_EXE, &path);
|
||||
return path.value();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
|
||||
v8::Local<v8::String> preloadSrc) {
|
||||
auto script = v8::Script::Compile(preloadSrc);
|
||||
|
@ -97,6 +105,7 @@ void InitializeBindings(v8::Local<v8::Object> binding,
|
|||
b.SetMethod("crash", AtomBindings::Crash);
|
||||
b.SetMethod("hang", AtomBindings::Hang);
|
||||
b.SetMethod("getArgv", GetArgv);
|
||||
b.SetMethod("getExecPath", GetExecPath);
|
||||
b.SetMethod("getHeapStatistics", &AtomBindings::GetHeapStatistics);
|
||||
b.SetMethod("getProcessMemoryInfo", &AtomBindings::GetProcessMemoryInfo);
|
||||
b.SetMethod("getSystemMemoryInfo", &AtomBindings::GetSystemMemoryInfo);
|
||||
|
@ -105,7 +114,7 @@ void InitializeBindings(v8::Local<v8::Object> binding,
|
|||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(switches::kGuestInstanceID))
|
||||
b.Set(options::kGuestInstanceID,
|
||||
command_line->GetSwitchValueASCII(switches::kGuestInstanceID));
|
||||
command_line->GetSwitchValueASCII(switches::kGuestInstanceID));
|
||||
}
|
||||
|
||||
class AtomSandboxedRenderFrameObserver : public AtomRenderFrameObserver {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue