Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit14cd0fec836cf228b2279da0c53ae43a32d7b1fb (patch)
Author
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-01-07 05:54:37 +0100
Committer
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-01-07 05:54:37 +0100
Files88006da4b25d1880de37cfdd1b9f19ad708135a0
goodwolf-14cd0fec836cf228b2279da0c53ae43a32d7b1fb.tar
goodwolf-14cd0fec836cf228b2279da0c53ae43a32d7b1fb.tar.gz
goodwolf-14cd0fec836cf228b2279da0c53ae43a32d7b1fb.zip
Parent588f15f4e7454f8bba04e9617e4808a07605c028 (diff)
badwolf.c: Handle web-process-terminated
1 files changed, 23 insertions, 0 deletions
-rw-r--r--badwolf.c23
diff --git a/badwolf.c b/badwolf.c
index 86c994b..13c0940 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -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);