fix: add native function to create preload script (#13032)
* add native function to create preload script * add tests * fix formatting * fix tests * rerun CI
This commit is contained in:
parent
e922b1733b
commit
ffc15e02a6
4 changed files with 36 additions and 4 deletions
|
@ -81,11 +81,19 @@ base::CommandLine::StringVector GetArgv() {
|
|||
return base::CommandLine::ForCurrentProcess()->argv();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
|
||||
v8::Local<v8::String> preloadSrc) {
|
||||
auto script = v8::Script::Compile(preloadSrc);
|
||||
auto func = script->Run();
|
||||
return func;
|
||||
}
|
||||
|
||||
void InitializeBindings(v8::Local<v8::Object> binding,
|
||||
v8::Local<v8::Context> context) {
|
||||
auto* isolate = context->GetIsolate();
|
||||
mate::Dictionary b(isolate, binding);
|
||||
b.SetMethod("get", GetBinding);
|
||||
b.SetMethod("createPreloadScript", CreatePreloadScript);
|
||||
b.SetMethod("crash", AtomBindings::Crash);
|
||||
b.SetMethod("hang", AtomBindings::Hang);
|
||||
b.SetMethod("getArgv", GetArgv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue