mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-20 17:39:58 +03:00
add post parse script execution
This commit is contained in:
parent
84152cd72b
commit
5c25b8255a
@ -1972,6 +1972,9 @@ html_begin_conversion(html_content *htmlc)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* complete script execution */
|
||||||
|
html_scripts_exec(htmlc);
|
||||||
|
|
||||||
htmlc->document = dom_hubbub_parser_get_document(htmlc->parser);
|
htmlc->document = dom_hubbub_parser_get_document(htmlc->parser);
|
||||||
|
|
||||||
if (htmlc->document == NULL) {
|
if (htmlc->document == NULL) {
|
||||||
|
@ -158,6 +158,7 @@ void html_overflow_scroll_callback(void *client_data,
|
|||||||
/* in render/html_script.c */
|
/* in render/html_script.c */
|
||||||
dom_hubbub_error html_process_script(void *ctx, dom_node *node);
|
dom_hubbub_error html_process_script(void *ctx, dom_node *node);
|
||||||
void html_free_scripts(html_content *html);
|
void html_free_scripts(html_content *html);
|
||||||
|
bool html_scripts_exec(html_content *c);
|
||||||
|
|
||||||
/* in render/html_forms.c */
|
/* in render/html_forms.c */
|
||||||
struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);
|
struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);
|
||||||
|
@ -49,13 +49,13 @@ static script_handler_t *select_script_handler(content_type ctype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* attempt to progress script execution
|
/* attempt defer and async script execution
|
||||||
*
|
*
|
||||||
* execute scripts using algorithm found in:
|
* execute scripts using algorithm found in:
|
||||||
* http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element
|
* http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool html_scripts_exec(html_content *c)
|
bool html_scripts_exec(html_content *c)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct html_script *s;
|
struct html_script *s;
|
||||||
@ -69,10 +69,8 @@ static bool html_scripts_exec(html_content *c)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert((s->type == HTML_SCRIPT_SYNC) ||
|
if ((s->type == HTML_SCRIPT_ASYNC) ||
|
||||||
(s->type == HTML_SCRIPT_INLINE));
|
(s->type == HTML_SCRIPT_DEFER)) {
|
||||||
|
|
||||||
if (s->type == HTML_SCRIPT_SYNC) {
|
|
||||||
/* ensure script content is present */
|
/* ensure script content is present */
|
||||||
if (s->data.handle == NULL)
|
if (s->data.handle == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -99,13 +97,6 @@ static bool html_scripts_exec(html_content *c)
|
|||||||
|
|
||||||
s->already_started = true;
|
s->already_started = true;
|
||||||
|
|
||||||
} else {
|
|
||||||
/* script not yet available */
|
|
||||||
|
|
||||||
/* check if deferable or asynchronous */
|
|
||||||
if (!s->defer && !s->async) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user