diff options
-rw-r--r-- | content/urldb.c | 19 | ||||
-rw-r--r-- | content/urldb.h | 1 | ||||
-rw-r--r-- | desktop/browser.c | 3 |
3 files changed, 22 insertions, 1 deletions
diff --git a/content/urldb.c b/content/urldb.c index 090be9c90..179a08679 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -838,6 +838,25 @@ const struct url_data *urldb_get_url_data(const char *url) } /** + * Extract an URL from the db + * + * \param url URL to extract + * \return Pointer to database's copy of URL or NULL if not found + */ +const char *urldb_get_url(const char *url) +{ + struct path_data *p; + + assert(url); + + p = urldb_find_url(url); + if (!p) + return NULL; + + return p->url; +} + +/** * Look up authentication details in database * * \param url Absolute URL to search for diff --git a/content/urldb.h b/content/urldb.h index 1a7383022..b7f57ebdd 100644 --- a/content/urldb.h +++ b/content/urldb.h @@ -38,6 +38,7 @@ void urldb_set_url_content_type(const char *url, content_type type); void urldb_update_url_visit_data(const char *url); void urldb_reset_url_visit_data(const char *url); const struct url_data *urldb_get_url_data(const char *url); +const char *urldb_get_url(const char *url); /* Authentication modification / lookup */ void urldb_set_auth_details(const char *url, const char *realm, diff --git a/desktop/browser.c b/desktop/browser.c index 7948ca9fa..6cc18ca4b 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -332,7 +332,8 @@ void browser_window_callback(content_msg msg, struct content *c, c->title ? c->title : c->url); urldb_update_url_visit_data(c->url); urldb_set_url_content_type(c->url, c->type); - global_history_add(c->url); + /* This is safe as we've just added the URL */ + global_history_add(urldb_get_url(c->url)); } switch (c->type) { case CONTENT_HTML: |