From fad2d56600b77c9e4b98c8485420a75ba0b22e9a Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Thu, 27 Sep 2007 16:39:13 +0000 Subject: [PATCH] Fix for bug 397386 (Large leak on grono.net front page), part 2. r/sr=sicking, a=dsicore. --- content/xslt/src/xpath/nsXPathExpression.cpp | 10 +++++++--- content/xslt/src/xpath/nsXPathExpression.h | 5 ++++- content/xslt/src/xpath/nsXPathNSResolver.cpp | 8 +++++--- content/xslt/src/xpath/nsXPathNSResolver.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/content/xslt/src/xpath/nsXPathExpression.cpp b/content/xslt/src/xpath/nsXPathExpression.cpp index ddc4cbc16c5..21c39e78958 100644 --- a/content/xslt/src/xpath/nsXPathExpression.cpp +++ b/content/xslt/src/xpath/nsXPathExpression.cpp @@ -49,9 +49,13 @@ #include "txURIUtils.h" #include "txXPathTreeWalker.h" -NS_IMPL_ADDREF(nsXPathExpression) -NS_IMPL_RELEASE(nsXPathExpression) -NS_INTERFACE_MAP_BEGIN(nsXPathExpression) +NS_IMPL_CYCLE_COLLECTION_1(nsXPathExpression, mDocument) + +NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsXPathExpression, + nsIDOMXPathExpression) +NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsXPathExpression, + nsIDOMXPathExpression) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathExpression) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathExpression) NS_INTERFACE_MAP_ENTRY(nsIDOMNSXPathExpression) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathExpression) diff --git a/content/xslt/src/xpath/nsXPathExpression.h b/content/xslt/src/xpath/nsXPathExpression.h index e1b29cae779..7eeef3e8694 100644 --- a/content/xslt/src/xpath/nsXPathExpression.h +++ b/content/xslt/src/xpath/nsXPathExpression.h @@ -44,6 +44,7 @@ #include "txIXPathContext.h" #include "txResultRecycler.h" #include "nsAutoPtr.h" +#include "nsCycleCollectionParticipant.h" class Expr; class txXPathNode; @@ -59,7 +60,9 @@ public: nsIDOMDocument *aDocument); // nsISupports interface - NS_DECL_ISUPPORTS + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXPathExpression, + nsIDOMXPathExpression) // nsIDOMXPathExpression interface NS_DECL_NSIDOMXPATHEXPRESSION diff --git a/content/xslt/src/xpath/nsXPathNSResolver.cpp b/content/xslt/src/xpath/nsXPathNSResolver.cpp index 8fee8ae7068..a8740c4db20 100644 --- a/content/xslt/src/xpath/nsXPathNSResolver.cpp +++ b/content/xslt/src/xpath/nsXPathNSResolver.cpp @@ -41,9 +41,11 @@ #include "nsDOMString.h" #include "nsContentUtils.h" -NS_IMPL_ADDREF(nsXPathNSResolver) -NS_IMPL_RELEASE(nsXPathNSResolver) -NS_INTERFACE_MAP_BEGIN(nsXPathNSResolver) +NS_IMPL_CYCLE_COLLECTION_1(nsXPathNSResolver, mNode) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXPathNSResolver) +NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXPathNSResolver) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathNSResolver) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNSResolver) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPathNSResolver) diff --git a/content/xslt/src/xpath/nsXPathNSResolver.h b/content/xslt/src/xpath/nsXPathNSResolver.h index 14004d856b2..6756643c613 100644 --- a/content/xslt/src/xpath/nsXPathNSResolver.h +++ b/content/xslt/src/xpath/nsXPathNSResolver.h @@ -43,6 +43,7 @@ #include "nsIDOMNode.h" #include "nsIDOM3Node.h" #include "nsCOMPtr.h" +#include "nsCycleCollectionParticipant.h" /** * A class for evaluating an XPath expression string @@ -53,7 +54,8 @@ public: nsXPathNSResolver(nsIDOMNode* aNode); // nsISupports interface - NS_DECL_ISUPPORTS + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS(nsXPathNSResolver) // nsIDOMXPathNSResolver interface NS_DECL_NSIDOMXPATHNSRESOLVER