mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 06:21:45 +03:00
fix error reporting from frameset creation
This commit is contained in:
parent
5c427ba845
commit
7ec49463da
@ -1311,6 +1311,7 @@ static nserror browser_window_callback(hlcache_handle *c,
|
||||
const hlcache_event *event, void *pw)
|
||||
{
|
||||
struct browser_window *bw = pw;
|
||||
nserror res = NSERROR_OK;
|
||||
|
||||
switch (event->type) {
|
||||
case CONTENT_MSG_DOWNLOAD:
|
||||
@ -1414,10 +1415,11 @@ static nserror browser_window_callback(hlcache_handle *c,
|
||||
}
|
||||
|
||||
/* frames */
|
||||
if (content_get_type(c) == CONTENT_HTML &&
|
||||
html_get_frameset(c) != NULL)
|
||||
browser_window_create_frameset(bw,
|
||||
if ((content_get_type(c) == CONTENT_HTML) &&
|
||||
(html_get_frameset(c) != NULL)) {
|
||||
res = browser_window_create_frameset(bw,
|
||||
html_get_frameset(c));
|
||||
}
|
||||
if (content_get_type(c) == CONTENT_HTML &&
|
||||
html_get_iframe(c) != NULL)
|
||||
browser_window_create_iframes(bw, html_get_iframe(c));
|
||||
@ -1704,7 +1706,7 @@ static nserror browser_window_callback(hlcache_handle *c,
|
||||
break;
|
||||
}
|
||||
|
||||
return NSERROR_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,14 +291,8 @@ void browser_window_recalculate_iframes(struct browser_window *bw)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create and open a frameset for a browser window.
|
||||
*
|
||||
* \param bw The browser window to create the frameset for
|
||||
* \param frameset The frameset to create
|
||||
*/
|
||||
|
||||
void browser_window_create_frameset(struct browser_window *bw,
|
||||
/* exported interface documented in desktop/frames.h */
|
||||
nserror browser_window_create_frameset(struct browser_window *bw,
|
||||
struct content_html_frames *frameset)
|
||||
{
|
||||
int row, col, index;
|
||||
@ -313,8 +307,10 @@ void browser_window_create_frameset(struct browser_window *bw,
|
||||
assert(frameset->cols + frameset->rows != 0);
|
||||
|
||||
bw->children = calloc((frameset->cols * frameset->rows), sizeof(*bw));
|
||||
if (!bw->children)
|
||||
return;
|
||||
if (!bw->children) {
|
||||
return NSERROR_NOMEM;
|
||||
}
|
||||
|
||||
bw->cols = frameset->cols;
|
||||
bw->rows = frameset->rows;
|
||||
for (row = 0; row < bw->rows; row++) {
|
||||
@ -344,8 +340,11 @@ void browser_window_create_frameset(struct browser_window *bw,
|
||||
window->margin_height = frame->margin_height;
|
||||
if (frame->name) {
|
||||
window->name = strdup(frame->name);
|
||||
if (!window->name)
|
||||
warn_user("NoMemory", 0);
|
||||
if (!window->name) {
|
||||
free(bw->children);
|
||||
bw->children = NULL;
|
||||
return NSERROR_NOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
window->scale = bw->scale;
|
||||
@ -406,6 +405,8 @@ void browser_window_create_frameset(struct browser_window *bw,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,8 +35,17 @@ struct scrollbar_msg_data;
|
||||
nserror browser_window_create_iframes(struct browser_window *bw,
|
||||
struct content_html_iframe *iframe);
|
||||
void browser_window_recalculate_iframes(struct browser_window *bw);
|
||||
void browser_window_create_frameset(struct browser_window *bw,
|
||||
|
||||
/**
|
||||
* Create and open a frameset for a browser window.
|
||||
*
|
||||
* \param[in,out] bw The browser window to create the frameset for
|
||||
* \param[in] frameset The frameset to create
|
||||
* \return NSERROR_OK or error code on faliure
|
||||
*/
|
||||
nserror browser_window_create_frameset(struct browser_window *bw,
|
||||
struct content_html_frames *frameset);
|
||||
|
||||
void browser_window_recalculate_frameset(struct browser_window *bw);
|
||||
bool browser_window_frame_resize_start(struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y,
|
||||
|
Loading…
Reference in New Issue
Block a user