feat: add process.uptime() to sandboxed renderers (#26684)
This commit is contained in:
parent
c8c41fb727
commit
14c8e000cb
4 changed files with 9 additions and 0 deletions
|
@ -90,6 +90,11 @@ v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
|
|||
preloadSrc);
|
||||
}
|
||||
|
||||
double Uptime() {
|
||||
return (base::Time::Now() - base::Process::Current().CreationTime())
|
||||
.InSecondsF();
|
||||
}
|
||||
|
||||
void InvokeHiddenCallback(v8::Handle<v8::Context> context,
|
||||
const std::string& hidden_key,
|
||||
const std::string& callback_name) {
|
||||
|
@ -137,6 +142,7 @@ void ElectronSandboxedRendererClient::InitializeBindings(
|
|||
|
||||
ElectronBindings::BindProcess(isolate, &process, metrics_.get());
|
||||
|
||||
process.SetMethod("uptime", Uptime);
|
||||
process.Set("argv", base::CommandLine::ForCurrentProcess()->argv());
|
||||
process.SetReadOnly("pid", base::GetCurrentProcId());
|
||||
process.SetReadOnly("sandboxed", true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue