Bug 627758 - Detect forced GC end case to fix jsd.off() giving NS_ERROR_NOT_AVAILABLE, r=dmandelin
☠☠ backed out by 32cf4e3c7a20 ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Thu, 20 Jan 2011 22:10:54 -0800
changeset 61237 8743def9e74889fc13c351b574487dcde7b8bf20
parent 61236 47678330818a94f0d06aa5f79d9b6bd945b683fa
child 61238 b7e91bafdcd9b826f145199105d5ab1c2fab8978
push id18277
push usercleary@mozilla.com
push dateTue, 25 Jan 2011 03:52:51 +0000
treeherdermozilla-central@7ee91bd90e7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmandelin
bugs627758
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 627758 - Detect forced GC end case to fix jsd.off() giving NS_ERROR_NOT_AVAILABLE, r=dmandelin
js/jsd/jsd_xpc.cpp
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -518,18 +518,24 @@ jsds_GCCallbackProc (JSContext *cx, JSGC
     if (status == JSGC_END) {
         /* just to guard against reentering. */
         gGCStatus = JSGC_BEGIN;
         while (gDeadScripts)
             jsds_NotifyPendingDeadScripts (cx);
     }
 
     gGCStatus = status;
-    if (gLastGCProc)
-        return gLastGCProc (cx, status);
+    if (gLastGCProc && !gLastGCProc (cx, status)) {
+        /*
+         * If gLastGCProc returns false, then we're going to abort out
+         * of this GC pass without a JSGC_END callback.
+         */
+        gGCStatus = JSGC_END;
+        return JS_FALSE;
+    }
     
     return JS_TRUE;
 }
 
 static uintN
 jsds_ErrorHookProc (JSDContext *jsdc, JSContext *cx, const char *message,
                     JSErrorReport *report, void *callerdata)
 {
@@ -2590,17 +2596,18 @@ jsdService::Off (void)
     if (!mCx || !mRuntime)
         return NS_ERROR_NOT_INITIALIZED;
     
     if (gDeadScripts) {
         if (gGCStatus != JSGC_END)
             return NS_ERROR_NOT_AVAILABLE;
 
         JSContext *cx = JSD_GetDefaultJSContext(mCx);
-        jsds_NotifyPendingDeadScripts(cx);
+        while (gDeadScripts)
+            jsds_NotifyPendingDeadScripts (cx);
     }
 
     /*
     if (gLastGCProc != jsds_GCCallbackProc)
         JS_SetGCCallbackRT (mRuntime, gLastGCProc);
     */
 
     jsdContext::InvalidateAll();