mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 00:55:37 +00:00
Remove leftover use of js_NewArrayObjectWithCapacity (follow-up for bug 581264).
This commit is contained in:
parent
283b5621fc
commit
c54e460702
@ -5038,17 +5038,17 @@ FunctionType::ArgTypesGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp
|
||||
size_t len = fninfo->mArgTypes.length();
|
||||
|
||||
// Prepare a new array.
|
||||
jsval* vec;
|
||||
JSObject* argTypes =
|
||||
js_NewArrayObjectWithCapacity(cx, len, &vec);
|
||||
if (!argTypes)
|
||||
Array<jsval, 16> vec;
|
||||
if (!vec.resize(len))
|
||||
return JS_FALSE;
|
||||
js::AutoObjectRooter argsroot(cx, argTypes);
|
||||
JS_ASSERT(len == 0 || vec);
|
||||
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
vec[i] = OBJECT_TO_JSVAL(fninfo->mArgTypes[i]);
|
||||
|
||||
JSObject* argTypes = JS_NewArrayObject(cx, len, vec.begin());
|
||||
if (!argTypes)
|
||||
return JS_FALSE;
|
||||
|
||||
// Seal and cache it.
|
||||
if (!JS_SealObject(cx, argTypes, JS_FALSE) ||
|
||||
!JS_SetReservedSlot(cx, obj, SLOT_ARGS_T, OBJECT_TO_JSVAL(argTypes)))
|
||||
|
Loading…
Reference in New Issue
Block a user