зеркало из https://github.com/mozilla/gecko-dev.git
Bug 973780 - Remove Xray expando slot from WNs. r=bz
This commit is contained in:
Родитель
4b70a01ff8
Коммит
56b7e9ff9a
|
@ -859,10 +859,6 @@ XPCWrappedNative::FinishInit()
|
|||
{
|
||||
AutoJSContext cx;
|
||||
|
||||
// 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
|
||||
// mFlatJSObject;
|
||||
|
@ -1186,7 +1182,6 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCWrappedNativeScope* aOldScope,
|
|||
|
||||
// Expandos from other compartments are attached to the target JS object.
|
||||
// Copy them over, and let the old ones die a natural death.
|
||||
SetWNExpandoChain(newobj, nullptr);
|
||||
if (!XrayUtils::CloneExpandoChain(cx, newobj, flat))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -213,17 +213,10 @@ extern const char XPC_XPCONNECT_CONTRACTID[];
|
|||
return (result || !src) ? NS_OK : NS_ERROR_OUT_OF_MEMORY
|
||||
|
||||
|
||||
#define WRAPPER_SLOTS (JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | \
|
||||
JSCLASS_HAS_RESERVED_SLOTS(1))
|
||||
#define WRAPPER_SLOTS (JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS )
|
||||
|
||||
#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
|
||||
|
||||
// If IS_WN_CLASS for the JSClass of an object is true, the object is a
|
||||
// wrappednative wrapper, holding the XPCWrappedNative in its private slot.
|
||||
static inline bool IS_WN_CLASS(const js::Class* clazz)
|
||||
|
@ -236,18 +229,6 @@ static inline bool IS_WN_REFLECTOR(JSObject *obj)
|
|||
return IS_WN_CLASS(js::GetObjectClass(obj));
|
||||
}
|
||||
|
||||
inline void SetWNExpandoChain(JSObject *obj, JSObject *chain)
|
||||
{
|
||||
MOZ_ASSERT(IS_WN_REFLECTOR(obj));
|
||||
JS_SetReservedSlot(obj, WN_XRAYEXPANDOCHAIN_SLOT, JS::ObjectOrNullValue(chain));
|
||||
}
|
||||
|
||||
inline JSObject* GetWNExpandoChain(JSObject *obj)
|
||||
{
|
||||
MOZ_ASSERT(IS_WN_REFLECTOR(obj));
|
||||
return JS_GetReservedSlot(obj, WN_XRAYEXPANDOCHAIN_SLOT).toObjectOrNull();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
****************************************************************************
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче