Bug 1122195 - Only allow objects for setGCCallback parameter, r=terrence
authorSteve Fink <sfink@mozilla.com>
Fri, 16 Jan 2015 12:50:19 -0800
changeset 251441 fd38183fccea02e62b3bc15b33b77cdcf48dcba4
parent 251440 fc089bc9d516ec410b3fc87266d54a42b1ff1dc4
child 251442 183898a49db1cb21949510481a4a35da2f81a2e0
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1122195
milestone38.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 1122195 - Only allow objects for setGCCallback parameter, r=terrence
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1708,18 +1708,18 @@ SetGCCallback(JSContext *cx, unsigned ar
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() != 1) {
         JS_ReportError(cx, "Wrong number of arguments");
         return false;
     }
 
-    RootedObject opts(cx);
-    if (!JS_ValueToObject(cx, args[0], &opts))
+    RootedObject opts(cx, ToObject(cx, args[0]));
+    if (!opts)
         return false;
 
     RootedValue v(cx);
     if (!JS_GetProperty(cx, opts, "action", &v))
         return false;
 
     JSString *str = JS::ToString(cx, v);
     if (!str)