summaryrefslogtreecommitdiff
path: root/javascript/js.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2013-05-19 23:48:55 +0100
committerVincent Sanders <vince@netsurf-browser.org>2013-05-22 19:12:26 +0100
commitce0fe06349753b2ad1cfa7b0b1cfcaa77c4e47ab (patch)
tree695b26567b3277cc799ee5d925cf9a46454fb806 /javascript/js.h
parent447c0fc2715ef690f47bda0da60ee3c3d750950d (diff)
downloadnetsurf-ce0fe06349753b2ad1cfa7b0b1cfcaa77c4e47ab.tar.gz
netsurf-ce0fe06349753b2ad1cfa7b0b1cfcaa77c4e47ab.tar.bz2
create javascript heartbeat and hook a script timeout to it
Diffstat (limited to 'javascript/js.h')
-rw-r--r--javascript/js.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/javascript/js.h b/javascript/js.h
index 44de4fe3d..7102fcf0e 100644
--- a/javascript/js.h
+++ b/javascript/js.h
@@ -26,6 +26,8 @@
typedef struct jscontext jscontext;
typedef struct jsobject jsobject;
+typedef bool(jscallback)(void *ctx);
+
struct dom_document;
struct dom_node;
struct dom_string;
@@ -38,9 +40,13 @@ void js_finalise(void);
/** Create a new javascript context.
*
- * There aare usually one context per browser context
+ * There is usually one context per browser context
+ *
+ * \param timeout elapsed wallclock time (in seconds) before \a callback is called
+ * \param cb the callback when the runtime exceeds the timeout
+ * \param cbctx The context to pass to the callback
*/
-jscontext *js_newcontext(void);
+jscontext *js_newcontext(int timeout, jscallback *cb, void *cbctx);
/** Destroy a previously created context */
void js_destroycontext(jscontext *ctx);