netsurf: branch master updated. release/3.9-167-gb67bbe3

NetSurf Browser Project (Commit Mailer) no-reply at netsurf-browser.org
Wed Aug 21 20:34:08 BST 2019


Gitweb links:

...log http://git.netsurf-browser.org/netsurf.git/shortlog/b67bbe3280ebdfdfdc4731d977ad7a38b9608c2a
...commit http://git.netsurf-browser.org/netsurf.git/commit/b67bbe3280ebdfdfdc4731d977ad7a38b9608c2a
...tree http://git.netsurf-browser.org/netsurf.git/tree/b67bbe3280ebdfdfdc4731d977ad7a38b9608c2a

The branch, master has been updated
       via  b67bbe3280ebdfdfdc4731d977ad7a38b9608c2a (commit)
      from  6bce06b91f5efe51531aa4923137488cf21df132 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b67bbe3280ebdfdfdc4731d977ad7a38b9608c2a
commit b67bbe3280ebdfdfdc4731d977ad7a38b9608c2a
Author: Daniel Silverstone <dsilvers at digital-scurf.org>
Commit: Daniel Silverstone <dsilvers at digital-scurf.org>

    browser_window: Ensure that back works like 'back to safety'
    
    Signed-off-by: Daniel Silverstone <dsilvers at digital-scurf.org>

diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index c4ff750..5b44670 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -37,6 +37,7 @@
 #include "content/hlcache.h"
 #include "content/urldb.h"
 #include "netsurf/bitmap.h"
+#include "utils/corestrings.h"
 
 #include "desktop/gui_internal.h"
 #include "desktop/browser_private.h"
@@ -519,6 +520,24 @@ void browser_window_history_destroy(struct browser_window *bw)
 /* exported interface documented in desktop/browser_history.h */
 nserror browser_window_history_back(struct browser_window *bw, bool new_window)
 {
+	if (bw != NULL && bw->internal_nav) {
+		/* All internal nav back operations ignore new_window */
+		if (bw->current_parameters.url != NULL) {
+			/* There are some internal parameters, restart from there */
+			return browser_window__reload_current_parameters(bw);
+		} else {
+			/* No internal parameters, just navigate to about:blank */
+			return browser_window_navigate(
+				bw,
+				corestring_nsurl_about_blank,
+				NULL, /* Referer */
+				BW_NAVIGATE_HISTORY,
+				NULL, /* Post */
+				NULL, /* Post */
+				NULL  /* parent fetch */);
+		}
+	}
+
 	if (!bw || !bw->history || !bw->history->current ||
 	    !bw->history->current->back) {
 		return NSERROR_BAD_PARAMETER;
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 0995561..6e45052 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -408,4 +408,11 @@ void browser_window_history_destroy(struct browser_window *bw);
  */
 typedef nserror (*browser_window_query_callback)(bool proceed, void *pw);
 
+/**
+ * Navigate a browser window to the current parameters
+ *
+ * \param bw The browser window to cause to navigate
+ */
+nserror browser_window__reload_current_parameters(struct browser_window *bw);
+
 #endif
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index e44b928..95131d1 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -864,23 +864,7 @@ browser_window__handle_ssl_query_response(bool proceed, void *pw)
 		 * nav to the old 'current' parameters, with any post data
 		 * stripped away
 		 */
-		if (bw->current_parameters.post_urlenc != NULL) {
-			free(bw->current_parameters.post_urlenc);
-			bw->current_parameters.post_urlenc = NULL;
-		}
-
-		if (bw->current_parameters.post_multipart != NULL) {
-			fetch_multipart_data_destroy(bw->current_parameters.post_multipart);
-			bw->current_parameters.post_multipart = NULL;
-		}
-
-		bw->current_parameters.flags &= ~BW_NAVIGATE_HISTORY;
-		bw->internal_nav = false;
-
-		browser_window__free_fetch_parameters(&bw->loading_parameters);
-		memcpy(&bw->loading_parameters, &bw->current_parameters, sizeof(bw->loading_parameters));
-		memset(&bw->current_parameters, 0, sizeof(bw->current_parameters));
-		return browser_window__navigate_internal(bw, &bw->loading_parameters);
+		return browser_window__reload_current_parameters(bw);
 	}
 
 	/* We're processing a "proceed" attempt from the form */
@@ -1694,7 +1678,9 @@ browser_window_refresh_url_bar_internal(struct browser_window *bw, nsurl *url)
 		/* Not root window or no gui window so do not set a URL */
 		return NSERROR_OK;
 	}
-
+	
+	NSLOG(netsurf, CRITICAL, "Updating the URL to %s", nsurl_access(url));
+	
 	return guit->window->set_url(bw->window, url);
 }
 
@@ -4275,6 +4261,10 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
 /* exported interface documented in netsurf/browser_window.h */
 bool browser_window_back_available(struct browser_window *bw)
 {
+	if (bw != NULL && bw->internal_nav) {
+		/* Internal nav, back is possible */
+		return true;
+	}
 	return (bw && bw->history && browser_window_history_back_available(bw));
 }
 
@@ -4375,3 +4365,28 @@ browser_window_console_log(struct browser_window *bw,
 
 	return NSERROR_OK;
 }
+
+/* Exported interface, documented in browser_private.h */
+nserror
+browser_window__reload_current_parameters(struct browser_window *bw)
+{
+	assert(bw != NULL);
+
+	if (bw->current_parameters.post_urlenc != NULL) {
+		free(bw->current_parameters.post_urlenc);
+		bw->current_parameters.post_urlenc = NULL;
+	}
+
+	if (bw->current_parameters.post_multipart != NULL) {
+		fetch_multipart_data_destroy(bw->current_parameters.post_multipart);
+		bw->current_parameters.post_multipart = NULL;
+	}
+
+	bw->current_parameters.flags &= ~BW_NAVIGATE_HISTORY;
+	bw->internal_nav = false;
+	
+	browser_window__free_fetch_parameters(&bw->loading_parameters);
+	memcpy(&bw->loading_parameters, &bw->current_parameters, sizeof(bw->loading_parameters));
+	memset(&bw->current_parameters, 0, sizeof(bw->current_parameters));
+	return browser_window__navigate_internal(bw, &bw->loading_parameters);
+}


-----------------------------------------------------------------------

Summary of changes:
 desktop/browser_history.c |   19 +++++++++++++++++
 desktop/browser_private.h |    7 +++++++
 desktop/browser_window.c  |   51 +++++++++++++++++++++++++++++----------------
 3 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index c4ff750..5b44670 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -37,6 +37,7 @@
 #include "content/hlcache.h"
 #include "content/urldb.h"
 #include "netsurf/bitmap.h"
+#include "utils/corestrings.h"
 
 #include "desktop/gui_internal.h"
 #include "desktop/browser_private.h"
@@ -519,6 +520,24 @@ void browser_window_history_destroy(struct browser_window *bw)
 /* exported interface documented in desktop/browser_history.h */
 nserror browser_window_history_back(struct browser_window *bw, bool new_window)
 {
+	if (bw != NULL && bw->internal_nav) {
+		/* All internal nav back operations ignore new_window */
+		if (bw->current_parameters.url != NULL) {
+			/* There are some internal parameters, restart from there */
+			return browser_window__reload_current_parameters(bw);
+		} else {
+			/* No internal parameters, just navigate to about:blank */
+			return browser_window_navigate(
+				bw,
+				corestring_nsurl_about_blank,
+				NULL, /* Referer */
+				BW_NAVIGATE_HISTORY,
+				NULL, /* Post */
+				NULL, /* Post */
+				NULL  /* parent fetch */);
+		}
+	}
+
 	if (!bw || !bw->history || !bw->history->current ||
 	    !bw->history->current->back) {
 		return NSERROR_BAD_PARAMETER;
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 0995561..6e45052 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -408,4 +408,11 @@ void browser_window_history_destroy(struct browser_window *bw);
  */
 typedef nserror (*browser_window_query_callback)(bool proceed, void *pw);
 
+/**
+ * Navigate a browser window to the current parameters
+ *
+ * \param bw The browser window to cause to navigate
+ */
+nserror browser_window__reload_current_parameters(struct browser_window *bw);
+
 #endif
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index e44b928..95131d1 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -864,23 +864,7 @@ browser_window__handle_ssl_query_response(bool proceed, void *pw)
 		 * nav to the old 'current' parameters, with any post data
 		 * stripped away
 		 */
-		if (bw->current_parameters.post_urlenc != NULL) {
-			free(bw->current_parameters.post_urlenc);
-			bw->current_parameters.post_urlenc = NULL;
-		}
-
-		if (bw->current_parameters.post_multipart != NULL) {
-			fetch_multipart_data_destroy(bw->current_parameters.post_multipart);
-			bw->current_parameters.post_multipart = NULL;
-		}
-
-		bw->current_parameters.flags &= ~BW_NAVIGATE_HISTORY;
-		bw->internal_nav = false;
-
-		browser_window__free_fetch_parameters(&bw->loading_parameters);
-		memcpy(&bw->loading_parameters, &bw->current_parameters, sizeof(bw->loading_parameters));
-		memset(&bw->current_parameters, 0, sizeof(bw->current_parameters));
-		return browser_window__navigate_internal(bw, &bw->loading_parameters);
+		return browser_window__reload_current_parameters(bw);
 	}
 
 	/* We're processing a "proceed" attempt from the form */
@@ -1694,7 +1678,9 @@ browser_window_refresh_url_bar_internal(struct browser_window *bw, nsurl *url)
 		/* Not root window or no gui window so do not set a URL */
 		return NSERROR_OK;
 	}
-
+	
+	NSLOG(netsurf, CRITICAL, "Updating the URL to %s", nsurl_access(url));
+	
 	return guit->window->set_url(bw->window, url);
 }
 
@@ -4275,6 +4261,10 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
 /* exported interface documented in netsurf/browser_window.h */
 bool browser_window_back_available(struct browser_window *bw)
 {
+	if (bw != NULL && bw->internal_nav) {
+		/* Internal nav, back is possible */
+		return true;
+	}
 	return (bw && bw->history && browser_window_history_back_available(bw));
 }
 
@@ -4375,3 +4365,28 @@ browser_window_console_log(struct browser_window *bw,
 
 	return NSERROR_OK;
 }
+
+/* Exported interface, documented in browser_private.h */
+nserror
+browser_window__reload_current_parameters(struct browser_window *bw)
+{
+	assert(bw != NULL);
+
+	if (bw->current_parameters.post_urlenc != NULL) {
+		free(bw->current_parameters.post_urlenc);
+		bw->current_parameters.post_urlenc = NULL;
+	}
+
+	if (bw->current_parameters.post_multipart != NULL) {
+		fetch_multipart_data_destroy(bw->current_parameters.post_multipart);
+		bw->current_parameters.post_multipart = NULL;
+	}
+
+	bw->current_parameters.flags &= ~BW_NAVIGATE_HISTORY;
+	bw->internal_nav = false;
+	
+	browser_window__free_fetch_parameters(&bw->loading_parameters);
+	memcpy(&bw->loading_parameters, &bw->current_parameters, sizeof(bw->loading_parameters));
+	memset(&bw->current_parameters, 0, sizeof(bw->current_parameters));
+	return browser_window__navigate_internal(bw, &bw->loading_parameters);
+}


-- 
NetSurf Browser



More information about the netsurf-commits mailing list