public JavaScriptExecutionCallBackTask(CefFrame frame, MessageArrayValue arguments)
            {
                this.frame     = frame;
                this.arguments = arguments;

                taskId    = arguments[0].GetInt();
                isSuccess = arguments[1].GetBool();
            }
        public void Error(string text = "Invalid operation")
        {
            if (_isCalled)
            {
                throw new InvalidOperationException();
            }

            var arguments = new MessageArrayValue();

            arguments.Add(MessageValue.CreateBool(false));
            arguments.Add(MessageValue.CreateString(text));
            arguments.Add(MessageValue.CreateString($"{_uuid}"));


            CefRuntime.PostTask(CefThreadId.Renderer, new JavaScriptCommunicationBridge.RenderSideJavaScriptExecutionCallbackTask(_jsBridge, _frame, arguments));

            _isCalled = true;
        }
        public void Success(params JavaScriptValue[] retvals)
        {
            if (_isCalled)
            {
                throw new InvalidOperationException();
            }

            var retval = retvals?.ToJSValue() ?? JavaScriptValue.CreateArray();

            var arguments = new MessageArrayValue();

            arguments.Add(MessageValue.CreateBool(true));
            arguments.Add(MessageValue.CreateString(retval.ToDefinition()));
            arguments.Add(MessageValue.CreateString($"{_uuid}"));


            CefRuntime.PostTask(CefThreadId.Renderer, new JavaScriptCommunicationBridge.RenderSideJavaScriptExecutionCallbackTask(_jsBridge, _frame, arguments));

            _isCalled = true;
        }
 public JavaScriptEvaluationTask(JavaScriptCommunicationBridge bridge, CefFrame frame, MessageArrayValue arguments)
 {
     this.jsbridge = bridge;
     this.frame    = frame;
     taskId        = arguments[0].GetInt();
     code          = arguments[1].GetString();
 }
 public JavaScriptExecuteionTask(JavaScriptCommunicationBridge bridge, CefFrame frame, MessageArrayValue arguments)
 {
     this.jsbridge  = bridge;
     this.frame     = frame;
     taskId         = arguments[0].GetInt();
     functionId     = arguments[1].GetInt();
     this.arguments = JavaScriptValue.FromJson(arguments[2].GetString());
 }
        public override void OnRenderSideMessageReceived(string message, CefFrame frame, MessageArrayValue arguments)
        {
            if (message == EVALUATE_JS_CALLBACK)
            {
                CefRuntime.PostTask(CefThreadId.UI, new JavaScriptExecutionCallBackTask(frame, arguments));
            }

            if (message == JS_OBJECT_MAPPING_MESSAGE)
            {
                CefRuntime.PostTask(CefThreadId.UI, new BrowserSideJavaScriptObjectMappingTask(this, frame));
            }
        }