summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-07-31 22:33:08 +0100
committerVincent Sanders <vince@netsurf-browser.org>2012-07-31 22:33:08 +0100
commit5c25b8255a9c3e62bf7ac1264cc5443ea3f14abc (patch)
tree14117974d2505afca36d0c462253aed1c6510d93
parent84152cd72b5971250ba37b7654856a15c03ba42b (diff)
downloadnetsurf-5c25b8255a9c3e62bf7ac1264cc5443ea3f14abc.tar.gz
netsurf-5c25b8255a9c3e62bf7ac1264cc5443ea3f14abc.tar.bz2
add post parse script execution
-rw-r--r--render/html.c3
-rw-r--r--render/html_internal.h1
-rw-r--r--render/html_script.c19
3 files changed, 9 insertions, 14 deletions
diff --git a/render/html.c b/render/html.c
index 4263a064d..069f290ef 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1972,6 +1972,9 @@ html_begin_conversion(html_content *htmlc)
return false;
}
+ /* complete script execution */
+ html_scripts_exec(htmlc);
+
htmlc->document = dom_hubbub_parser_get_document(htmlc->parser);
if (htmlc->document == NULL) {
diff --git a/render/html_internal.h b/render/html_internal.h
index 0f20cc1c3..b4e6d2c7c 100644
--- a/render/html_internal.h
+++ b/render/html_internal.h
@@ -158,6 +158,7 @@ void html_overflow_scroll_callback(void *client_data,
/* in render/html_script.c */
dom_hubbub_error html_process_script(void *ctx, dom_node *node);
void html_free_scripts(html_content *html);
+bool html_scripts_exec(html_content *c);
/* in render/html_forms.c */
struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);
diff --git a/render/html_script.c b/render/html_script.c
index f4d80ab54..b27abf7f4 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -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:
* 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;
struct html_script *s;
@@ -69,10 +69,8 @@ static bool html_scripts_exec(html_content *c)
continue;
}
- assert((s->type == HTML_SCRIPT_SYNC) ||
- (s->type == HTML_SCRIPT_INLINE));
-
- if (s->type == HTML_SCRIPT_SYNC) {
+ if ((s->type == HTML_SCRIPT_ASYNC) ||
+ (s->type == HTML_SCRIPT_DEFER)) {
/* ensure script content is present */
if (s->data.handle == NULL)
continue;
@@ -99,14 +97,7 @@ static bool html_scripts_exec(html_content *c)
s->already_started = true;
- } else {
- /* script not yet available */
-
- /* check if deferable or asynchronous */
- if (!s->defer && !s->async) {
- break;
- }
- }
+ }
}
}