Subj : Re: Stopping scripte execution To : netscape.public.mozilla.jseng From : Jens Thiele Date : Sat Nov 27 2004 09:12 am Jun Kim schrieb: > Is there any API that stops the process of executing script? > Like the way that IE stops the script when pressing "stop browsing" button. > I can't seem to find. > > Regard, Jun Well stopping script execution from within native code is simply a matter of returning JS_FALSE and somewhere stroring information that this was not a real error: static JSBool ejs_exit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { [...] exiting=true; return JS_FALSE; } Now additionally you want something like an interrupt mechanism. Didn't try it myself yet but it seems registering a callback via JS_SetBranchCallback http://www.sterlingbates.com/jsref/gen/api-JS_SetBranchCallback.html is the suggested method Jens .