1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
elinks/src/ecmascript/spidermonkey/heartbeat.h
Miciah Dashiel Butler Masters f31cf6f9fe Heartbeat code using JS_TriggerOperationCallback
Implement new heartbeat code to catch runaway execution of document
ECMAScript code.  The old code uses JS_SetBranchCallback which is
deprecated in new versions of SpiderMonkey.  The new code uses setitimer(2)
and the JS_SetOperationCallback and JS_TriggerOperationCallback interfaces,
introduced in SpiderMonkey 1.8.1.  Compatibility with both the old
JS_SetBranchCallback and the new interfaces is maintained.
2009-11-26 00:57:21 +00:00

25 lines
703 B
C

#ifndef EL__ECMASCRIPT_SPIDERMONKEY_HEARTBEAT_H
#define EL__ECMASCRIPT_SPIDERMONKEY_HEARTBEAT_H
#include "ecmascript/spidermonkey/util.h"
#include "ecmascript/spidermonkey.h"
struct heartbeat {
LIST_HEAD(struct heartbeat);
int ttl; /* Time to live. This value is assigned when the
* script begins execution and is decremented every
* second. When it reaches 0, script execution is
* terminated. */
struct ecmascript_interpreter *interpreter;
};
struct heartbeat *add_heartbeat(struct ecmascript_interpreter *interpreter);
void done_heartbeat(struct heartbeat *hb);
JSBool heartbeat_callback(JSContext *ctx);
#endif