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)
|
const hlcache_event *event, void *pw)
|
||||||
{
|
{
|
||||||
struct browser_window *bw = pw;
|
struct browser_window *bw = pw;
|
||||||
|
nserror res = NSERROR_OK;
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case CONTENT_MSG_DOWNLOAD:
|
case CONTENT_MSG_DOWNLOAD:
|
||||||
@ -1414,10 +1415,11 @@ static nserror browser_window_callback(hlcache_handle *c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* frames */
|
/* frames */
|
||||||
if (content_get_type(c) == CONTENT_HTML &&
|
if ((content_get_type(c) == CONTENT_HTML) &&
|
||||||
html_get_frameset(c) != NULL)
|
(html_get_frameset(c) != NULL)) {
|
||||||
browser_window_create_frameset(bw,
|
res = browser_window_create_frameset(bw,
|
||||||
html_get_frameset(c));
|
html_get_frameset(c));
|
||||||
|
}
|
||||||
if (content_get_type(c) == CONTENT_HTML &&
|
if (content_get_type(c) == CONTENT_HTML &&
|
||||||
html_get_iframe(c) != NULL)
|
html_get_iframe(c) != NULL)
|
||||||
browser_window_create_iframes(bw, html_get_iframe(c));
|
browser_window_create_iframes(bw, html_get_iframe(c));
|
||||||
@ -1704,7 +1706,7 @@ static nserror browser_window_callback(hlcache_handle *c,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NSERROR_OK;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,14 +291,8 @@ void browser_window_recalculate_iframes(struct browser_window *bw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/* exported interface documented in desktop/frames.h */
|
||||||
* Create and open a frameset for a browser window.
|
nserror browser_window_create_frameset(struct browser_window *bw,
|
||||||
*
|
|
||||||
* \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,
|
|
||||||
struct content_html_frames *frameset)
|
struct content_html_frames *frameset)
|
||||||
{
|
{
|
||||||
int row, col, index;
|
int row, col, index;
|
||||||
@ -313,8 +307,10 @@ void browser_window_create_frameset(struct browser_window *bw,
|
|||||||
assert(frameset->cols + frameset->rows != 0);
|
assert(frameset->cols + frameset->rows != 0);
|
||||||
|
|
||||||
bw->children = calloc((frameset->cols * frameset->rows), sizeof(*bw));
|
bw->children = calloc((frameset->cols * frameset->rows), sizeof(*bw));
|
||||||
if (!bw->children)
|
if (!bw->children) {
|
||||||
return;
|
return NSERROR_NOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
bw->cols = frameset->cols;
|
bw->cols = frameset->cols;
|
||||||
bw->rows = frameset->rows;
|
bw->rows = frameset->rows;
|
||||||
for (row = 0; row < bw->rows; row++) {
|
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;
|
window->margin_height = frame->margin_height;
|
||||||
if (frame->name) {
|
if (frame->name) {
|
||||||
window->name = strdup(frame->name);
|
window->name = strdup(frame->name);
|
||||||
if (!window->name)
|
if (!window->name) {
|
||||||
warn_user("NoMemory", 0);
|
free(bw->children);
|
||||||
|
bw->children = NULL;
|
||||||
|
return NSERROR_NOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window->scale = bw->scale;
|
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,
|
nserror browser_window_create_iframes(struct browser_window *bw,
|
||||||
struct content_html_iframe *iframe);
|
struct content_html_iframe *iframe);
|
||||||
void browser_window_recalculate_iframes(struct browser_window *bw);
|
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);
|
struct content_html_frames *frameset);
|
||||||
|
|
||||||
void browser_window_recalculate_frameset(struct browser_window *bw);
|
void browser_window_recalculate_frameset(struct browser_window *bw);
|
||||||
bool browser_window_frame_resize_start(struct browser_window *bw,
|
bool browser_window_frame_resize_start(struct browser_window *bw,
|
||||||
browser_mouse_state mouse, int x, int y,
|
browser_mouse_state mouse, int x, int y,
|
||||||
|
Loading…
Reference in New Issue
Block a user