Bug 851465 - Remove slim wrappers - rename WRAPPER_MULTISLOT. r=bholley.

This commit is contained in:
Peter Van der Beken 2013-06-13 16:55:40 +02:00
parent 1badbbcf0f
commit 1f3e027007
3 changed files with 11 additions and 13 deletions

View File

@ -1056,8 +1056,9 @@ XPCWrappedNative::FinishInit()
{
AutoJSContext cx;
// For all WNs, we want to make sure that the multislot starts out as null.
JS_SetReservedSlot(mFlatJSObject, WRAPPER_MULTISLOT, JSVAL_NULL);
// For all WNs, we want to make sure that the expando chain slot starts out
// as null.
JS_SetReservedSlot(mFlatJSObject, WN_XRAYEXPANDOCHAIN_SLOT, JSVAL_NULL);
// This reference will be released when mFlatJSObject is finalized.
// Since this reference will push the refcount to 2 it will also root

View File

@ -277,20 +277,24 @@ extern const char XPC_XPCONNECT_CONTRACTID[];
#define WRAPPER_SLOTS (JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | \
JSCLASS_HAS_RESERVED_SLOTS(1))
// WRAPPER_MULTISLOT is defined in xpcpublic.h
#define INVALID_OBJECT ((JSObject *)1)
// NB: This slot isn't actually reserved for us on globals, because SpiderMonkey
// uses the first N slots on globals internally. The fact that we use it for
// wrapped global objects is totally broken. But due to a happy coincidence, the
// JS engine never uses that slot. This still needs fixing though. See bug 760095.
#define WN_XRAYEXPANDOCHAIN_SLOT 0
inline void SetWNExpandoChain(JSObject *obj, JSObject *chain)
{
MOZ_ASSERT(IS_WN_REFLECTOR(obj));
JS_SetReservedSlot(obj, WRAPPER_MULTISLOT, JS::ObjectOrNullValue(chain));
JS_SetReservedSlot(obj, WN_XRAYEXPANDOCHAIN_SLOT, JS::ObjectOrNullValue(chain));
}
inline JSObject* GetWNExpandoChain(JSObject *obj)
{
MOZ_ASSERT(IS_WN_REFLECTOR(obj));
return JS_GetReservedSlot(obj, WRAPPER_MULTISLOT).toObjectOrNull();
return JS_GetReservedSlot(obj, WN_XRAYEXPANDOCHAIN_SLOT).toObjectOrNull();
}
/***************************************************************************/

View File

@ -89,13 +89,6 @@ static inline bool IS_WN_CLASS(js::Class* clazz)
{
return clazz->ext.isWrappedNative;
}
// NB: This slot isn't actually reserved for us on globals, because SpiderMonkey
// uses the first N slots on globals internally. The fact that we use it for
// wrapped global objects is totally broken. But due to a happy coincidence, the
// JS engine never uses that slot. This still needs fixing though. See bug 760095.
#define WRAPPER_MULTISLOT 0
static inline bool IS_WN_REFLECTOR(JSObject *obj)
{
return IS_WN_CLASS(js::GetObjectClass(obj));