コード例 #1
0
        private void on_uncaught_exception(cef_render_process_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_v8context_t *context, cef_v8exception_t *exception, cef_v8stack_trace_t *stackTrace)
        {
            CheckSelf(self);

            var mBrowser    = CefBrowser.FromNative(browser);
            var mFrame      = CefFrame.FromNative(frame);
            var mContext    = CefV8Context.FromNative(context);
            var mException  = CefV8Exception.FromNative(exception);
            var mStackTrace = CefV8StackTrace.FromNative(stackTrace);

            OnUncaughtException(mBrowser, mFrame, mContext, mException, mStackTrace);
        }
コード例 #2
0
        /// <summary>
        /// Evaluates the specified JavaScript code using this context's global object.
        /// On success |retval| will be set to the return value, if any, and the
        /// function will return true. On failure |exception| will be set to the
        /// exception, if any, and the function will return false.
        /// </summary>
        public bool TryEval(string code, out CefV8Value returnValue, out CefV8Exception exception)
        {
            bool result;
            cef_v8value_t* n_retval = null;
            cef_v8exception_t* n_exception = null;

            fixed (char* code_str = code)
            {
                var n_code = new cef_string_t(code_str, code != null ? code.Length : 0);
                result = cef_v8context_t.eval(_self, &n_code, &n_retval, &n_exception) != 0;
            }

            returnValue = n_retval != null ? CefV8Value.FromNative(n_retval) : null;
            exception = n_exception != null ? CefV8Exception.FromNative(n_exception) : null;

            return result;
        }
コード例 #3
0
        /// <summary>
        /// Execute a string of JavaScript code in this V8 context. The |script_url|
        /// parameter is the URL where the script in question can be found, if any.
        /// The |start_line| parameter is the base line number to use for error
        /// reporting. On success |retval| will be set to the return value, if any, and
        /// the function will return true. On failure |exception| will be set to the
        /// exception, if any, and the function will return false.
        /// </summary>
        public bool TryEval(string code, string scriptUrl, int startLine, out CefV8Value returnValue, out CefV8Exception exception)
        {
            bool               result;
            cef_v8value_t *    n_retval    = null;
            cef_v8exception_t *n_exception = null;

            fixed(char *code_str = code)
            fixed(char *scriptUrl_str = scriptUrl)
            {
                var n_code      = new cef_string_t(code_str, code != null ? code.Length : 0);
                var n_scriptUrl = new cef_string_t(scriptUrl_str, scriptUrl != null ? scriptUrl.Length : 0);

                result = cef_v8context_t.eval(_self, &n_code, &n_scriptUrl, startLine, &n_retval, &n_exception) != 0;
            }

            returnValue = n_retval != null?CefV8Value.FromNative(n_retval) : null;

            exception = n_exception != null?CefV8Exception.FromNative(n_exception) : null;

            return(result);
        }
 /// <summary>
 /// Returns the exception resulting from the last method call. This attribute
 /// exists only in the scope of the current CEF value object.
 /// </summary>
 public CefV8Exception GetException()
 {
     return(CefV8Exception.FromNativeOrNull(
                cef_v8value_t.get_exception(_self)
                ));
 }
コード例 #5
0
 /// <summary>
 /// Called for global uncaught exceptions in a frame. Execution of this
 /// callback is disabled by default. To enable set
 /// CefSettings.uncaught_exception_stack_size &gt; 0.
 /// </summary>
 protected virtual void OnUncaughtException(CefBrowser browser, CefFrame frame, CefV8Context context, CefV8Exception exception, CefV8StackTrace stackTrace)
 {
 }
コード例 #6
0
 /// <summary>
 /// Called for global uncaught exceptions in a frame. Execution of this
 /// callback is disabled by default. To enable set
 /// CefSettings.uncaught_exception_stack_size &gt; 0.
 /// </summary>
 protected virtual void OnUncaughtException(CefBrowser browser, CefFrame frame, CefV8Context context, CefV8Exception exception, CefV8StackTrace stackTrace)
 {
 }
コード例 #7
0
ファイル: CefV8Context.cs プロジェクト: rajsite/lvcef
        /// <summary>
        /// Evaluates the specified JavaScript code using this context's global object.
        /// On success |retval| will be set to the return value, if any, and the
        /// function will return true. On failure |exception| will be set to the
        /// exception, if any, and the function will return false.
        /// </summary>
        public bool TryEval(string code, out CefV8Value returnValue, out CefV8Exception exception)
        {
            bool result;
            cef_v8value_t* n_retval = null;
            cef_v8exception_t* n_exception = null;

            fixed (char* code_str = code)
            {
                var n_code = new cef_string_t(code_str, code != null ? code.Length : 0);
                result = cef_v8context_t.eval(_self, &n_code, &n_retval, &n_exception) != 0;
            }

            returnValue = n_retval != null ? CefV8Value.FromNative(n_retval) : null;
            exception = n_exception != null ? CefV8Exception.FromNative(n_exception) : null;

            return result;
        }