bug 725595 - drop native object checks from JS_(Get|Set)ReservedSlot. r=Waldo

This commit is contained in:
Igor Bukanov 2012-02-10 13:40:34 +01:00
parent b19ddf167c
commit 0c1d79c61a
4 changed files with 10 additions and 24 deletions

View File

@ -4415,20 +4415,13 @@ JS_ElementIteratorStub(JSContext *cx, JSObject *obj, JSBool keysonly)
JS_PUBLIC_API(jsval)
JS_GetReservedSlot(JSObject *obj, uint32_t index)
{
if (!obj->isNative())
return UndefinedValue();
return GetReservedSlot(obj, index);
return obj->getReservedSlot(index);
}
JS_PUBLIC_API(void)
JS_SetReservedSlot(JSObject *obj, uint32_t index, jsval v)
{
if (!obj->isNative())
return;
SetReservedSlot(obj, index, v);
GCPoke(obj->compartment()->rt, NullValue());
obj->setReservedSlot(index, v);
}
JS_PUBLIC_API(JSObject *)

View File

@ -3595,7 +3595,7 @@ DefineStandardSlot(JSContext *cx, JSObject *obj, JSProtoKey key, JSAtom *atom,
const Shape *shape = obj->nativeLookup(cx, id);
if (!shape) {
uint32_t slot = 2 * JSProto_LIMIT + key;
SetReservedSlot(obj, slot, v);
obj->setReservedSlot(slot, v);
if (!obj->addProperty(cx, id, JS_PropertyStub, JS_StrictPropertyStub, slot, attrs, 0, 0))
return false;
AddTypePropertyId(cx, obj, id, v);
@ -3618,8 +3618,8 @@ SetClassObject(JSObject *obj, JSProtoKey key, JSObject *cobj, JSObject *proto)
if (!obj->isGlobal())
return;
SetReservedSlot(obj, key, ObjectOrNullValue(cobj));
SetReservedSlot(obj, JSProto_LIMIT + key, ObjectOrNullValue(proto));
obj->setReservedSlot(key, ObjectOrNullValue(cobj));
obj->setReservedSlot(JSProto_LIMIT + key, ObjectOrNullValue(proto));
}
static void

View File

@ -92,6 +92,9 @@ OperationInProgress(JSContext *cx, JSObject *proxy)
return false;
}
static bool
FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp);
ProxyHandler::ProxyHandler(void *family) : mFamily(family)
{
}
@ -1735,8 +1738,8 @@ Class js::CallableObjectClass = {
callable_Construct,
};
JS_FRIEND_API(JSBool)
js::FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp)
static bool
FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp)
{
if (OperationInProgress(cx, proxy)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_PROXY_FIX);

View File

@ -183,13 +183,6 @@ GetProxyPrivate(const JSObject *obj)
return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE);
}
inline void
SetProxyPrivate(JSObject *obj, const Value &priv)
{
JS_ASSERT(IsProxy(obj));
SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, priv);
}
inline const Value &
GetProxyExtra(const JSObject *obj, size_t n)
{
@ -210,9 +203,6 @@ NewProxyObject(JSContext *cx, ProxyHandler *handler, const Value &priv,
JSObject *proto, JSObject *parent,
JSObject *call = NULL, JSObject *construct = NULL);
JS_FRIEND_API(JSBool)
FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp);
} /* namespace js */
JS_BEGIN_EXTERN_C