protected override void Execute() { var cachedFuncInfo = JavaScriptObjectRepository.RenderSideFunctions.SingleOrDefault(x => x.Id == functionId); if (cachedFuncInfo == null) { return; } var func = cachedFuncInfo.Function; var context = cachedFuncInfo.Context; var msg = BridgeMessage.Create(EVALUATE_JS_CALLBACK); msg.Arguments.Add(MessageValue.CreateInt(taskId)); context.Enter(); CefV8Value[] argumentList = null; CefV8Value result = null; try { argumentList = arguments.ToCefV8Arguments(); result = func.ExecuteFunctionWithContext(context, null, argumentList); } finally { if (argumentList != null) { foreach (var value in argumentList) { value.Dispose(); } } context.Exit(); } if (result != null) { var jsvalue = result.ToJSValue(); msg.Arguments.Add(MessageValue.CreateBool(true)); msg.Arguments.Add(MessageValue.CreateString(jsvalue.ToDefinition())); result.Dispose(); } else { msg.Arguments.Add(MessageValue.CreateBool(false)); msg.Arguments.Add(MessageValue.CreateString("Executing function failed.")); } jsbridge.SendProcessMessage(frame, msg); }