From ba4156b5cfbfacc1630ca7150f229d2216783b6b Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 5 Mar 2012 15:22:53 -0800 Subject: [PATCH] Bug 720580 - Assert that we have the global jsclass flag if and only if we're a global. r=mrbkap --- js/xpconnect/src/XPCWrappedNative.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 1a0cb7e6f76..26cf95789f4 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1197,15 +1197,8 @@ XPCWrappedNative::Init(XPCCallContext& ccx, JSObject* parent, JSClass* jsclazz = si ? si->GetJSClass() : Jsvalify(&XPC_WN_NoHelper_JSClass.base); - if (si && si->GetFlags().IsGlobalObject()) { - // Resolving a global object's class can cause us to create a global's - // JS class without the proper global flags. Notice that here and fix - // the problem. - if (!(jsclazz->flags & JSCLASS_IS_GLOBAL)) - jsclazz->flags |= XPCONNECT_GLOBAL_FLAGS; - } else - NS_ASSERTION(!(jsclazz->flags & JSCLASS_IS_GLOBAL), - "Non-global object has the wrong flags"); + // We should have the global jsclass flag if and only if we're a global. + MOZ_ASSERT_IF(si, !!si->GetFlags().IsGlobalObject() == !!(jsclazz->flags & JSCLASS_IS_GLOBAL)); NS_ASSERTION(jsclazz && jsclazz->name &&