From 49bed056dd016ed74a7ed5cc988e9bdf17738c7f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 10 Feb 2014 22:40:04 +0000 Subject: Make browser_window_navigate (un)verifiable flag match browser_window_create. --- desktop/browser.c | 14 +++++++------- desktop/browser.h | 22 +++++++++++++++++++--- desktop/frames.c | 5 +++-- desktop/local_history.c | 2 +- 4 files changed, 30 insertions(+), 13 deletions(-) (limited to 'desktop') diff --git a/desktop/browser.c b/desktop/browser.c index 9bff58b5a..ca60e9ec1 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -755,8 +755,8 @@ nserror browser_window_create(enum browser_window_create_flags flags, if (url != NULL) { enum browser_window_nav_flags nav_flags = BW_NAVIGATE_NONE; - if (!(flags & BW_CREATE_UNVERIFIABLE)) - nav_flags |= BW_NAVIGATE_VERIFIABLE; + if (flags & BW_CREATE_UNVERIFIABLE) + nav_flags |= BW_NAVIGATE_UNVERIFIABLE; if (flags & BW_CREATE_HISTORY) nav_flags |= BW_NAVIGATE_HISTORY; browser_window_navigate(ret, url, referrer, nav_flags, NULL, @@ -1109,7 +1109,7 @@ static void browser_window_refresh(void *p) nsurl *url; nsurl *refresh; hlcache_handle *parent = NULL; - enum browser_window_nav_flags flags = BW_NAVIGATE_NONE; + enum browser_window_nav_flags flags = BW_NAVIGATE_UNVERIFIABLE; assert(bw->current_content != NULL && (content_get_status(bw->current_content) == @@ -1139,7 +1139,7 @@ static void browser_window_refresh(void *p) * all. */ if (bw->refresh_interval <= 100 && bw->parent == NULL) { - flags |= BW_NAVIGATE_VERIFIABLE; + flags &= ~BW_NAVIGATE_UNVERIFIABLE; } else { parent = bw->current_content; } @@ -1812,7 +1812,7 @@ nserror browser_window_navigate(struct browser_window *bw, } /* Set up retrieval parameters */ - if ((flags & BW_NAVIGATE_VERIFIABLE) != 0) { + if (!(flags & BW_NAVIGATE_UNVERIFIABLE)) { fetch_flags |= LLCACHE_RETRIEVE_VERIFIABLE; } @@ -1905,7 +1905,7 @@ nserror browser_window_navigate(struct browser_window *bw, bw->history_add = (flags & BW_NAVIGATE_HISTORY); /* Verifiable fetches may trigger a download */ - if ((flags & BW_NAVIGATE_VERIFIABLE) != 0) { + if (!(flags & BW_NAVIGATE_UNVERIFIABLE)) { fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD; } @@ -2268,7 +2268,7 @@ void browser_window_reload(struct browser_window *bw, bool all) browser_window_navigate(bw, hlcache_handle_get_url(bw->current_content), NULL, - BW_NAVIGATE_VERIFIABLE, + BW_NAVIGATE_NONE, NULL, NULL, NULL); diff --git a/desktop/browser.h b/desktop/browser.h index 4cb8e012a..ca99a5d16 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -76,7 +76,15 @@ enum browser_window_create_flags { /** New gui_window to be clone of "existing" gui_window */ BW_CREATE_CLONE = (1 << 2), - /** Window not opened by user interaction (e.g. JS popup) */ + /** Window not opened by user interaction (e.g. JS popup) + * + * rfc2965: + * A transaction is verifiable if the user, or a + * user-designated agent, has the option to review + * the request-URI prior to its use in the transaction. + * A transaction is unverifiable if the user does not + * have that option. + */ BW_CREATE_UNVERIFIABLE = (1 << 3), }; @@ -91,8 +99,16 @@ enum browser_window_nav_flags { /** download rather than render the uri */ BW_NAVIGATE_DOWNLOAD = (1 << 1), - /** this transaction is verifiable */ - BW_NAVIGATE_VERIFIABLE = (1 << 2) + /** Transation not caused by user interaction (e.g. JS-caused) + * + * rfc2965: + * A transaction is verifiable if the user, or a + * user-designated agent, has the option to review + * the request-URI prior to its use in the transaction. + * A transaction is unverifiable if the user does not + * have that option. + */ + BW_NAVIGATE_UNVERIFIABLE = (1 << 2) }; /** diff --git a/desktop/frames.c b/desktop/frames.c index 153c78e34..ab5f8171c 100644 --- a/desktop/frames.c +++ b/desktop/frames.c @@ -252,7 +252,7 @@ void browser_window_create_iframes(struct browser_window *bw, browser_window_navigate(window, cur->url, hlcache_handle_get_url(bw->current_content), - BW_NAVIGATE_NONE, + BW_NAVIGATE_UNVERIFIABLE, NULL, NULL, bw->current_content); @@ -389,7 +389,8 @@ void browser_window_create_frameset(struct browser_window *bw, browser_window_navigate(window, frame->url, hlcache_handle_get_url(parent), - BW_NAVIGATE_HISTORY, + BW_NAVIGATE_HISTORY | + BW_NAVIGATE_UNVERIFIABLE, NULL, NULL, parent); diff --git a/desktop/local_history.c b/desktop/local_history.c index 569fa44e4..687d4c754 100644 --- a/desktop/local_history.c +++ b/desktop/local_history.c @@ -463,7 +463,7 @@ void history_go(struct history *history, struct history_entry *entry, } else { history->current = entry; browser_window_navigate(history->bw, url, NULL, - BW_NAVIGATE_VERIFIABLE, NULL, NULL, NULL); + BW_NAVIGATE_NONE, NULL, NULL, NULL); } nsurl_unref(url); -- cgit v1.2.3