Clean up async/defer JS contents during parent finalisation

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2019-05-04 16:42:47 +01:00
parent 36d83668c2
commit 9769e8f2c0
1 changed files with 15 additions and 10 deletions

View File

@ -597,16 +597,21 @@ nserror html_script_free(html_content *html)
dom_string_unref(html->scripts[i].mimetype);
}
if ((html->scripts[i].type == HTML_SCRIPT_INLINE) &&
(html->scripts[i].data.string != NULL)) {
dom_string_unref(html->scripts[i].data.string);
} else if ((html->scripts[i].type == HTML_SCRIPT_SYNC) &&
(html->scripts[i].data.handle != NULL)) {
hlcache_handle_release(html->scripts[i].data.handle);
switch (html->scripts[i].type) {
case HTML_SCRIPT_INLINE:
if (html->scripts[i].data.string != NULL) {
dom_string_unref(html->scripts[i].data.string);
}
break;
case HTML_SCRIPT_SYNC:
/* fallthrough */
case HTML_SCRIPT_ASYNC:
/* fallthrough */
case HTML_SCRIPT_DEFER:
if (html->scripts[i].data.handle != NULL) {
hlcache_handle_release(html->scripts[i].data.handle);
}
break;
}
}
free(html->scripts);