Bug 831291 - GC: jsapi test Debugger fails under rooting analysis r=billm
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 16 Jan 2013 18:42:04 +0000
changeset 119143 935b891ba3988d9c6949e09dc404bb4a0f0e4df2
parent 119142 4959e4692993ebb0d5645da8d47337de9f8f32d7
child 119144 678cac97bf1ad9dc99b14d4f54f2e57d2f4d99b6
push id24195
push userMs2ger@gmail.com
push dateSat, 19 Jan 2013 16:10:11 +0000
treeherdermozilla-central@02e12a80aef9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs831291
milestone21.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 831291 - GC: jsapi test Debugger fails under rooting analysis r=billm
js/src/jsapi-tests/testDebugger.cpp
--- a/js/src/jsapi-tests/testDebugger.cpp
+++ b/js/src/jsapi-tests/testDebugger.cpp
@@ -156,35 +156,35 @@ BEGIN_TEST(testDebugger_debuggerObjectVs
     {
         JSAutoCompartment ae(cx, debuggee);
         CHECK(JS_SetDebugMode(cx, true));
         CHECK(JS_InitStandardClasses(cx, debuggee));
     }
 
     js::RootedObject debuggeeWrapper(cx, debuggee);
     CHECK(JS_WrapObject(cx, debuggeeWrapper.address()));
-    jsval v = OBJECT_TO_JSVAL(debuggeeWrapper);
-    CHECK(JS_SetProperty(cx, global, "debuggee", &v));
+    js::RootedValue v(cx, JS::ObjectValue(*debuggeeWrapper));
+    CHECK(JS_SetProperty(cx, global, "debuggee", v.address()));
 
     EVAL("var dbg = new Debugger(debuggee);\n"
          "var hits = 0;\n"
          "dbg.onDebuggerStatement = function () { hits++; };\n"
          "debuggee.eval('debugger;');\n"
          "hits;\n",
-         &v);
+         v.address());
     CHECK_SAME(v, JSVAL_ONE);
 
     {
         JSAutoCompartment ae(cx, debuggee);
         CHECK(JS_SetDebugMode(cx, false));
     }
 
     EVAL("debuggee.eval('debugger; debugger; debugger;');\n"
          "hits;\n",
-         &v);
+         v.address());
     CHECK_SAME(v, INT_TO_JSVAL(4));
 
     return true;
 }
 END_TEST(testDebugger_debuggerObjectVsDebugMode)
 
 BEGIN_TEST(testDebugger_newScriptHook)
 {
@@ -194,18 +194,18 @@ BEGIN_TEST(testDebugger_newScriptHook)
     CHECK(g);
     {
         JSAutoCompartment ae(cx, g);
         CHECK(JS_InitStandardClasses(cx, g));
     }
 
     js::RootedObject gWrapper(cx, g);
     CHECK(JS_WrapObject(cx, gWrapper.address()));
-    jsval v = OBJECT_TO_JSVAL(gWrapper);
-    CHECK(JS_SetProperty(cx, global, "g", &v));
+    js::RootedValue v(cx, JS::ObjectValue(*gWrapper));
+    CHECK(JS_SetProperty(cx, global, "g", v.address()));
 
     EXEC("var dbg = Debugger(g);\n"
          "var hits = 0;\n"
          "dbg.onNewScript = function (s) {\n"
          "    hits += Number(s instanceof Debugger.Script);\n"
          "};\n");
 
     // Since g is a debuggee, g.eval should trigger newScript, regardless of
@@ -221,16 +221,17 @@ bool testIndirectEval(JS::HandleObject s
 {
     EXEC("hits = 0;");
 
     {
         JSAutoCompartment ae(cx, scope);
         JSString *codestr = JS_NewStringCopyZ(cx, code);
         CHECK(codestr);
         jsval argv[1] = { STRING_TO_JSVAL(codestr) };
+        JS::AutoArrayRooter rooter(cx, 1, argv);
         jsval v;
         CHECK(JS_CallFunctionName(cx, scope, "eval", 1, argv, &v));
     }
 
     jsval hitsv;
     EVAL("hits", &hitsv);
     CHECK_SAME(hitsv, INT_TO_JSVAL(1));
     return true;