enable uri pattern for LoadProvisional autocmd
authorSébastien Marie <semarie@users.noreply.github.com>
Fri, 24 Oct 2014 08:23:38 +0000 (10:23 +0200)
committerSébastien Marie <semarie@users.noreply.github.com>
Fri, 24 Oct 2014 11:42:36 +0000 (13:42 +0200)
this prepare a new setting "content-security-policy" that need to be
setted very early (before LoadCommited, where some HTTP-Headers are
already processed by webkit).

doc/vimb.1
src/main.c

index 7fbdbba..b123908 100644 (file)
@@ -630,8 +630,7 @@ Events:
 .TP
 .B LoadProvisional
 Fired if a new page is going to opened. No data has been received yet, the load
-may still fail for transport issues. Out of this reason this event has no
-associated URL to match.
+may still fail for transport issues.
 .TP
 .B LoadCommited
 Fired if first data chunk has arrived, meaning that the necessary transport
index dd31102..ed2d501 100644 (file)
@@ -532,7 +532,13 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec)
     switch (webkit_web_view_get_load_status(view)) {
         case WEBKIT_LOAD_PROVISIONAL:
 #ifdef FEATURE_AUTOCMD
-            autocmd_run(AU_LOAD_PROVISIONAL, NULL, NULL);
+            {
+                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);
+                autocmd_run(AU_LOAD_PROVISIONAL, uri, NULL);
+            }
 #endif
             /* update load progress in statusbar */
             vb.state.progress = 0;