Fixed unset of current url on stop loading (#224).
authorDaniel Carl <danielcarl@gmx.de>
Thu, 16 Jul 2015 21:13:50 +0000 (23:13 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 16 Jul 2015 21:14:42 +0000 (23:14 +0200)
If and url is loaded and the real url is already available in the webview the
provisional data sour seems to be not available anymore. This caused '(null)'
be shown in url bar in case a page loading was aborted by CTRL-C.
To fix this the provisional data source is used to get the current url as long
as it exists, else the webview's url is taken.

src/main.c

index f229e10..662b125 100644 (file)
@@ -789,8 +789,12 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec)
                  * 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);
+                if (src) {
+                    WebKitNetworkRequest *req = webkit_web_data_source_get_initial_request(src);
+                    uri = webkit_network_request_get_uri(req);
+                } else {
+                    uri = webkit_web_view_get_uri(view);
+                }
                 vb_update_urlbar(uri);
 #ifdef FEATURE_AUTOCMD
                 autocmd_run(AU_LOAD_FAILED, uri, NULL);