From f8a887df7667c7759c89c210db4457a17fe2d918 Mon Sep 17 00:00:00 2001 From: Phil Longstaff Date: Mon, 9 Nov 2009 23:35:25 +0000 Subject: [PATCH] Bug 600947 - Gnucash-2.3.7 crashes when doing reports with webkit-1.1.15 Handle the "navigation requested" callback correctly. It was being called with the uri "base-uri" when a page was being loaded. This needed to be accepted. Then, when clicking on an account name, the correct register needs to be opened and the navigation status needs to be IGNORE. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18408 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/html/gnc-html-webkit.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/html/gnc-html-webkit.c b/src/html/gnc-html-webkit.c index 7283a806e7..f9e557a59d 100644 --- a/src/html/gnc-html-webkit.c +++ b/src/html/gnc-html-webkit.c @@ -79,8 +79,11 @@ static char error_404_format[] = "

%s

%s"; static char error_404_title[] = N_("Not found"); static char error_404_body[] = N_("The specified URL could not be loaded."); -static void webkit_navigation_requested_cb( WebKitWebView* web_view, GObject* arg1, - GObject* arg2, gpointer data ); +static WebKitNavigationResponse webkit_navigation_requested_cb( + WebKitWebView* web_view, + WebKitWebFrame* frame, + WebKitNetworkRequest* request, + gpointer user_data ); static void webkit_on_url_cb( WebKitWebView* web_view, gchar* title, gchar* url, gpointer data ); static gchar* handle_embedded_object( GncHtmlWebkit* self, gchar* html_str ); @@ -476,23 +479,28 @@ gnc_html_link_clicked_cb( GtkHTML* html, const gchar* url, gpointer data ) * loaded within the loading of a page (embedded image). ********************************************************************/ -static void -webkit_navigation_requested_cb( WebKitWebView* web_view, GObject* arg1, - GObject* arg2, gpointer data ) +static WebKitNavigationResponse +webkit_navigation_requested_cb( WebKitWebView* web_view, WebKitWebFrame* frame, + WebKitNetworkRequest* request, + gpointer data ) { URLType type; gchar* location = NULL; gchar* label = NULL; GncHtmlWebkit* self = GNC_HTML_WEBKIT(data); - WebKitNetworkRequest* req = WEBKIT_NETWORK_REQUEST(arg2); - const gchar* url = webkit_network_request_get_uri( req ); + const gchar* url = webkit_network_request_get_uri( request ); DEBUG( "requesting %s", url ); + if( strcmp( url, "base-uri" ) == 0 ) { + return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; + } + type = gnc_html_parse_url( GNC_HTML(self), url, &location, &label ); gnc_html_show_url( GNC_HTML(self), type, location, label, 0 ); // load_to_stream( self, type, location, label ); g_free( location ); g_free( label ); + return WEBKIT_NAVIGATION_RESPONSE_IGNORE; } #if 0