HTML: Don't transition the content state machine if we do nothing

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2020-02-21 14:09:21 +00:00
parent 9232b8feda
commit 2f8868309a
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74

View File

@ -60,6 +60,7 @@ nserror html_script_exec(html_content *c, bool allow_defer)
unsigned int i; unsigned int i;
struct html_script *s; struct html_script *s;
script_handler_t *script_handler; script_handler_t *script_handler;
bool have_run_something = false;
if (c->jscontext == NULL) { if (c->jscontext == NULL) {
return NSERROR_BAD_PARAMETER; return NSERROR_BAD_PARAMETER;
@ -96,6 +97,7 @@ nserror html_script_exec(html_content *c, bool allow_defer)
s->data.handle, &size ); s->data.handle, &size );
script_handler(c->jscontext, data, size, script_handler(c->jscontext, data, size,
nsurl_access(hlcache_handle_get_url(s->data.handle))); nsurl_access(hlcache_handle_get_url(s->data.handle)));
have_run_something = true;
/* We have to re-acquire this here since the /* We have to re-acquire this here since the
* c->scripts array may have been reallocated * c->scripts array may have been reallocated
* as a result of executing this script. * as a result of executing this script.
@ -108,7 +110,11 @@ nserror html_script_exec(html_content *c, bool allow_defer)
} }
} }
return html_proceed_to_done(c); if (have_run_something) {
return html_proceed_to_done(c);
}
return NSERROR_OK;
} }
/* create new html script entry */ /* create new html script entry */