mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 04:22:56 +00:00
Bug 828248 - Part b: Pass MutableHandleId to IndexToId and IndexToIdSlow; r=sfink
This commit is contained in:
parent
d43e8bee85
commit
23f700bed5
@ -1805,7 +1805,7 @@ ParallelArrayObject::defineElement(JSContext *cx, HandleObject obj,
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
@ -1929,7 +1929,7 @@ ParallelArrayObject::setElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleValue vp, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return setGeneric(cx, obj, id, vp, strict);
|
||||
}
|
||||
@ -2005,7 +2005,7 @@ ParallelArrayObject::setElementAttributes(JSContext *cx, HandleObject obj, uint3
|
||||
unsigned *attrsp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return setGenericAttributes(cx, obj, id, attrsp);
|
||||
}
|
||||
@ -2051,7 +2051,7 @@ ParallelArrayObject::deleteElement(JSContext *cx, HandleObject obj, uint32_t ind
|
||||
MutableHandleValue rval, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return deleteGeneric(cx, obj, id, rval, strict);
|
||||
}
|
||||
|
@ -3613,7 +3613,7 @@ JS_LookupElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_LookupPropertyById(cx, obj, id, vp);
|
||||
@ -3686,7 +3686,7 @@ JS_HasElement(JSContext *cx, JSObject *objArg, uint32_t index, JSBool *foundp)
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_HasPropertyById(cx, obj, id, foundp);
|
||||
@ -3737,7 +3737,7 @@ JS_AlreadyHasOwnElement(JSContext *cx, JSObject *objArg, uint32_t index, JSBool
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_AlreadyHasOwnPropertyById(cx, obj, id, foundp);
|
||||
@ -3874,7 +3874,7 @@ JS_DefineElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval valueArg
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return DefinePropertyById(cx, obj, id, value, GetterWrapper(getter),
|
||||
SetterWrapper(setter), attrs, 0, 0);
|
||||
@ -7098,9 +7098,13 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_IndexToId(JSContext *cx, uint32_t index, jsid *id)
|
||||
JS_IndexToId(JSContext *cx, uint32_t index, jsid *idp)
|
||||
{
|
||||
return IndexToId(cx, index, id);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
*idp = id;
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -263,7 +263,7 @@ JSObject::arrayGetOwnDataElement(JSContext *cx, size_t i, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, i, &id))
|
||||
return false;
|
||||
|
||||
@ -279,7 +279,7 @@ bool
|
||||
DoubleIndexToId(JSContext *cx, double index, MutableHandleId id)
|
||||
{
|
||||
if (index == uint32_t(index))
|
||||
return IndexToId(cx, uint32_t(index), id.address());
|
||||
return IndexToId(cx, uint32_t(index), id);
|
||||
|
||||
return ValueToId(cx, DoubleValue(index), id);
|
||||
}
|
||||
@ -868,7 +868,7 @@ array_setElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleValue vp, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
if (!obj->isDenseArray())
|
||||
@ -2258,7 +2258,7 @@ NewbornArrayPushImpl(JSContext *cx, HandleObject obj, const Value &v)
|
||||
/* This can happen in one evil case. See bug 630377. */
|
||||
RootedId id(cx);
|
||||
RootedValue nv(cx, v);
|
||||
return IndexToId(cx, length, id.address()) &&
|
||||
return IndexToId(cx, length, &id) &&
|
||||
baseops::DefineGeneric(cx, obj, id, nv, NULL, NULL, JSPROP_ENUMERATE);
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ js::AtomizeChars(JSContext *cx, const jschar *chars, size_t length, InternBehavi
|
||||
}
|
||||
|
||||
bool
|
||||
js::IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp)
|
||||
js::IndexToIdSlow(JSContext *cx, uint32_t index, MutableHandleId idp)
|
||||
{
|
||||
JS_ASSERT(index > JSID_INT_MAX);
|
||||
|
||||
@ -410,7 +410,7 @@ js::IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp)
|
||||
if (!atom)
|
||||
return false;
|
||||
|
||||
*idp = JSID_FROM_BITS((size_t)atom);
|
||||
idp.set(JSID_FROM_BITS((size_t)atom));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -95,15 +95,15 @@ BackfillIndexInCharBuffer(uint32_t index, mozilla::RangedPtr<T> end)
|
||||
}
|
||||
|
||||
bool
|
||||
IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp);
|
||||
IndexToIdSlow(JSContext *cx, uint32_t index, MutableHandleId idp);
|
||||
|
||||
inline bool
|
||||
IndexToId(JSContext *cx, uint32_t index, jsid *idp)
|
||||
IndexToId(JSContext *cx, uint32_t index, MutableHandleId idp)
|
||||
{
|
||||
MaybeCheckStackRoots(cx);
|
||||
|
||||
if (index <= JSID_INT_MAX) {
|
||||
*idp = INT_TO_JSID(index);
|
||||
idp.set(INT_TO_JSID(index));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ js_SuppressDeletedProperty(JSContext *cx, HandleObject obj, jsid id)
|
||||
bool
|
||||
js_SuppressDeletedElement(JSContext *cx, HandleObject obj, uint32_t index)
|
||||
{
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return js_SuppressDeletedProperty(cx, obj, id);
|
||||
|
@ -1545,7 +1545,7 @@ JSObject::nonNativeSetElement(JSContext *cx, HandleObject obj,
|
||||
{
|
||||
if (JS_UNLIKELY(obj->watched())) {
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
WatchpointMap *wpmap = cx->compartment->watchpointMap;
|
||||
@ -2896,7 +2896,7 @@ baseops::DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleVa
|
||||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
return DefineNativeProperty(cx, obj, id, value, getter, setter, attrs, 0, 0);
|
||||
@ -3174,7 +3174,7 @@ baseops::LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
return LookupPropertyWithFlagsInline(cx, obj, id, cx->resolveFlags, objp, propp);
|
||||
@ -3430,7 +3430,7 @@ JSBool
|
||||
baseops::GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
@ -3772,7 +3772,7 @@ baseops::SetElementHelper(JSContext *cx, HandleObject obj, HandleObject receiver
|
||||
unsigned defineHow, MutableHandleValue vp, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return baseops::SetPropertyHelper(cx, obj, receiver, id, defineHow, vp, strict);
|
||||
}
|
||||
@ -3895,7 +3895,7 @@ baseops::DeleteElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleValue rval, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return baseops::DeleteGeneric(cx, obj, id, rval, strict);
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ JSObject::deleteProperty(JSContext *cx, js::HandleObject obj,
|
||||
JSObject::deleteElement(JSContext *cx, js::HandleObject obj,
|
||||
uint32_t index, js::MutableHandleValue rval, bool strict)
|
||||
{
|
||||
jsid id;
|
||||
js::RootedId id(cx);
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
|
||||
@ -1111,7 +1111,7 @@ JSObject::getElement(JSContext *cx, js::HandleObject obj, js::HandleObject recei
|
||||
return op(cx, obj, receiver, index, vp);
|
||||
|
||||
js::RootedId id(cx);
|
||||
if (!js::IndexToId(cx, index, id.address()))
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return getGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
@ -1131,7 +1131,7 @@ JSObject::getElementIfPresent(JSContext *cx, js::HandleObject obj, js::HandleObj
|
||||
* doing index-to-id conversions, we can use those here.
|
||||
*/
|
||||
js::RootedId id(cx);
|
||||
if (!js::IndexToId(cx, index, id.address()))
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
js::RootedObject obj2(cx);
|
||||
@ -1177,7 +1177,7 @@ JSObject::getElementAttributes(JSContext *cx, js::HandleObject obj,
|
||||
uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
js::RootedId id(cx);
|
||||
if (!js::IndexToId(cx, index, id.address()))
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return getGenericAttributes(cx, obj, id, attrsp);
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
||||
RootedId id(cx);
|
||||
RootedValue newElement(cx);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (!IndexToId(cx, i, id.address()))
|
||||
if (!IndexToId(cx, i, &id))
|
||||
return false;
|
||||
|
||||
/* Step 2a(iii)(1). */
|
||||
|
@ -120,7 +120,7 @@ BaseProxyHandler::getElementIfPresent(JSContext *cx, JSObject *proxy_, JSObject
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedObject receiver(cx, receiver_);
|
||||
|
||||
jsid id;
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
@ -2364,7 +2364,7 @@ Proxy::getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject recei
|
||||
}
|
||||
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
bool hasOwn;
|
||||
@ -2555,7 +2555,7 @@ proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
@ -2595,7 +2595,7 @@ proxy_DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
@ -2628,7 +2628,7 @@ proxy_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_GetGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
@ -2668,7 +2668,7 @@ proxy_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleValue vp, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_SetGeneric(cx, obj, id, vp, strict);
|
||||
}
|
||||
@ -2702,7 +2702,7 @@ static JSBool
|
||||
proxy_GetElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_GetGenericAttributes(cx, obj, id, attrsp);
|
||||
}
|
||||
@ -2736,7 +2736,7 @@ static JSBool
|
||||
proxy_SetElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_SetGenericAttributes(cx, obj, id, attrsp);
|
||||
}
|
||||
@ -2773,7 +2773,7 @@ proxy_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleValue rval, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_DeleteGeneric(cx, obj, id, rval, strict);
|
||||
}
|
||||
|
@ -4747,7 +4747,7 @@ xml_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandle
|
||||
}
|
||||
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
RootedShape shape(cx, js_AddNativeProperty(cx, obj, id, GetProperty, PutProperty,
|
||||
@ -4795,7 +4795,7 @@ xml_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return xml_defineGeneric(cx, obj, id, v, getter, setter, attrs);
|
||||
}
|
||||
@ -4832,7 +4832,7 @@ static JSBool
|
||||
xml_getElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return xml_getGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
@ -4861,7 +4861,7 @@ static JSBool
|
||||
xml_setElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return xml_setGeneric(cx, obj, id, vp, strict);
|
||||
}
|
||||
@ -4895,7 +4895,7 @@ static JSBool
|
||||
xml_getElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return xml_getGenericAttributes(cx, obj, id, attrsp);
|
||||
}
|
||||
@ -4933,7 +4933,7 @@ static JSBool
|
||||
xml_setElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return xml_setGenericAttributes(cx, obj, id, attrsp);
|
||||
}
|
||||
@ -5456,7 +5456,7 @@ xml_appendChild(JSContext *cx, unsigned argc, jsval *vp)
|
||||
JSXML *vxml = (JSXML *) vobj->getPrivate();
|
||||
JS_ASSERT(vxml->xml_class == JSXML_CLASS_LIST);
|
||||
|
||||
if (!IndexToId(cx, vxml->xml_kids.length, name.address()))
|
||||
if (!IndexToId(cx, vxml->xml_kids.length, &name))
|
||||
return JS_FALSE;
|
||||
*vp = (argc != 0) ? vp[2] : JSVAL_VOID;
|
||||
|
||||
|
@ -376,7 +376,7 @@ with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return with_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
@ -410,7 +410,7 @@ with_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return with_GetGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user