From 2521542a8af1b76d2aa303c76f0717594d752347 Mon Sep 17 00:00:00 2001 From: "brendan%mozilla.org" Date: Fri, 30 Apr 2004 02:43:50 +0000 Subject: [PATCH] Reload onbranch after possible native function calls (241050, r=shaver). --- js/src/jsinterp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/src/jsinterp.c b/js/src/jsinterp.c index 7fc9f1e8e817..5fa2153c9267 100644 --- a/js/src/jsinterp.c +++ b/js/src/jsinterp.c @@ -1794,9 +1794,12 @@ js_Interpret(JSContext *cx, jsval *result) /* * Prepare to call a user-supplied branch handler, and abort the script - * if it returns false. + * if it returns false. We reload onbranch after calling out to native + * functions (but not to getters, setters, or other native hooks). */ - onbranch = cx->branchCallback; +#define LOAD_BRANCH_CALLBACK(cx) (onbranch = (cx)->branchCallback) + + LOAD_BRANCH_CALLBACK(cx); ok = JS_TRUE; #define CHECK_BRANCH(len) \ JS_BEGIN_MACRO \ @@ -2938,6 +2941,7 @@ js_Interpret(JSContext *cx, jsval *result) SAVE_SP(fp); ok = js_Invoke(cx, argc, JSINVOKE_CONSTRUCT); RESTORE_SP(fp); + LOAD_BRANCH_CALLBACK(cx); LOAD_INTERRUPT_HANDLER(rt); if (!ok) { cx->newborn[GCX_OBJECT] = NULL; @@ -3365,6 +3369,7 @@ js_Interpret(JSContext *cx, jsval *result) ok = js_Invoke(cx, argc, 0); RESTORE_SP(fp); + LOAD_BRANCH_CALLBACK(cx); LOAD_INTERRUPT_HANDLER(rt); if (!ok) goto out; @@ -3401,6 +3406,7 @@ js_Interpret(JSContext *cx, jsval *result) SAVE_SP(fp); ok = js_Invoke(cx, argc, 0); RESTORE_SP(fp); + LOAD_BRANCH_CALLBACK(cx); LOAD_INTERRUPT_HANDLER(rt); if (!ok) goto out;