Bug 459160 - json.cpp misuses rooting api. r=mrbkap
authorRobert Sayre <sayrer@gmail.com>
Wed, 08 Oct 2008 23:22:35 -0400
changeset 20185 0b759f1c72e87518c10c60a7c4d78b22bc8f63ec
parent 20184 68efa47a724b58c6ffbed0411f10bc98312efd24
child 20186 143e49ad94822ab330609585a76ab257d1634d93
child 20354 259da40cd5329ffcdd575bc0ff132df2f4c40552
push idunknown
push userunknown
push dateunknown
reviewersmrbkap
bugs459160
milestone1.9.1b2pre
Bug 459160 - json.cpp misuses rooting api. r=mrbkap
js/src/json.cpp
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -397,17 +397,17 @@ js_BeginJSONParse(JSContext *cx, jsval *
         return NULL;
 
     JSONParser *jp = (JSONParser*) JS_malloc(cx, sizeof(JSONParser));
     if (!jp)
         return NULL;
     jp->buffer = NULL;
 
     jp->objectStack = arr;
-    if (!JS_AddRoot(cx, jp->objectStack))
+    if (!js_AddRoot(cx, &jp->objectStack, "JSON parse stack"))
         goto bad;
 
     jp->hexChar = 0;
     jp->numHex = 0;
     jp->statep = jp->stateStack;
     *jp->statep = JSON_PARSE_STATE_INIT;
     jp->rootVal = rootVal;
     jp->objectKey = NULL;
@@ -428,17 +428,17 @@ js_FinishJSONParse(JSContext *cx, JSONPa
 {
     if (!jp)
         return JS_TRUE;
 
     if (jp->buffer)
         js_FinishStringBuffer(jp->buffer);
 
     JS_free(cx, jp->buffer);
-    if (!JS_RemoveRoot(cx, jp->objectStack))
+    if (!js_RemoveRoot(cx->runtime, &jp->objectStack))
         return JS_FALSE;
     JSBool ok = *jp->statep == JSON_PARSE_STATE_FINISHED;
     JS_free(cx, jp);
 
     return ok;
 }
 
 static JSBool