From 39a9bd6c3f3376ca539da72cf7f4fbc85e80aa49 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Mon, 31 Jan 2011 15:00:52 -0800 Subject: [PATCH] Bug 627758 - Handle cancelled GC runs properly (r=dmandelin) --HG-- extra : rebase_source : a215df78cb2bedb190f8655df4cd5b7dd6ec5f3a --- js/jsd/jsd_xpc.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/jsd/jsd_xpc.cpp b/js/jsd/jsd_xpc.cpp index c2386c122024..e36928688957 100644 --- a/js/jsd/jsd_xpc.cpp +++ b/js/jsd/jsd_xpc.cpp @@ -523,8 +523,15 @@ jsds_GCCallbackProc (JSContext *cx, JSGCStatus status) } gGCStatus = status; - if (gLastGCProc) - return gLastGCProc (cx, status); + if (gLastGCProc && !gLastGCProc (cx, status)) { + /* + * If gLastGCProc returns false, then the GC will abort without making + * another callback with status=JSGC_END, so set the status to JSGC_END + * here. + */ + gGCStatus = JSGC_END; + return JS_FALSE; + } return JS_TRUE; } @@ -2599,7 +2606,8 @@ jsdService::Off (void) return NS_ERROR_NOT_AVAILABLE; JSContext *cx = JSD_GetDefaultJSContext(mCx); - jsds_NotifyPendingDeadScripts(cx); + while (gDeadScripts) + jsds_NotifyPendingDeadScripts (cx); } /*