logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 920e97bd6f070862d31982c0481598194ffc8197
parent: fb531698c4e5f3c0c2f7a9151222ba8aaa6bd1e7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 17 May 2019 11:42:32 +0200

Deny on every WebView "permission-request" signal

Diffstat:

Mbadwolf.c19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -67,6 +67,9 @@ static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView, static WebKitWebView *WebViewCb_create(WebKitWebView *related_web_view, WebKitNavigationAction *navigation_action, gpointer user_data); +static gboolean WebViewCb_permission_request(WebKitWebView *web_view, + WebKitPermissionRequest *request, + gpointer user_data); static gboolean locationCb_activate(GtkEntry *location, gpointer user_data); static gboolean javascriptCb_toggled(GtkButton *javascript, gpointer user_data); static gboolean SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_data); @@ -451,6 +454,19 @@ WebViewCb_create(WebKitWebView *related_web_view, } static gboolean +WebViewCb_permission_request(WebKitWebView *web_view, + WebKitPermissionRequest *request, + gpointer user_data) +{ + (void)web_view; + (void)user_data; + + webkit_permission_request_deny(request); + + return TRUE; /* Stop other handlers */ +} + +static gboolean locationCb_activate(GtkEntry *location, gpointer user_data) { char *target_url; @@ -627,7 +643,10 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web g_signal_connect( browser->webView, "key-press-event", G_CALLBACK(WebViewCb_key_press_event), browser); g_signal_connect(browser->webView, "scroll-event", G_CALLBACK(WebViewCb_scroll_event), browser); + g_signal_connect( + browser->webView, "permission-request", G_CALLBACK(WebViewCb_permission_request), NULL); + /* signals for search widget */ g_signal_connect(browser->search, "next-match", G_CALLBACK(SearchEntryCb_next__match), browser); g_signal_connect( browser->search, "previous-match", G_CALLBACK(SearchEntryCb_previous__match), browser);