public void Execute(CallbackExecution <CefValue> execution) { CefV8Exception exception = null; using (new ContextHelper(context)) { var cefV8Values = execution.Parameters.Select(s => (CefV8Value)v8Serializer.Deserialize(s, typeof(CefV8Value))).ToArray(); var result = function.ExecuteFunction(null, cefV8Values); var browser = context.GetBrowser(); if (result == null && function.HasException) { exception = function.GetException(); function.ClearException(); } if (promiseService.IsPromise(result, context)) { promiseService.Then(result, context, a => CallbackDone(a, browser, execution.ExecutionId)); } else { CallbackDone(new PromiseResult { Success = result != null, Result = result, Error = exception?.Message }, browser, execution.ExecutionId); } } }