From ff9085b40038be5da112f77af3f4dfae66c860aa Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 28 Feb 2009 23:46:41 +0100 Subject: [PATCH] Disable WebKit's authentication dialog if needed We need to handle WebKit possibly having an authentication dialog more expressly. Obviously we only ever want to see one dialog and we choose our own simply because it is localized. --- katze/katze-http-auth.c | 23 +++++++++++++++++++++-- midori/main.c | 5 +---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/katze/katze-http-auth.c b/katze/katze-http-auth.c index fd15d87c..4e4cd8a1 100644 --- a/katze/katze-http-auth.c +++ b/katze/katze-http-auth.c @@ -161,11 +161,28 @@ katze_http_auth_session_authenticate_cb (SoupSession* session, } static void -katze_http_auth_attach (SoupSessionFeature* feature, - SoupSession* session) +katze_http_auth_session_request_queued_cb (SoupSession* session, + SoupMessage* msg, + gpointer data) { + /* WebKit has its own authentication dialog in recent versions. + We want only one, and we choose our own to have localization. */ + GType type = g_type_from_name ("WebKitSoupAuthDialog"); + if (type) + soup_session_remove_feature_by_type (session, type); + g_signal_connect (session, "authenticate", G_CALLBACK (katze_http_auth_session_authenticate_cb), NULL); + g_signal_handlers_disconnect_by_func (session, + katze_http_auth_session_request_queued_cb, NULL); +} + +static void +katze_http_auth_attach (SoupSessionFeature* feature, + SoupSession* session) +{ + g_signal_connect (session, "request-queued", + G_CALLBACK (katze_http_auth_session_request_queued_cb), NULL); } static void @@ -174,6 +191,8 @@ katze_http_auth_detach (SoupSessionFeature* feature, { g_signal_handlers_disconnect_by_func (session, katze_http_auth_session_authenticate_cb, NULL); + g_signal_handlers_disconnect_by_func (session, + katze_http_auth_session_request_queued_cb, NULL); } static void diff --git a/midori/main.c b/midori/main.c index c474f6a5..bf2eceae 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1354,10 +1354,7 @@ soup_session_constructed_cb (GObject* object) g_signal_connect (settings, "notify::ident-string", G_CALLBACK (soup_session_settings_notify_ident_string_cb), object); - /* Only add the Auth feature if WebKit didn't already */ - if (!g_signal_has_handler_pending (session, - g_signal_lookup ("authenticate", SOUP_TYPE_SESSION), 0, FALSE)) - soup_session_add_feature_by_type (session, KATZE_TYPE_HTTP_AUTH); + soup_session_add_feature_by_type (session, KATZE_TYPE_HTTP_AUTH); midori_soup_session_debug (session); feature = g_object_new (KATZE_TYPE_HTTP_COOKIES, NULL); -- 2.39.5