mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-19 10:42:36 +03:00
browser_window: Inform GUI about redirects and final URL
To correctly have the GUI know about all url bar updates, we should inform it during the processing of redirects and we should ensure that when we're in the ready-but-not-done phase we do not use the fetch parameters but instead the content's known URL Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
c9e5fa9bc1
commit
277c1550f5
@ -1319,6 +1319,27 @@ browser_window__handle_error(struct browser_window *bw,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update URL bar for a given browser window to given URL
|
||||
*
|
||||
* \param bw Browser window to update URL bar for.
|
||||
* \param url URL for content displayed by bw including any fragment.
|
||||
*/
|
||||
static inline nserror
|
||||
browser_window_refresh_url_bar_internal(struct browser_window *bw, nsurl *url)
|
||||
{
|
||||
assert(bw);
|
||||
assert(url);
|
||||
|
||||
if ((bw->parent != NULL) || (bw->window == NULL)) {
|
||||
/* Not root window or no gui window so do not set a URL */
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
return guit->window->set_url(bw->window, url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Browser window content event callback handler.
|
||||
*/
|
||||
@ -1393,6 +1414,7 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw)
|
||||
if (urldb_add_url(event->data.redirect.from)) {
|
||||
urldb_update_url_visit_data(event->data.redirect.from);
|
||||
}
|
||||
browser_window_refresh_url_bar_internal(bw, event->data.redirect.to);
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
@ -1773,27 +1795,6 @@ static void browser_window_destroy_internal(struct browser_window *bw)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update URL bar for a given browser window to given URL
|
||||
*
|
||||
* \param bw Browser window to update URL bar for.
|
||||
* \param url URL for content displayed by bw including any fragment.
|
||||
*/
|
||||
static inline nserror
|
||||
browser_window_refresh_url_bar_internal(struct browser_window *bw, nsurl *url)
|
||||
{
|
||||
assert(bw);
|
||||
assert(url);
|
||||
|
||||
if ((bw->parent != NULL) || (bw->window == NULL)) {
|
||||
/* Not root window or no gui window so do not set a URL */
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
return guit->window->set_url(bw->window, url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* scroll to a fragment if present
|
||||
*
|
||||
@ -3165,15 +3166,9 @@ nserror browser_window_refresh_url_bar(struct browser_window *bw)
|
||||
/* no content so return about:blank */
|
||||
ret = browser_window_refresh_url_bar_internal(bw,
|
||||
corestring_nsurl_about_blank);
|
||||
} else if (bw->throbbing) {
|
||||
/* We're throbbing, so show the loading parameters url,
|
||||
* or if there isn't one, the current parameters url
|
||||
*/
|
||||
if (bw->loading_parameters.url != NULL) {
|
||||
url = bw->loading_parameters.url;
|
||||
} else {
|
||||
url = bw->current_parameters.url;
|
||||
}
|
||||
} else if (bw->throbbing && bw->loading_parameters.url != NULL) {
|
||||
/* Throbbing and we have loading parameters, use those */
|
||||
url = bw->loading_parameters.url;
|
||||
ret = browser_window_refresh_url_bar_internal(bw, url);
|
||||
} else if (bw->frag_id == NULL) {
|
||||
if (bw->internal_nav) {
|
||||
|
Loading…
Reference in New Issue
Block a user