diff options
author | Josh Rickmar <jrick@devio.us> | 2012-08-29 09:57:26 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-08-29 09:57:26 -0400 |
commit | b81157699e521799215a1baac3745163b4dc22e3 (patch) | |
tree | 63b920ce12b4d26c0118d9c78592062e1c9ce0df | |
parent | cda5a4c8462733e9b44276f3be8c44e3c596b9f7 (diff) | |
download | xombrero-b81157699e521799215a1baac3745163b4dc22e3.tar.gz |
Fix back/forward handling with about pages.
This change makes the can_go_* and go_* back/forward functions use the same logic when determining whether we are on an about page, and makes it so about:secviolation warning pages do not save the page that generated the warning to t->item. This prevents hitting back and going back to the exact same page that generated the warning (triggering the warning a second time).
-rw-r--r-- | about.c | 32 | ||||
-rw-r--r-- | marco.c | 2 | ||||
-rw-r--r-- | settings.c | 4 | ||||
-rw-r--r-- | whitelist.c | 8 | ||||
-rw-r--r-- | xombrero.c | 6 | ||||
-rw-r--r-- | xombrero.h | 2 |
6 files changed, 28 insertions, 26 deletions
diff --git a/about.c b/about.c index 12dab48..36284b2 100644 --- a/about.c +++ b/about.c @@ -179,7 +179,7 @@ get_html_page(gchar *title, gchar *body, gchar *head, bool addstyles) * Display a web page from a HTML string in memory, rather than from a URL */ void -load_webkit_string(struct tab *t, const char *str, gchar *title) +load_webkit_string(struct tab *t, const char *str, gchar *title, int nohist) { char file[PATH_MAX]; int i; @@ -188,7 +188,7 @@ load_webkit_string(struct tab *t, const char *str, gchar *title) g_signal_handler_disconnect(t->wv, t->progress_handle); /* we set this to indicate we want to manually do navaction */ - if (t->bfl) { + if (t->bfl && !nohist) { t->item = webkit_web_back_forward_list_get_current_item(t->bfl); if (t->item) g_object_ref(t->item); @@ -229,7 +229,7 @@ blank(struct tab *t, struct karg *args) if (t == NULL) show_oops(NULL, "blank invalid parameters"); - load_webkit_string(t, "", XT_URI_ABOUT_BLANK); + load_webkit_string(t, "", XT_URI_ABOUT_BLANK, 0); return (0); } @@ -251,7 +251,7 @@ help(struct tab *t, struct karg *args) page = get_html_page(XT_NAME, body, head, FALSE); - load_webkit_string(t, page, XT_URI_ABOUT_HELP); + load_webkit_string(t, page, XT_URI_ABOUT_HELP, 0); g_free(page); return (0); @@ -296,7 +296,7 @@ stats(struct tab *t, struct karg *args) page = get_html_page("Statistics", body, "", 0); g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_STATS); + load_webkit_string(t, page, XT_URI_ABOUT_STATS, 0); g_free(page); return (0); @@ -327,7 +327,7 @@ show_certs(struct tab *t, gnutls_x509_crt_t *certs, tmp = get_html_page(title, body, "", 0); g_free(body); - load_webkit_string(t, tmp, XT_URI_ABOUT_CERTS); + load_webkit_string(t, tmp, XT_URI_ABOUT_CERTS, 0); g_free(tmp); } @@ -1262,7 +1262,7 @@ xtp_page_ab(struct tab *t, struct karg *args) page = get_html_page("About", body, "", 0); g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_ABOUT); + load_webkit_string(t, page, XT_URI_ABOUT_ABOUT, 0); g_free(page); @@ -1369,7 +1369,7 @@ xtp_page_fl(struct tab *t, struct karg *args) /* render */ if (!failed) { page = get_html_page("Favorites", body, "", 1); - load_webkit_string(t, page, XT_URI_ABOUT_FAVORITES); + load_webkit_string(t, page, XT_URI_ABOUT_FAVORITES, 0); g_free(page); } @@ -1617,7 +1617,7 @@ xtp_page_cl(struct tab *t, struct karg *args) g_free(table_headers); g_free(last_domain); - load_webkit_string(t, page, XT_URI_ABOUT_COOKIEJAR); + load_webkit_string(t, page, XT_URI_ABOUT_COOKIEJAR, 0); update_cookie_tabs(t); g_free(page); @@ -1688,7 +1688,7 @@ xtp_page_hl(struct tab *t, struct karg *args) */ update_history_tabs(t); - load_webkit_string(t, page, XT_URI_ABOUT_HISTORY); + load_webkit_string(t, page, XT_URI_ABOUT_HISTORY, 0); g_free(page); return (0); @@ -1762,7 +1762,7 @@ xtp_page_dl(struct tab *t, struct karg *args) */ update_download_tabs(t); - load_webkit_string(t, page, XT_URI_ABOUT_DOWNLOADS); + load_webkit_string(t, page, XT_URI_ABOUT_DOWNLOADS, 0); g_free(page); return (0); @@ -1814,7 +1814,7 @@ xtp_page_sl(struct tab *t, struct karg *args) */ update_search_tabs(t); - load_webkit_string(t, page, XT_URI_ABOUT_SEARCH); + load_webkit_string(t, page, XT_URI_ABOUT_SEARCH, 0); g_free(page); return (0); @@ -1879,7 +1879,7 @@ xtp_page_sv(struct tab *t, struct karg *args) page = get_html_page("Security Violation", body, "", 0); g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_SECVIOLATION); + load_webkit_string(t, page, XT_URI_ABOUT_SECVIOLATION, 1); g_free(page); if (soupuri) @@ -1908,7 +1908,7 @@ startpage(struct tab *t, struct karg *args) page = get_html_page("Startup Exception", body, "", 0); g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_STARTPAGE); + load_webkit_string(t, page, XT_URI_ABOUT_STARTPAGE, 0); g_free(page); return (0); @@ -2147,7 +2147,7 @@ about_webkit(struct tab *t, struct karg *arg) page = get_html_page("About Webkit", body, "", 0); g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_WEBKIT); + load_webkit_string(t, page, XT_URI_ABOUT_WEBKIT, 0); g_free(page); return (0); @@ -2193,7 +2193,7 @@ allthethings(struct tab *t, struct karg *arg) page = get_html_page("About All The Things _o/", body, "", 0); g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_ALLTHETHINGS); + load_webkit_string(t, page, XT_URI_ABOUT_ALLTHETHINGS, 0); g_free(page); return (0); diff --git a/marco.c b/marco.c index 12828ef..3731af8 100644 --- a/marco.c +++ b/marco.c @@ -63,7 +63,7 @@ marco(struct tab *t, struct karg *args) page = get_html_page("Marco Sez...", line, "", 0); - load_webkit_string(t, page, XT_URI_ABOUT_MARCO); + load_webkit_string(t, page, XT_URI_ABOUT_MARCO, 0); g_free(page); return (0); diff --git a/settings.c b/settings.c index ef81c54..e895cc1 100644 --- a/settings.c +++ b/settings.c @@ -3774,7 +3774,7 @@ xtp_page_set(struct tab *t, struct karg *args) g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_SET); + load_webkit_string(t, page, XT_URI_ABOUT_SET, 0); g_free(page); @@ -3830,7 +3830,7 @@ xtp_page_rt(struct tab *t, struct karg *args) g_free(body); - load_webkit_string(t, page, XT_URI_ABOUT_RUNTIME); + load_webkit_string(t, page, XT_URI_ABOUT_RUNTIME, 0); g_free(page); diff --git a/whitelist.c b/whitelist.c index 819fb7a..a1204ed 100644 --- a/whitelist.c +++ b/whitelist.c @@ -272,13 +272,13 @@ wl_show(struct tab *t, struct karg *args, char *title, struct domain_list *wl) tmp = get_html_page(title, body, "", 0); g_free(body); if (wl == &js_wl) - load_webkit_string(t, tmp, XT_URI_ABOUT_JSWL); + load_webkit_string(t, tmp, XT_URI_ABOUT_JSWL, 0); else if (wl == &c_wl) - load_webkit_string(t, tmp, XT_URI_ABOUT_COOKIEWL); + load_webkit_string(t, tmp, XT_URI_ABOUT_COOKIEWL, 0); else if (wl == &pl_wl) - load_webkit_string(t, tmp, XT_URI_ABOUT_PLUGINWL); + load_webkit_string(t, tmp, XT_URI_ABOUT_PLUGINWL, 0); else if (wl == &force_https) - load_webkit_string(t, tmp, XT_URI_ABOUT_HTTPS); + load_webkit_string(t, tmp, XT_URI_ABOUT_HTTPS, 0); g_free(tmp); return (0); } diff --git a/xombrero.c b/xombrero.c index 10adf57..b52cf77 100644 --- a/xombrero.c +++ b/xombrero.c @@ -2357,7 +2357,8 @@ go_back_for_real(struct tab *t) return; uri = get_uri(t); - if (uri == NULL) { + if (uri == NULL || g_str_has_prefix(uri, "about:") || + g_str_has_prefix(uri, "xxxt://")) { webkit_web_view_go_back(t->wv); return; } @@ -2383,7 +2384,8 @@ go_forward_for_real(struct tab *t) return; uri = get_uri(t); - if (uri == NULL) { + if (uri == NULL || g_str_has_prefix(uri, "about:") || + g_str_has_prefix(uri, "xxxt://")) { webkit_web_view_go_forward(t->wv); return; } diff --git a/xombrero.h b/xombrero.h index 7749195..df8306a 100644 --- a/xombrero.h +++ b/xombrero.h @@ -390,7 +390,7 @@ void expand_tilde(char *, size_t, const char *); char *html_escape(const char *val); void set_status(struct tab *t, gchar *fmt, ...); -void load_webkit_string(struct tab *, const char *, gchar *); +void load_webkit_string(struct tab *, const char *, gchar *, int); void button_set_stockid(GtkWidget *, char *); void webview_progress_changed_cb(WebKitWebView *, GParamSpec *, struct tab *); |