| 22 | } |
| 23 | |
| 24 | static void EvalWithPath(const v8::FunctionCallbackInfo<v8::Value>& Info) |
| 25 | { |
| 26 | v8::Isolate* Isolate = Info.GetIsolate(); |
| 27 | v8::Isolate::Scope IsolateScope(Isolate); |
| 28 | v8::HandleScope HandleScope(Isolate); |
| 29 | v8::Local<v8::Context> Context = Isolate->GetCurrentContext(); |
| 30 | v8::Context::Scope ContextScope(Context); |
| 31 | |
| 32 | if (Info.Length() != 2 || !Info[0]->IsString() || !Info[1]->IsString()) |
| 33 | { |
| 34 | FV8Utils::ThrowException(Isolate, "invalid argument for evalScript"); |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | v8::Local<v8::String> Source = Info[0]->ToString(Context).ToLocalChecked(); |
| 39 | v8::Local<v8::String> Name = Info[1]->ToString(Context).ToLocalChecked(); |
| 40 | v8::ScriptOrigin Origin(Name); |
| 41 | auto Script = v8::Script::Compile(Context, Source, &Origin); |
| 42 | if (Script.IsEmpty()) |
| 43 | { |
| 44 | return; |
| 45 | } |
| 46 | auto Result = Script.ToLocalChecked()->Run(Context); |
| 47 | if (Result.IsEmpty()) |
| 48 | { |
| 49 | return; |
| 50 | } |
| 51 | Info.GetReturnValue().Set(Result.ToLocalChecked()); |
| 52 | } |
| 53 | |
| 54 | void JSEngine::JSEngineWithNode() |
| 55 | { |
nothing calls this directly
no test coverage detected