diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-05-04 16:42:47 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-05-04 16:42:47 +0100 |
commit | 9769e8f2c067b8f5bbebe3bede0ab223dbae357d (patch) | |
tree | 37ec1e693cc3278ca4bd6acb0f7273314f3e819e /content/handlers/html/html_script.c | |
parent | 36d83668c2070fb5085137178900dff7d3017e08 (diff) | |
download | netsurf-9769e8f2c067b8f5bbebe3bede0ab223dbae357d.tar.gz netsurf-9769e8f2c067b8f5bbebe3bede0ab223dbae357d.tar.bz2 |
Clean up async/defer JS contents during parent finalisation
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content/handlers/html/html_script.c')
-rw-r--r-- | content/handlers/html/html_script.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/content/handlers/html/html_script.c b/content/handlers/html/html_script.c index b404d2edf..6f62fb989 100644 --- a/content/handlers/html/html_script.c +++ b/content/handlers/html/html_script.c @@ -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); |