Bug 735550 - unmark gray objects held by live nsXBLDocGlobalObjects. r=smaug

This commit is contained in:
Andrew McCreight 2012-03-18 07:17:05 -07:00
parent a8485fd9e9
commit a7c876f89d

View File

@ -97,6 +97,8 @@ public:
void ClearGlobalObjectOwner();
void UnmarkScriptContext();
protected:
virtual ~nsXBLDocGlobalObject();
@ -360,6 +362,14 @@ nsXBLDocGlobalObject::ClearGlobalObjectOwner()
mGlobalObjectOwner = nsnull;
}
void
nsXBLDocGlobalObject::UnmarkScriptContext()
{
if (mScriptContext) {
xpc_UnmarkGrayObject(mScriptContext->GetNativeGlobal());
}
}
JSObject *
nsXBLDocGlobalObject::GetGlobalJSObject()
{
@ -509,9 +519,13 @@ nsXBLDocumentInfo::MarkInCCGeneration(PRUint32 aGeneration)
if (mDocument) {
mDocument->MarkUncollectableForCCGeneration(aGeneration);
}
// Unmark any JS we hold
if (mBindingTable) {
mBindingTable->Enumerate(UnmarkProtos, nsnull);
}
if (mGlobalObject) {
mGlobalObject->UnmarkScriptContext();
}
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXBLDocumentInfo)