Bug 712735 - Don't add JS holders with no gray children as XPConnect roots. r=smaug

This commit is contained in:
Andrew McCreight 2012-03-28 21:23:01 -07:00
parent 49f0480bcd
commit 76cceac62b

View File

@ -449,9 +449,15 @@ CheckParticipatesInCycleCollection(PRUint32 aLangID, void *aThing,
{
Closure *closure = static_cast<Closure*>(aClosure);
closure->cycleCollectionEnabled =
aLangID == nsIProgrammingLanguage::JAVASCRIPT &&
AddToCCKind(js_GetGCThingTraceKind(aThing));
if (closure->cycleCollectionEnabled)
return;
if (aLangID == nsIProgrammingLanguage::JAVASCRIPT &&
AddToCCKind(js_GetGCThingTraceKind(aThing)) &&
xpc_IsGrayGCThing(aThing))
{
closure->cycleCollectionEnabled = true;
}
}
static JSDHashOperator
@ -461,6 +467,7 @@ NoteJSHolder(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32_t number,
ObjectHolder* entry = reinterpret_cast<ObjectHolder*>(hdr);
Closure *closure = static_cast<Closure*>(arg);
closure->cycleCollectionEnabled = false;
entry->tracer->Trace(entry->holder, CheckParticipatesInCycleCollection,
closure);
if (!closure->cycleCollectionEnabled)