From 337082f715951fe9f5b46f1a4710ca415f67e22d Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 21 Mar 2020 18:57:57 +0000 Subject: [PATCH] JS: Add concept of thread destroy Signed-off-by: Daniel Silverstone --- content/handlers/javascript/js.h | 14 ++++++++++++++ content/handlers/javascript/none/none.c | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/content/handlers/javascript/js.h b/content/handlers/javascript/js.h index 126cb7cfb..ce9bb9ba4 100644 --- a/content/handlers/javascript/js.h +++ b/content/handlers/javascript/js.h @@ -96,6 +96,20 @@ void js_destroyheap(jsheap *heap); */ nserror js_newthread(jsheap *heap, void *win_priv, void *doc_priv, jsthread **thread); +/** + * Destroy a javascript thread + * + * This should be called when the browsing context is done with the thread. + * + * Essentially it should be called when the content is about to be destroyed + * but in reality it can be called when the browser window relinquishes its + * handle on the content since nominally the browser window itself owns + * the thread. + * + * \param thread The thread to be destroyed + */ +void js_destroythread(jsthread *thread); + /** * execute some javascript in a context */ diff --git a/content/handlers/javascript/none/none.c b/content/handlers/javascript/none/none.c index b79d3242f..ff09f52c9 100644 --- a/content/handlers/javascript/none/none.c +++ b/content/handlers/javascript/none/none.c @@ -51,6 +51,10 @@ nserror js_newthread(jsheap *heap, void *win_priv, void *doc_priv, jsthread **th return NSERROR_NOT_IMPLEMENTED; } +void js_destroythread(jsthread *thread) +{ +} + bool js_exec(jsthread *thread, const uint8_t *txt, size_t txtlen, const char *name) { return true;