Bug 720580 - Assert against creating globals in xpc_NewSystemInheritingJSObject. r=mrbkap

With this patch, the only call to JS_NewGlobalObject in XPConnect happens in xpc_CreateGlobalObject. \o/
This commit is contained in:
Bobby Holley 2012-03-05 15:22:45 -08:00
parent c6f2bff359
commit 9c7a81fdcd

View File

@ -658,14 +658,11 @@ inline JSObject*
xpc_NewSystemInheritingJSObject(JSContext *cx, JSClass *clasp, JSObject *proto,
bool uniqueType, JSObject *parent)
{
// Global creation should go through XPCWrappedNative::WrapNewGlobal().
MOZ_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL));
JSObject *obj;
if (clasp->flags & JSCLASS_IS_GLOBAL) {
obj = JS_NewGlobalObject(cx, clasp);
if (obj && proto) {
if (!JS_SplicePrototype(cx, obj, proto))
obj = NULL;
}
} else if (uniqueType) {
if (uniqueType) {
obj = JS_NewObjectWithUniqueType(cx, clasp, proto, parent);
} else {
obj = JS_NewObject(cx, clasp, proto, parent);