[webkit-gtk] [Spam 6.20] Replace default error page
Gavin Lambert
gavinl at compacsort.com
Sun Jan 15 18:44:50 PST 2012
Quoth Martin Rösch:
> I tried to replace the default error page by connecting to the
> "load-error" signal and do a webkit_web_view_load_uri call to a local
> html file. The handler looks like this:
> gboolean on_load_error(WebKitWebView *web_view,
> WebKitWebFrame *web_frame,
> gchar *uri,
> gpointer web_error,
> gpointer user_data)
> {
> g_debug("load-error: %s", uri);
> webkit_web_view_stop_loading(web_view);
> webkit_web_view_load_uri(WEBKIT_WEB_VIEW (web_view),
> "file://"DATADIR"/start.html");
> return TRUE;
> }
>
> When a load-error occurs the local file is displayed and everything is
> fine for about 15-20 mins. After that period, the handler gets called
> (with the uri set to the local file) hundreds of times immediately and
> every second afterwards until all memory is used up.
> It seems to me, that the load error is not cancelled correctly, and
> never will.
Most likely, you have a problem elsewhere (eg. memory fragmentation or leak,
file lock) preventing the load from working.
To prevent the infinite loop, you need to protect your load-error handler
such that if the error occurs in loading your error page, you fall back to
default handling instead of trying to load the same thing again (and getting
stuck).
More information about the webkit-gtk
mailing list