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); }
/// <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); }
/// <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 > 0. /// </summary> protected virtual void OnUncaughtException(CefBrowser browser, CefFrame frame, CefV8Context context, CefV8Exception exception, CefV8StackTrace stackTrace) { }
/// <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) )); }