From: Daniel Carl Date: Thu, 16 Jul 2015 20:40:06 +0000 (+0200) Subject: Use provisional uri if page could not be loaded (#224). X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=203c86e807b9494e839bef3816003b1a5de32003;p=vimb.git Use provisional uri if page could not be loaded (#224). In case an uri could not be loaded the uri of the webview is still the previous one. That means the url shown in the url bar is not the user requested and the 'O' command would also use the wrong url. To fix this the provisional uri is used for the url bar as well as for the autocmd call if the load of the uri failed. --- diff --git a/src/main.c b/src/main.c index 4f026d9..f229e10 100644 --- a/src/main.c +++ b/src/main.c @@ -783,10 +783,19 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) break; case WEBKIT_LOAD_FAILED: + { + /* In case the requested uri could not be loaded the Current + * uri of the Webview would still be the PRevious one. So We + * use the provisional uri here. */ + WebKitWebFrame *frame = webkit_web_view_get_main_frame(view); + WebKitWebDataSource *src = webkit_web_frame_get_provisional_data_source(frame); + WebKitNetworkRequest *req = webkit_web_data_source_get_initial_request(src); + uri = webkit_network_request_get_uri(req); + vb_update_urlbar(uri); #ifdef FEATURE_AUTOCMD - uri = webkit_web_view_get_uri(view); - autocmd_run(AU_LOAD_FAILED, uri, NULL); + autocmd_run(AU_LOAD_FAILED, uri, NULL); #endif + } break; } }