Skip to content
Snippets Groups Projects
Commit 4ef020a8 authored by rswindell's avatar rswindell
Browse files

js_GenericBranchCallback() only terminates the script if branch.auto_terminated

is TRUE.
parent 1b52b64b
Branches
Tags
No related merge requests found
......@@ -200,22 +200,29 @@ js_GenericBranchCallback(JSContext *cx, js_branch_t* branch)
{
branch->counter++;
/* Terminated? */
if(branch->auto_terminate &&
(branch->terminated!=NULL && *branch->terminated)) {
JS_ReportError(cx,"Terminated");
branch->counter=0;
return(JS_FALSE);
}
/* Infinite loop? */
if(branch->limit && branch->counter > branch->limit) {
JS_ReportError(cx,"Infinite loop (%lu branches) detected",branch->counter);
branch->counter=0;
return(JS_FALSE);
}
/* Give up timeslices every once in a while */
if(branch->yield_interval && (branch->counter%branch->yield_interval)==0)
YIELD();
/* Periodic Garbage Collection */
if(branch->gc_interval && (branch->counter%branch->gc_interval)==0)
JS_MaybeGC(cx), branch->gc_attempts++;
if(branch->terminated!=NULL && *branch->terminated)
return(JS_FALSE);
return(JS_TRUE);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment