summaryrefslogtreecommitdiff
path: root/render/html_internal.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-03-09 13:47:12 +0000
committerVincent Sanders <vince@kyllikki.org>2015-03-09 13:47:12 +0000
commit84c29f1d8628fd77de72269b0f424d402fa59a47 (patch)
tree9ff54f5e665ad026fe6ab5dc562ad145d8e62e3e /render/html_internal.h
parentc4e551cd0cecf4ec9aba2d033cba3ca97e669463 (diff)
downloadnetsurf-84c29f1d8628fd77de72269b0f424d402fa59a47.tar.gz
netsurf-84c29f1d8628fd77de72269b0f424d402fa59a47.tar.bz2
Add invalidate API to html content script handling and use it.
The html content script handling needs to invalidate its JavaScript context when the browsing context (browser_window) containing it is either closed or the content fetch is aborted (stopped) Previously the invalidation was only done on browser_window close which resulted in use after free crashes because of the now invalid JavaScript context.
Diffstat (limited to 'render/html_internal.h')
-rw-r--r--render/html_internal.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/render/html_internal.h b/render/html_internal.h
index fd5cf8443..97ac2da55 100644
--- a/render/html_internal.h
+++ b/render/html_internal.h
@@ -264,9 +264,34 @@ void html_search_clear(struct content *c);
/* 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);
+dom_hubbub_error html_process_script(void *ctx, dom_node *node);
+
+/**
+ * Attempt script execution for defer and async scripts
+ *
+ * execute scripts using algorithm found in:
+ * http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element
+ *
+ * \param htmlc html content.
+ * \return NSERROR_OK error code.
+ */
+nserror html_script_exec(html_content *htmlc);
+
+/**
+ * Free all script resources and references for a html content.
+ *
+ * \param htmlc html content.
+ * \return NSERROR_OK or error code.
+ */
+nserror html_script_free(html_content *htmlc);
+
+/**
+ * Ensure the html content javascript context is invalidated.
+ *
+ * \param htmlc html content.
+ * \return NSERROR_OK or error code.
+ */
+nserror html_script_invalidate_ctx(html_content *htmlc);
/* in render/html_forms.c */
struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);