summaryrefslogtreecommitdiff
path: root/desktop/history_core.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-02-14 15:09:28 +0000
committerVincent Sanders <vince@netsurf-browser.org>2013-02-18 11:23:27 +0000
commit3bfb5b96a7c7cb2718a60987e69cd659ed49b9d8 (patch)
tree40aa4e52aa50010c8f7c47dda79be2b77339e546 /desktop/history_core.c
parentc545bb4b42dff8bfd4c288e330f52848ec2df6c4 (diff)
downloadnetsurf-3bfb5b96a7c7cb2718a60987e69cd659ed49b9d8.tar.gz
netsurf-3bfb5b96a7c7cb2718a60987e69cd659ed49b9d8.tar.bz2
browser_window_navigate refactor
Diffstat (limited to 'desktop/history_core.c')
-rw-r--r--desktop/history_core.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/desktop/history_core.c b/desktop/history_core.c
index 2430e04e5..dda4bcaec 100644
--- a/desktop/history_core.c
+++ b/desktop/history_core.c
@@ -423,40 +423,52 @@ bool history_forward_available(struct history *history)
/* Documented in history_core.h */
-void history_go(struct browser_window *bw, struct history *history,
- struct history_entry *entry, bool new_window)
+void history_go(struct browser_window *bw,
+ struct history *history,
+ struct history_entry *entry,
+ bool new_window)
{
- char *url;
+ char *full_url;
+ nsurl *url;
struct history_entry *current;
+ nserror error;
// LOG(("%p %p %p", bw, history, entry));
// LOG(("%s %s %s",
// entry->page.url, entry->page.title, entry->page.frag_id));
if (entry->page.frag_id) {
- url = malloc(strlen(entry->page.url) +
+ full_url = malloc(strlen(entry->page.url) +
strlen(entry->page.frag_id) + 5);
- if (!url) {
+ if (full_url == NULL) {
warn_user("NoMemory", 0);
return;
}
- sprintf(url, "%s#%s", entry->page.url, entry->page.frag_id);
+ sprintf(full_url, "%s#%s", entry->page.url, entry->page.frag_id);
+
+ error = nsurl_create(full_url, &url);
+ free(full_url);
+ } else {
+ error = nsurl_create(entry->page.url, &url);
+ }
+
+
+ if (error != NSERROR_OK) {
+ warn_user("NoMemory", 0);
+ return;
}
- else
- url = entry->page.url;
if (new_window) {
current = history->current;
history->current = entry;
- browser_window_create(url, bw, 0, false, false);
+ browser_window_create(url, NULL, bw, false, false);
history->current = current;
} else {
history->current = entry;
- browser_window_go(bw, url, 0, false);
+ browser_window_navigate(bw, url, NULL, BROWSER_WINDOW_GO_FLAG_VERIFIABLE, NULL, NULL, NULL);
}
- if (entry->page.frag_id)
- free(url);
+ nsurl_unref(url);
}