WebKitLoadEvent event, Client *c)
{
GTlsCertificateFlags tlsflags;
+ const char *raw_uri;
char *uri = NULL;
+ raw_uri = webkit_web_view_get_uri(webview);
+ if (raw_uri) {
+ uri = util_sanitize_uri(raw_uri);
+ }
+
switch (event) {
case WEBKIT_LOAD_STARTED:
#ifdef FEATURE_AUTOCMD
- autocmd_run(c, AU_LOAD_STARTED, webkit_web_view_get_uri(webview), NULL);
+ autocmd_run(c, AU_LOAD_STARTED, raw_uri, NULL);
#endif
/* update load progress in statusbar */
c->state.progress = 0;
vb_statusbar_update(c);
- uri = util_sanitize_uri(webkit_web_view_get_uri(webview));
set_title(c, uri);
/* Make sure hinting is cleared before the new page is loaded.
* Without that vimb would still be in hinting mode after hinting
* right place to remove the flag. */
c->mode->flags &= ~FLAG_IGNORE_FOCUS;
#ifdef FEATURE_AUTOCMD
- autocmd_run(c, AU_LOAD_COMMITTED, webkit_web_view_get_uri(webview), NULL);
+ autocmd_run(c, AU_LOAD_COMMITTED, raw_uri, NULL);
#endif
/* save the current URI in register % */
- uri = util_sanitize_uri(webkit_web_view_get_uri(webview));
vb_register_add(c, '%', uri);
/* check if tls is on and the page is trusted */
if (g_str_has_prefix(uri, "https://")) {
break;
case WEBKIT_LOAD_FINISHED:
- uri = util_sanitize_uri(webkit_web_view_get_uri(webview));
#ifdef FEATURE_AUTOCMD
- autocmd_run(c, AU_LOAD_FINISHED, webkit_web_view_get_uri(webview), NULL);
+ autocmd_run(c, AU_LOAD_FINISHED, raw_uri, NULL);
#endif
c->state.progress = 100;
if (strncmp(uri, "about:", 6)) {
/**
* Strips password from a uri.
*
- * Return newly allocated string.
+ * Return newly allocated string or NULL.
*/
char *util_sanitize_uri(const char *uri_str)
{
char *sanitized_uri;
char *for_display;
+ if (!uri_str) {
+ return NULL;
+ }
#if WEBKIT_CHECK_VERSION(2, 24, 0)
for_display = webkit_uri_for_display(uri_str);
#else