Add more useful assertion for debugging cycle collector faults. b=386912 r+sr=peterv

This commit is contained in:
dbaron@dbaron.org 2007-07-18 21:58:39 -07:00
Родитель 2dc0b0fef2
Коммит 7fbc4f9f9c
2 изменённых файлов: 17 добавлений и 4 удалений

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

@ -602,6 +602,17 @@ nsXPConnect::FinishCycleCollection()
return NS_OK;
}
nsCycleCollectionParticipant *
nsXPConnect::ToParticipant(void *p)
{
// Put this assertion here so it fires when we still have a stack
// showing where the bad pointer came from.
NS_ASSERTION(mObjRefcounts->Get(p) > 0,
"JS object but unknown to the JS GC?");
return this;
}
NS_IMETHODIMP
nsXPConnect::Root(void *p)
{

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

@ -480,15 +480,17 @@ public:
nsresult GetInfoForIID(const nsIID * aIID, nsIInterfaceInfo** info);
nsresult GetInfoForName(const char * name, nsIInterfaceInfo** info);
// from nsCycleCollectionLanguageRuntime and nsCycleCollectionParticipant
nsresult BeginCycleCollection();
// nsCycleCollectionParticipant
NS_IMETHOD Root(void *p);
NS_IMETHOD Unlink(void *p);
NS_IMETHOD Unroot(void *p);
NS_IMETHOD Traverse(void *p,
nsCycleCollectionTraversalCallback &cb);
nsresult FinishCycleCollection();
nsCycleCollectionParticipant *ToParticipant(void *p) {return this;}
// nsCycleCollectionLanguageRuntime
virtual nsresult BeginCycleCollection();
virtual nsresult FinishCycleCollection();
virtual nsCycleCollectionParticipant *ToParticipant(void *p);
JSObjectRefcounts* GetJSObjectRefcounts() {return mObjRefcounts;}
#ifndef XPCONNECT_STANDALONE