Fix GC hazard when constructing functions, bug 698156.

This commit is contained in:
Brian Hackett 2011-10-30 08:27:19 -07:00
parent 60d061e5cc
commit 83ca66c7ef

View File

@ -2350,8 +2350,6 @@ js_NewFunction(JSContext *cx, JSObject *funobj, Native native, uintN nargs,
funobj = NewFunction(cx, SkipScopeParent(parent), kind);
if (!funobj)
return NULL;
if (native && !funobj->setSingletonType(cx))
return NULL;
}
fun = static_cast<JSFunction *>(funobj);
@ -2381,6 +2379,9 @@ js_NewFunction(JSContext *cx, JSObject *funobj, Native native, uintN nargs,
}
fun->atom = atom;
if (native && !fun->setSingletonType(cx))
return NULL;
return fun;
}