Re: [Patch] Fix html rendering for webkit2gtk-4.0 < 2.20 (was: GIT version - no display of html messages)
Albrecht Dreß <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.balsa |
|---|---|
| Message-ID | <[email protected]> |
Ummm, now *with* the patch… Am 07.07.18 20:57 schrieb(en) Albrecht Dreß: > Hi all, > > attached is a patch which fixes broken html rendering for webkit2gtk-4.0 < 2.20. I was able to reproduce the issue on Debian Jessie (webkit2gtk-4.0 2.6.2) and Stretch (webkit2gtk-4.0 2.18.6). > > The trick is that we must allow the rendering of “about:blank” which is simple – an empty page. It doesn't make much sense (which may be the reason that it just works with newer versions…). > > The patch also changes the compile-time debugging to a new GLog domain, and updates the README file to list the available log domains. > > Am 07.07.18 19:28 schrieb(en) Jack via balsa-list: >>> Hmmm, this indicates that the second approach (the “if (g_ascii_strcasecmp(uri, "about:blank") != 0)…” variant) may fix your issue, /without/ removing the EFail mitigation. >> Yes, this does now work for me. Again, for info, what SHOULD that URI be? Should it be anything for the basic message itself, on only something for a link within the message? > > See above - just an empty page. I guess older webkit versions needed to open about:blank to somehow initialise the rendering or an internal state. Apparently, this doesn't make much sense, so it looks as if it has been removed. Really strange! > > Thanks for your help in tracking down this issue, > Albrecht. _______________________________________________ balsa-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/balsa-list
fix_old_webkit.diff
(text/x-patch, 5.9 KB)
diff --git a/README b/README
index 0db1bc8ea..701edd88e 100644
--- a/README
+++ b/README
@@ -235,6 +235,20 @@ directory. It should contain the following:
filename=/path/to/your/browser
+Debugging:
+---------
+Set the environment variable G_MESSAGES_DEBUG to print debugging
+information to the console. The value shall be either a space-
+separated list of log domains, or the special value "all". The
+following custom domains are implemented in Balsa:
+- libnetclient: low-level network IO. Warning: the output may contain
+ plain-text passwords.
+- imap: IMAP server interaction. Warning: the output may contain
+ plain-text passwords.
+- crypto: GnuPG and S/MIME crypto operations
+- html: HTML rendering with webkit2
+
+
Reporting Bugs:
--------------
See http://balsa.gnome.org/bugs.html for instructions.
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 17f62789e..3c9b9a2f0 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -46,6 +46,11 @@
#ifdef HAVE_HTML_WIDGET
+#ifdef G_LOG_DOMAIN
+# undef G_LOG_DOMAIN
+#endif
+#define G_LOG_DOMAIN "html"
+
/*
* Used by all HTML widgets
*
@@ -141,7 +146,7 @@ html2text(gchar ** text, gsize len)
* Experimental support for WebKit2.
*/
-#define DEBUG_WEBKIT2 FALSE
+#define DEBUG_WEBKIT2 TRUE
#if DEBUG_WEBKIT2
#define d(x) x
#else
@@ -280,11 +285,15 @@ lbh_navigation_policy_decision(WebKitPolicyDecision * decision,
switch (navigation_type) {
case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED:
- d(g_print("%s clicked %s\n", __func__, uri));
+ g_debug("%s clicked %s", __func__, uri);
(*info->clicked_cb) (uri);
default:
- d(g_print("%s uri %s, type %d, ignored\n", __func__, uri, navigation_type));
- webkit_policy_decision_ignore(decision);
+ if (g_ascii_strcasecmp(uri, "about:blank") != 0) {
+ g_debug("%s uri %s, type %d, ignored", __func__, uri, navigation_type);
+ webkit_policy_decision_ignore(decision);
+ } else {
+ g_debug("%s uri %s, type %d loaded", __func__, uri, navigation_type);
+ }
}
}
@@ -305,13 +314,13 @@ lbh_new_window_policy_decision(WebKitPolicyDecision * decision,
(navigation_action)) {
case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED:
request = webkit_navigation_action_get_request(navigation_action);
- d(g_print("%s clicked %s\n", __func__,
- webkit_uri_request_get_uri(request)));
+ g_debug("%s clicked %s", __func__,
+ webkit_uri_request_get_uri(request));
(*info->clicked_cb) (webkit_uri_request_get_uri(request));
default:
- d(g_print("%s type %d, ignored\n", __func__,
+ g_debug("%s type %d, ignored", __func__,
webkit_navigation_action_get_navigation_type
- (navigation_action)));
+ (navigation_action));
webkit_policy_decision_ignore(decision);
}
@@ -321,10 +330,10 @@ static void
lbh_response_policy_decision(WebKitPolicyDecision * decision,
gpointer data)
{
- d(g_print("%s uri %s, ignored\n", __func__,
+ g_debug("%s uri %s, ignored", __func__,
webkit_uri_request_get_uri
(webkit_response_policy_decision_get_request
- (WEBKIT_RESPONSE_POLICY_DECISION(decision)))));
+ (WEBKIT_RESPONSE_POLICY_DECISION(decision))));
webkit_policy_decision_ignore(decision);
}
@@ -453,20 +462,20 @@ lbh_resource_notify_response_cb(WebKitWebResource * resource,
response = webkit_web_resource_get_response(resource);
mime_type = webkit_uri_response_get_mime_type(response);
- d(g_print("%s mime-type %s\n", __func__, mime_type));
+ g_debug("%s mime-type %s", __func__, mime_type);
if (g_ascii_strncasecmp(mime_type, "image/", 6) != 0)
return;
if (info->info_bar) {
- d(g_print("%s %s destroy info_bar\n", __func__,
- webkit_web_resource_get_uri(resource)));
+ g_debug("%s %s destroy info_bar", __func__,
+ webkit_web_resource_get_uri(resource));
/* web_view is loading an image from its cache, so we do not
* need to ask the user for permission to download */
gtk_widget_destroy(info->info_bar);
info->info_bar = NULL;
} else {
- d(g_print("%s %s null info_bar\n", __func__,
- webkit_web_resource_get_uri(resource)));
+ g_debug("%s %s null info_bar", __func__,
+ webkit_web_resource_get_uri(resource));
}
}
@@ -493,7 +502,7 @@ static gboolean
lbh_web_process_crashed_cb(WebKitWebView * web_view,
gpointer data)
{
- d(g_print("%s\n", __func__));
+ g_debug("%s", __func__);
return FALSE;
}
@@ -509,7 +518,7 @@ lbh_cid_cb(WebKitURISchemeRequest * request,
LibBalsaMessageBody *body;
path = webkit_uri_scheme_request_get_path(request);
- d(g_print("%s path %s\n", __func__, path));
+ g_debug("%s path %s", __func__, path);
if ((body =
libbalsa_message_get_part_by_id(info->body->message, path))) {
@@ -616,7 +625,7 @@ libbalsa_html_new(LibBalsaMessageBody * body,
webkit_web_context_register_uri_scheme(context, "cid", lbh_cid_cb,
&info, NULL);
have_registered_cid = TRUE;
- d(g_print("%s registered cid: scheme\n", __func__));
+ g_debug("%s registered cid: scheme", __func__);
}
settings = webkit_web_view_get_settings(web_view);
@@ -647,7 +656,7 @@ libbalsa_html_new(LibBalsaMessageBody * body,
if (g_regex_match_simple(src_regex, text, G_REGEX_CASELESS, 0)) {
info->info_bar = lbh_info_bar(info);
gtk_box_pack_start(GTK_BOX(vbox), info->info_bar, FALSE, FALSE, 0);
- d(g_print("%s shows info_bar\n", __func__));
+ g_debug("%s shows info_bar", __func__);
}
webkit_web_view_load_html(web_view, text, NULL);
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAltBDZYACgkQTKlvDmfn 2fgMaggAotjoi2XidAuCkg3RztkzfcdkUz64jiOl0Zpw1HjyZ4JfCppv4DLLnOvF th3haKUTFInuTKJvFkBjMsuJNEUt1bdtTWJVvbssuvwRx3vxvbHaMZAzCwkA1cud V4gHshqkFAIHlkMi4qN8RoyHy+YXlmxYqYoUyR/+XAeBDsDawtV9mXeJFIudHC4E AYxdOSeqof9nZr7TsV/4tR22K5EhgKGMbPPUlr8rfKO99GHUcYUPf46VKmG5sMqr +C5s/ScmHxdvCUrQKwC1GoQsxipnPgdqBlpduDNrE02qnmuQN3HLSXEIb4gYHn3F tut8onZEmRaR44YtY5+7jYqxtK8H9g== =TkcU -----END PGP SIGNATURE-----