mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-21 19:52:47 +03:00
HTML: Complete content state machine after async script
The async script completion process needs to complete the content state machine so that browser throbbers eventually stop once async scripts have fetched and run, even if that happens *after* conversion finishes. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
4ef5c6cdb4
commit
db370bfdb7
@ -268,13 +268,31 @@ static void html_box_convert_done(html_content *c, bool success)
|
||||
|
||||
content_set_ready(&c->base);
|
||||
|
||||
if (c->base.active == 0) {
|
||||
content_set_done(&c->base);
|
||||
}
|
||||
html_proceed_to_done(c);
|
||||
|
||||
dom_node_unref(html);
|
||||
}
|
||||
|
||||
/* Documented in html_internal.h */
|
||||
nserror
|
||||
html_proceed_to_done(html_content *html)
|
||||
{
|
||||
switch (content__get_status(&html->base)) {
|
||||
case CONTENT_STATUS_READY:
|
||||
if (html->base.active == 0) {
|
||||
content_set_done(&html->base);
|
||||
return NSERROR_OK;
|
||||
}
|
||||
break;
|
||||
case CONTENT_STATUS_DONE:
|
||||
return NSERROR_OK;
|
||||
default:
|
||||
NSLOG(netsurf, ERROR, "Content status unexpectedly not READY/DONE");
|
||||
break;
|
||||
}
|
||||
return NSERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/** process link node */
|
||||
static bool html_process_link(html_content *c, dom_node *node)
|
||||
|
@ -396,6 +396,12 @@ nserror html_object_close_objects(html_content *html);
|
||||
nserror html_object_open_objects(html_content *html, struct browser_window *bw);
|
||||
nserror html_object_abort_objects(html_content *html);
|
||||
|
||||
/**
|
||||
* Complete the HTML content state machine *iff* all scripts are finished
|
||||
*/
|
||||
nserror html_proceed_to_done(html_content *html);
|
||||
|
||||
|
||||
/* Events */
|
||||
/**
|
||||
* Construct an event and fire it at the DOM
|
||||
|
@ -108,7 +108,7 @@ nserror html_script_exec(html_content *c, bool allow_defer)
|
||||
}
|
||||
}
|
||||
|
||||
return NSERROR_OK;
|
||||
return html_proceed_to_done(c);
|
||||
}
|
||||
|
||||
/* create new html script entry */
|
||||
@ -208,7 +208,7 @@ convert_script_async_cb(hlcache_handle *script,
|
||||
* scripts as they come in.
|
||||
*/
|
||||
else if (parent->conversion_begun) {
|
||||
html_script_exec(parent, false);
|
||||
return html_script_exec(parent, false);
|
||||
}
|
||||
|
||||
return NSERROR_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user