mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-22 02:12:10 +03:00
make history update return error code.
This now returns errors instead of failing and inconsistantly calling user warnings for some error paths.
This commit is contained in:
parent
b1ee46cfb3
commit
8947af72ce
@ -555,14 +555,8 @@ nserror browser_window_history_add(struct browser_window *bw,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the thumbnail for the current entry.
|
||||
*
|
||||
* \param history opaque history structure, as returned by history_create()
|
||||
* \param content content for current entry
|
||||
*/
|
||||
|
||||
void browser_window_history_update(struct browser_window *bw,
|
||||
/* exported interface documented in desktop/browser_history.h */
|
||||
nserror browser_window_history_update(struct browser_window *bw,
|
||||
struct hlcache_handle *content)
|
||||
{
|
||||
struct history *history;
|
||||
@ -572,23 +566,24 @@ void browser_window_history_update(struct browser_window *bw,
|
||||
|
||||
history = bw->history;
|
||||
|
||||
if (!history || !history->current || !history->current->bitmap)
|
||||
return;
|
||||
if (!history || !history->current || !history->current->bitmap) {
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
assert(history->current->page.url);
|
||||
assert(history->current->page.title);
|
||||
|
||||
title = strdup(content_get_title(content));
|
||||
if (!title) {
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
if (title == NULL) {
|
||||
return NSERROR_NOMEM;
|
||||
}
|
||||
|
||||
assert(title);
|
||||
free(history->current->page.title);
|
||||
history->current->page.title = title;
|
||||
|
||||
thumbnail_create(content, history->current->bitmap, NULL);
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,8 +48,17 @@ nserror browser_window_history_clone(const struct browser_window *existing,
|
||||
*/
|
||||
nserror browser_window_history_add(struct browser_window *bw,
|
||||
struct hlcache_handle *content, lwc_string *frag_id);
|
||||
void browser_window_history_update(struct browser_window *bw,
|
||||
|
||||
/**
|
||||
* Update the thumbnail for the current entry.
|
||||
*
|
||||
* \param bw The browser window to update the history within.
|
||||
* \param content content for current entry
|
||||
* \return NSERROR_OK or error code on faliure.
|
||||
*/
|
||||
nserror browser_window_history_update(struct browser_window *bw,
|
||||
struct hlcache_handle *content);
|
||||
|
||||
void browser_window_history_destroy(struct browser_window *bw);
|
||||
void browser_window_history_back(struct browser_window *bw, bool new_window);
|
||||
void browser_window_history_forward(struct browser_window *bw, bool new_window);
|
||||
|
Loading…
Reference in New Issue
Block a user