Adding enableMixedSandbox api
This commit is contained in:
parent
0eaddd1565
commit
74196b96a1
3 changed files with 33 additions and 1 deletions
|
@ -1028,6 +1028,30 @@ v8::Local<v8::Value> App::GetGPUFeatureStatus(v8::Isolate* isolate) {
|
|||
status ? *status : base::DictionaryValue());
|
||||
}
|
||||
|
||||
void App::EnableMixedSandbox(mate::Arguments* args) {
|
||||
if (Browser::Get()->is_ready()) {
|
||||
args->ThrowError("app.enableMixedSandbox() can only be called "
|
||||
"before app is ready");
|
||||
return;
|
||||
}
|
||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(::switches::kNoSandbox)) {
|
||||
// Remove the --no-sandbox switch
|
||||
using StringType = base::CommandLine::StringType;
|
||||
using StringVector = base::CommandLine::StringVector;
|
||||
using CharType = base::CommandLine::CharType;
|
||||
auto argv = command_line->argv();
|
||||
StringVector modified_command_line;
|
||||
const CharType* kNoSandboxArg = L"--no-sandbox";
|
||||
for (const StringType& arg : argv) {
|
||||
if (arg.compare(kNoSandboxArg) != 0)
|
||||
modified_command_line.push_back(arg);
|
||||
}
|
||||
command_line->InitFromArgv(modified_command_line);
|
||||
}
|
||||
command_line->AppendSwitch(switches::kEnableMixedSandbox);
|
||||
}
|
||||
|
||||
// static
|
||||
mate::Handle<App> App::Create(v8::Isolate* isolate) {
|
||||
return mate::CreateHandle(isolate, new App(isolate));
|
||||
|
@ -1103,7 +1127,8 @@ void App::BuildPrototype(
|
|||
.SetMethod("getAppMetrics", &App::GetAppMetrics)
|
||||
.SetMethod("getGPUFeatureStatus", &App::GetGPUFeatureStatus)
|
||||
// TODO(juturu): Remove in 2.0, deprecate before then with warnings
|
||||
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics);
|
||||
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics)
|
||||
.SetMethod("enableMixedSandbox", &App::EnableMixedSandbox);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
|
|
@ -178,6 +178,7 @@ class App : public AtomBrowserClient::Delegate,
|
|||
|
||||
std::vector<mate::Dictionary> GetAppMetrics(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> GetGPUFeatureStatus(v8::Isolate* isolate);
|
||||
void EnableMixedSandbox(mate::Arguments* args);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Get the current Jump List settings.
|
||||
|
|
|
@ -903,6 +903,12 @@ correctly.
|
|||
|
||||
**Note:** This will not affect `process.argv`.
|
||||
|
||||
### `app.enableMixedSandbox()`
|
||||
|
||||
Enables mixed sandbox mode on the app.
|
||||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
### `app.dock.bounce([type])` _macOS_
|
||||
|
||||
* `type` String (optional) - Can be `critical` or `informational`. The default is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue