Bug 929786 - Don't forget that JS_ValueToObject can return null (r=bustage)
authorLuke Wagner <luke@mozilla.com>
Thu, 24 Oct 2013 09:47:03 -0500
changeset 151975 c24460e2b77deecbab829489ea748ef86a5f14df
parent 151974 20feee5f3866cc9cc09e04034b5704f2738c00c8
child 151976 229a8f20d8ede064aa52a43dfc74b41e421b6156
push id35374
push userlwagner@mozilla.com
push dateThu, 24 Oct 2013 14:52:44 +0000
treeherdermozilla-inbound@c24460e2b77d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs929786
milestone27.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 929786 - Don't forget that JS_ValueToObject can return null (r=bustage)
js/src/builtin/TestingFunctions.cpp
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -1322,16 +1322,21 @@ static bool
 Neuter(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedObject obj(cx);
     if (!JS_ValueToObject(cx, args.get(0), &obj))
         return false;
 
+    if (!obj) {
+        JS_ReportError(cx, "neuter must be passed an object");
+        return false;
+    }
+
     void *contents;
     uint8_t *data;
     if (!JS_StealArrayBufferContents(cx, obj, &contents, &data))
         return false;
 
     js_free(contents);
     return true;
 }