diff options
badwolf.c: Handle web-process-terminated
1 files changed, 23 insertions, 0 deletions
| -rw-r--r-- | badwolf.c | 23 |
@@ -11,6 +11,28 @@ static gboolean WebViewCb_close(WebKitWebView *_webView, GtkWidget *window) return TRUE; } +static gboolean WebViewCb_web_process_terminated(WebKitWebView *web_view, WebKitWebProcessTerminationReason reason, gpointer user_data) +{ + char *str_reason; + + switch(reason) { + case WEBKIT_WEB_PROCESS_CRASHED: + str_reason = "the web process crashed."; + break; + ;; + case WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT: + str_reason = "the web process exceeded the memory limit."; + break; + ;; + default: + str_reason = "the web process terminated for an unknown reason."; + ;; + } + + fprintf(stderr, "BadWolf [signal: web-process-terminated]: %s", str_reason); + return TRUE; +} + static gboolean WebViewCb_notify__uri(WebKitWebView *webView, GtkWidget *location) { const gchar *location_uri; @@ -45,6 +67,7 @@ int main(int argc, char *argv[]) g_signal_connect(main_window, "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(webView, "close", G_CALLBACK(WebViewCb_close), main_window); + g_signal_connect(webView, "web-process-terminated", G_CALLBACK(WebViewCb_web_process_terminated), NULL); g_signal_connect(webView, "notify::uri", G_CALLBACK(WebViewCb_notify__uri), location); WebKitSettings *settings = webkit_web_view_get_settings(webView); |