summaryrefslogtreecommitdiff
path: root/content/handlers/javascript/js.h
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-03-22 10:14:00 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-03-22 10:14:00 +0000
commitd1e2eef18b25e97c7c06068aa519003605202853 (patch)
tree8044c7984e413c8bb8e370b4031578801042e3fb /content/handlers/javascript/js.h
parentefbfaa0cb1808a3953f1595b9c5e1be9d7994469 (diff)
downloadnetsurf-d1e2eef18b25e97c7c06068aa519003605202853.tar.gz
netsurf-d1e2eef18b25e97c7c06068aa519003605202853.tar.bz2
JS: Add concept of js_closethread
In order to better model content close vs destroy, add the concept of closing a thread to the JS interface. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content/handlers/javascript/js.h')
-rw-r--r--content/handlers/javascript/js.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/content/handlers/javascript/js.h b/content/handlers/javascript/js.h
index ce9bb9ba4..55f8e22ef 100644
--- a/content/handlers/javascript/js.h
+++ b/content/handlers/javascript/js.h
@@ -97,14 +97,27 @@ void js_destroyheap(jsheap *heap);
nserror js_newthread(jsheap *heap, void *win_priv, void *doc_priv, jsthread **thread);
/**
+ * Close a javascript thread
+ *
+ * This should be called when the HTML content which owns the thread is
+ * being closed. This is a separate process from destroying the thread
+ * and merely disconnects any callbacks and thus hopefully stops
+ * additional JS things from triggering. If any code runs and attempts to
+ * register callbacks after closedown, they will fail.
+ *
+ * \param thread The thread to close down
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror js_closethread(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.
+ * This will be called when the HTML content associated with the browsing
+ * context is being destroyed. The thread should have already been closed
+ * down during the HTML content close.
*
* \param thread The thread to be destroyed
*/