Bug 898964 - Exactly root the global JSObject*'s in testResolveRecursive; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Sun, 28 Jul 2013 21:59:04 -0700
changeset 153093 895d95fc58bb432a8c5a3c1901c9895d9935884d
parent 153092 f7622a58c17a8f88e2f3e5a9ada7c7f464bcaea6
child 153094 b2f43bbdf3420afe4570df3f2a7f76912de518d5
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs898964
milestone25.0a1
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 898964 - Exactly root the global JSObject*'s in testResolveRecursive; r=sfink
js/src/jsapi-tests/testResolveRecursion.cpp
--- a/js/src/jsapi-tests/testResolveRecursion.cpp
+++ b/js/src/jsapi-tests/testResolveRecursion.cpp
@@ -22,16 +22,20 @@ BEGIN_TEST(testResolveRecursion)
         JS_DeletePropertyStub, // delete
         JS_PropertyStub,       // get
         JS_StrictPropertyStub, // set
         JS_EnumerateStub,
         (JSResolveOp) my_resolve,
         JS_ConvertStub
     };
 
+    obj1 = obj2 = NULL;
+    JS_AddObjectRoot(cx, &obj1);
+    JS_AddObjectRoot(cx, &obj2);
+
     obj1 = JS_NewObject(cx, &my_resolve_class, NULL, NULL);
     CHECK(obj1);
     obj2 = JS_NewObject(cx, &my_resolve_class, NULL, NULL);
     CHECK(obj2);
     JS_SetPrivate(obj1, this);
     JS_SetPrivate(obj2, this);
 
     CHECK(JS_DefineProperty(cx, global, "obj1", OBJECT_TO_JSVAL(obj1), NULL, NULL, 0));
@@ -41,16 +45,19 @@ BEGIN_TEST(testResolveRecursion)
     resolveExitCount = 0;
 
     /* Start the essence of the test via invoking the first resolve hook. */
     JS::RootedValue v(cx);
     EVAL("obj1.x", v.address());
     CHECK_SAME(v, JSVAL_FALSE);
     CHECK_EQUAL(resolveEntryCount, 4);
     CHECK_EQUAL(resolveExitCount, 4);
+
+    JS_RemoveObjectRoot(cx, &obj1);
+    JS_RemoveObjectRoot(cx, &obj2);
     return true;
 }
 
 JSObject *obj1;
 JSObject *obj2;
 unsigned resolveEntryCount;
 unsigned resolveExitCount;