diff --git a/content/xbl/src/nsXBLDocumentInfo.cpp b/content/xbl/src/nsXBLDocumentInfo.cpp index f7a1fc2bbc0..d72c731a50a 100644 --- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -78,6 +78,8 @@ public: void UnmarkScriptContext(); + static JSClass gSharedGlobalClass; + protected: virtual ~nsXBLDocGlobalObject(); @@ -87,7 +89,6 @@ protected: JSObject *mJSObject; nsXBLDocumentInfo* mGlobalObjectOwner; // weak reference - static JSClass gSharedGlobalClass; }; bool @@ -713,3 +714,13 @@ nsXBLDocumentInfo::GetScriptGlobalObject() return mGlobalObject; } + +#ifdef DEBUG +void +AssertInCompilationScope() +{ + AutoJSContext cx; + MOZ_ASSERT(JS_GetClass(JS::CurrentGlobalOrNull(cx)) == + &nsXBLDocGlobalObject::gSharedGlobalClass); +} +#endif diff --git a/content/xbl/src/nsXBLDocumentInfo.h b/content/xbl/src/nsXBLDocumentInfo.h index 1f3507bff83..b5257501436 100644 --- a/content/xbl/src/nsXBLDocumentInfo.h +++ b/content/xbl/src/nsXBLDocumentInfo.h @@ -70,4 +70,10 @@ private: nsRefPtr mGlobalObject; }; +#ifdef DEBUG +void AssertInCompilationScope(); +#else +inline void AssertInCompilationScope() {} +#endif + #endif