From af7d906b8d48f3f8635a9234937e2191b2976975 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Sat, 7 Apr 2012 10:12:03 +0300 Subject: [PATCH] Bug 743199 - Unmark Document's and Window's ELM, r=mccr8 --- content/base/src/nsDocument.cpp | 8 +++++++- dom/base/nsGlobalWindow.cpp | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 24a022da290..bee66e116b3 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1719,7 +1719,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsDocument, nsNodeUtils::LastRelease(this)) NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDocument) - return nsGenericElement::CanSkip(tmp, aRemovingAllowed); + if (nsGenericElement::CanSkip(tmp, aRemovingAllowed)) { + nsEventListenerManager* elm = tmp->GetListenerManager(false); + if (elm) { + elm->UnmarkGrayJSListeners(); + } + return true; + } NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsDocument) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 93bc161549a..33273e6e372 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1439,6 +1439,11 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow) if (tmp->mCachedXBLPrototypeHandlers.IsInitialized()) { tmp->mCachedXBLPrototypeHandlers.EnumerateRead(MarkXBLHandlers, nsnull); } + nsEventListenerManager* elm = tmp->GetListenerManager(false); + if (elm) { + elm->UnmarkGrayJSListeners(); + } + tmp->UnmarkGrayTimers(); return true; } NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END