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
This commit is contained in:
Phil Longstaff 2009-11-09 23:35:25 +00:00
parent f693c0e8bc
commit f8a887df76

View File

@ -79,8 +79,11 @@ static char error_404_format[] = "<html><body><h3>%s</h3><p>%s</body></html>";
static char error_404_title[] = N_("Not found"); static char error_404_title[] = N_("Not found");
static char error_404_body[] = N_("The specified URL could not be loaded."); static char error_404_body[] = N_("The specified URL could not be loaded.");
static void webkit_navigation_requested_cb( WebKitWebView* web_view, GObject* arg1, static WebKitNavigationResponse webkit_navigation_requested_cb(
GObject* arg2, gpointer data ); WebKitWebView* web_view,
WebKitWebFrame* frame,
WebKitNetworkRequest* request,
gpointer user_data );
static void webkit_on_url_cb( WebKitWebView* web_view, gchar* title, gchar* url, static void webkit_on_url_cb( WebKitWebView* web_view, gchar* title, gchar* url,
gpointer data ); gpointer data );
static gchar* handle_embedded_object( GncHtmlWebkit* self, gchar* html_str ); 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). * loaded within the loading of a page (embedded image).
********************************************************************/ ********************************************************************/
static void static WebKitNavigationResponse
webkit_navigation_requested_cb( WebKitWebView* web_view, GObject* arg1, webkit_navigation_requested_cb( WebKitWebView* web_view, WebKitWebFrame* frame,
GObject* arg2, gpointer data ) WebKitNetworkRequest* request,
gpointer data )
{ {
URLType type; URLType type;
gchar* location = NULL; gchar* location = NULL;
gchar* label = NULL; gchar* label = NULL;
GncHtmlWebkit* self = GNC_HTML_WEBKIT(data); GncHtmlWebkit* self = GNC_HTML_WEBKIT(data);
WebKitNetworkRequest* req = WEBKIT_NETWORK_REQUEST(arg2); const gchar* url = webkit_network_request_get_uri( request );
const gchar* url = webkit_network_request_get_uri( req );
DEBUG( "requesting %s", url ); 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 ); type = gnc_html_parse_url( GNC_HTML(self), url, &location, &label );
gnc_html_show_url( GNC_HTML(self), type, location, label, 0 ); gnc_html_show_url( GNC_HTML(self), type, location, label, 0 );
// load_to_stream( self, type, location, label ); // load_to_stream( self, type, location, label );
g_free( location ); g_free( location );
g_free( label ); g_free( label );
return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
} }
#if 0 #if 0