Bug 797821 - Remove JSCLASS_XPCONNECT_GLOBAL flag. r=mrbkap

This commit is contained in:
Bobby Holley 2012-10-25 17:01:09 +02:00
Родитель 2cf0594417
Коммит 678c7b3e05
5 изменённых файлов: 4 добавлений и 31 удалений

Просмотреть файл

@ -4126,11 +4126,9 @@ struct JSClass {
#define JSCLASS_FREEZE_PROTO (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4))
#define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5))
#define JSCLASS_XPCONNECT_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6))
/* Reserved for embeddings. */
#define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7))
#define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8))
#define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6))
#define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7))
/*
* Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see

Просмотреть файл

@ -94,10 +94,6 @@ XPCWrappedNativeScope::GetNewOrUsed(JSContext *cx, JSObject* aGlobal)
// has been called). NOTE: We are only called by nsXPConnect::InitClasses.
scope->SetGlobal(cx, aGlobal);
}
if (js::GetObjectClass(aGlobal)->flags & JSCLASS_XPCONNECT_GLOBAL)
JS_SetReservedSlot(aGlobal,
JSCLASS_GLOBAL_SLOT_COUNT,
PRIVATE_TO_JSVAL(scope));
return scope;
}
@ -560,18 +556,6 @@ XPCWrappedNativeScope::SystemIsBeingShutDown()
Enumerate(WrappedNativeProtoShutdownEnumerator, &data);
cur->mWrappedNativeMap->
Enumerate(WrappedNativeShutdownEnumerator, &data);
// Since we're not gating the scope destruction on the finalization
// of the JS global in this case, it might stick around. And if it
// gets later on (or otherwise triggers an access to the scope), we'll
// crash. Null it out.
JSObject *global = cur->mGlobalJSObject;
if (global &&
js::GetObjectClass(global)->flags & JSCLASS_XPCONNECT_GLOBAL)
{
JS_SetReservedSlot(global, JSCLASS_GLOBAL_SLOT_COUNT,
PRIVATE_TO_JSVAL(nullptr));
}
}
// Now it is safe to kill all the scopes.

Просмотреть файл

@ -1027,7 +1027,7 @@ TraceXPCGlobal(JSTracer *trc, JSObject *obj)
}
#endif
if (XPCWrappedNativeScope *scope = XPCWrappedNativeScope::GetNativeScope(obj))
if (XPCWrappedNativeScope *scope = ObjectScope(obj))
scope->TraceDOMPrototypes(trc);
if (js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL)

Просмотреть файл

@ -1711,15 +1711,6 @@ public:
return mCachedDOMPrototypes;
}
static XPCWrappedNativeScope *GetNativeScope(JSObject *obj)
{
MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_XPCONNECT_GLOBAL);
const js::Value &v = js::GetObjectSlot(obj, JSCLASS_GLOBAL_SLOT_COUNT);
return v.isUndefined()
? nullptr
: static_cast<XPCWrappedNativeScope *>(v.toPrivate());
}
void TraceDOMPrototypes(JSTracer *trc);
JSBool ExperimentalBindingsEnabled()

Просмотреть файл

@ -43,7 +43,7 @@ TransplantObjectWithWrapper(JSContext *cx,
} /* namespace xpc */
#define XPCONNECT_GLOBAL_FLAGS \
JSCLASS_DOM_GLOBAL | JSCLASS_XPCONNECT_GLOBAL | JSCLASS_HAS_PRIVATE | \
JSCLASS_DOM_GLOBAL | JSCLASS_HAS_PRIVATE | \
JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_IMPLEMENTS_BARRIERS | \
JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(3)