In case of OOM in DEBUG build, don't crash. No bug, rs=jwalden via IRC.

--HG--
extra : rebase_source : c08508a93d1c1a98606dc1c7c8d9c08c57e17cad
This commit is contained in:
Jason Orendorff 2010-03-05 16:29:44 -06:00
parent 71634c4850
commit bfaa2dc218

View File

@ -2902,8 +2902,10 @@ js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
if (clasp == &js_FunctionClass && !objectSize) {
obj = (JSObject*) js_NewGCFunction(cx);
#ifdef DEBUG
memset((uint8 *) obj + sizeof(JSObject), JS_FREE_PATTERN,
sizeof(JSFunction) - sizeof(JSObject));
if (obj) {
memset((uint8 *) obj + sizeof(JSObject), JS_FREE_PATTERN,
sizeof(JSFunction) - sizeof(JSObject));
}
#endif
} else {
JS_ASSERT(!objectSize || objectSize == sizeof(JSObject));