diff --git a/dom/base/InProcessBrowserChildMessageManager.cpp b/dom/base/InProcessBrowserChildMessageManager.cpp index d5bdcb3567ea..1dd012edb236 100644 --- a/dom/base/InProcessBrowserChildMessageManager.cpp +++ b/dom/base/InProcessBrowserChildMessageManager.cpp @@ -140,6 +140,10 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED( InProcessBrowserChildMessageManager, DOMEventTargetHelper) + if (XRE_IsParentProcess()) { + JSActorService::UnregisterChromeEventTarget(tmp); + } + NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager) NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocShell) tmp->nsMessageManagerScriptExecutor::Unlink(); diff --git a/dom/base/nsWindowRoot.cpp b/dom/base/nsWindowRoot.cpp index d4d7b018c00c..e8924b4f72c2 100644 --- a/dom/base/nsWindowRoot.cpp +++ b/dom/base/nsWindowRoot.cpp @@ -54,8 +54,26 @@ nsWindowRoot::~nsWindowRoot() { } } -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsWindowRoot, mWindow, mListenerManager, - mParent) +NS_IMPL_CYCLE_COLLECTION_CLASS(nsWindowRoot) + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsWindowRoot) + if (XRE_IsContentProcess()) { + JSActorService::UnregisterChromeEventTarget(tmp); + } + + NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mListenerManager) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent) + NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsWindowRoot) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListenerManager) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsWindowRoot) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowRoot) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY