From 071b58d7ff9d706ba9c9fb41ae2066ca75c07387 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Sun, 18 Mar 2012 07:17:05 -0700 Subject: [PATCH] Bug 735550 - unmark gray objects held by live nsXBLDocGlobalObjects. r=smaug --- content/xbl/src/nsXBLDocumentInfo.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/content/xbl/src/nsXBLDocumentInfo.cpp b/content/xbl/src/nsXBLDocumentInfo.cpp index 8ca29a98373f..406dc911ea0a 100644 --- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -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)