From 4b533d2f5198b3e2036da15c456563fdd5807c77 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 12 Sep 2012 00:33:54 +0200 Subject: [PATCH] Give readable names to numeric debug tokens --- INSTALL | 6 +++--- extensions/adblock.c | 6 +++--- midori/main.c | 14 +++++--------- midori/midori-app.c | 4 ++-- midori/midori-view.c | 2 +- midori/midori-websettings.c | 4 ++-- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/INSTALL b/INSTALL index 66bbc7de..f65e7a82 100644 --- a/INSTALL +++ b/INSTALL @@ -53,9 +53,9 @@ If the problem is a warning and not a crash, try this: If you are interested in HTTP communication, try this: -'MIDORI_DEBUG=soup:2 _build/default/midori/midori' +'MIDORI_DEBUG=headers _build/default/midori/midori' -Where '2' can be a level between 1 and 3. +Where 'headers' can be replaced with 'body' to get full message contents. If you are interested in (non-) touchscreen behaviour, try this: @@ -65,7 +65,7 @@ If you are interested in (non-) touchscreen behaviour, try this: If you want to "dry run" without WebKitGTK+ rendering, try this: -'MIDORI_UNARMED=1 _build/default/midori/midori' +'MIDORI_DEBUG=unarmed _build/default/midori/midori' If you want to test bookmarks, you can enable database tracing: diff --git a/extensions/adblock.c b/extensions/adblock.c index 5ed32583..15f465d1 100644 --- a/extensions/adblock.c +++ b/extensions/adblock.c @@ -30,7 +30,7 @@ (__filter[4] != '-' && __filter[5] != '-') #ifdef G_ENABLE_DEBUG #define adblock_debug(dmsg, darg1, darg2) \ - do { if (midori_debug ("adblock:1")) g_debug (dmsg, darg1, darg2); } while (0) + do { if (midori_debug ("adblock:match")) g_debug (dmsg, darg1, darg2); } while (0) #else #define adblock_debug(dmsg, darg1, darg2) /* nothing */ #endif @@ -903,7 +903,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view, } #ifdef G_ENABLE_DEBUG - if (midori_debug ("adblock:2")) + if (midori_debug ("adblock:time")) g_test_timer_start (); #endif if (adblock_is_matched (req_uri, page_uri)) @@ -914,7 +914,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view, g_object_set_data (G_OBJECT (web_view), "blocked-uris", blocked_uris); } #ifdef G_ENABLE_DEBUG - if (midori_debug ("adblock:2")) + if (midori_debug ("adblock:time")) g_debug ("match: %f%s", g_test_timer_elapsed (), "seconds"); #endif diff --git a/midori/main.c b/midori/main.c index 584458a3..e17f7286 100644 --- a/midori/main.c +++ b/midori/main.c @@ -905,8 +905,6 @@ midori_soup_session_settings_accept_language_cb (SoupSession* session, MidoriWebSettings* settings) { const gchar* accept = midori_web_settings_get_accept_language (settings); - if (midori_debug ("soup")) - g_message ("Accept-Language set to '%s'", accept); soup_message_headers_append (msg->request_headers, "Accept-Language", accept); if (katze_object_get_boolean (settings, "strip-referer")) @@ -925,7 +923,7 @@ midori_soup_session_settings_accept_language_cb (SoupSession* session, soup_uri_free (stripped_uri); if (strcmp (stripped_referer, referer)) { - if (midori_debug ("soup")) + if (midori_debug ("referer")) g_message ("Referer '%s' stripped to '%s'", referer, stripped_referer); soup_message_headers_replace (msg->request_headers, "Referer", stripped_referer); @@ -943,12 +941,10 @@ static void midori_soup_session_debug (SoupSession* session) { gint soup_debug_level = 0; - if (midori_debug ("soup:1")) - soup_debug_level = 1; - else if (midori_debug ("soup:2")) - soup_debug_level = 2; - else if (midori_debug ("soup:3")) - soup_debug_level = 3; + if (midori_debug ("headers")) + soup_debug_level = SOUP_LOGGER_LOG_HEADERS; + else if (midori_debug ("body")) + soup_debug_level = SOUP_LOGGER_LOG_BODY; if (soup_debug_level > 0) { SoupLogger* logger = soup_logger_new (soup_debug_level, -1); diff --git a/midori/midori-app.c b/midori/midori-app.c index e8256bf6..e6b5a200 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -1460,8 +1460,8 @@ midori_debug (const gchar* token) { static const gchar* debug_token = NULL; const gchar* debug = g_getenv ("MIDORI_DEBUG"); - const gchar* debug_tokens = "soup soup:1 soup:2 soup:3 cookies paths hsts "; - const gchar* full_debug_tokens = "adblock:1 adblock:2 startup bookmarks "; + const gchar* debug_tokens = "headers body referer cookies paths hsts unarmed "; + const gchar* full_debug_tokens = "adblock:match adblock:time startup bookmarks "; if (debug_token == NULL) { gchar* found_token; diff --git a/midori/midori-view.c b/midori/midori-view.c index ebe8693f..21b42b86 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -4230,7 +4230,7 @@ midori_view_set_uri (MidoriView* view, g_warning ("Calling %s() before adding the view to a browser. This " "breaks extensions that monitor page loading.", G_STRFUNC); - if (g_getenv ("MIDORI_UNARMED") == NULL) + if (!midori_debug ("unarmed")) { if (!uri || !strcmp (uri, "") || !strcmp (uri, "about:blank")) { diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index 11b82838..331de5b0 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -12,6 +12,7 @@ #include "midori-websettings.h" +#include "midori-app.h" #include "sokoke.h" #include /* Vala API */ @@ -581,8 +582,7 @@ midori_web_settings_has_plugin_support (void) #if !WEBKIT_CHECK_VERSION (1, 8, 2) && defined G_OS_WIN32 return FALSE; #else - return g_getenv ("MIDORI_UNARMED") == NULL - && g_strcmp0 (g_getenv ("MOZ_PLUGIN_PATH"), "/"); + return !midori_debug ("unarmed") && g_strcmp0 (g_getenv ("MOZ_PLUGIN_PATH"), "/"); #endif } -- 2.39.5