Fix for bug 406106 (Large leak with XSLTProcessor.setParameter). r/sr/a=sicking.

This commit is contained in:
peterv@propagandism.org 2007-11-30 11:10:03 -08:00
parent 78f58c1461
commit 46a137c59e
2 changed files with 28 additions and 4 deletions

View File

@ -264,6 +264,10 @@ public:
NS_ADDREF(*aValue); NS_ADDREF(*aValue);
return NS_OK; return NS_OK;
} }
nsIVariant* getValue()
{
return mValue;
}
void setValue(nsIVariant* aValue) void setValue(nsIVariant* aValue)
{ {
NS_ASSERTION(aValue, "setting variablevalue to null"); NS_ASSERTION(aValue, "setting variablevalue to null");
@ -288,9 +292,26 @@ private:
* txMozillaXSLTProcessor * txMozillaXSLTProcessor
*/ */
NS_IMPL_ADDREF(txMozillaXSLTProcessor) NS_IMPL_CYCLE_COLLECTION_CLASS(txMozillaXSLTProcessor)
NS_IMPL_RELEASE(txMozillaXSLTProcessor) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(txMozillaXSLTProcessor)
NS_INTERFACE_MAP_BEGIN(txMozillaXSLTProcessor) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mEmbeddedStylesheetRoot)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSource)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPrincipal)
tmp->mVariables.clear();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(txMozillaXSLTProcessor)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mEmbeddedStylesheetRoot)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSource)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPrincipal)
txOwningExpandedNameMap<txIGlobalParameter>::iterator iter(tmp->mVariables);
while (iter.next()) {
cb.NoteXPCOMChild(static_cast<txVariable*>(iter.value())->getValue());
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(txMozillaXSLTProcessor)
NS_IMPL_CYCLE_COLLECTING_RELEASE(txMozillaXSLTProcessor)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(txMozillaXSLTProcessor)
NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessor) NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessor)
NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessorObsolete) NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessorObsolete)
NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessorPrivate) NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessorPrivate)

View File

@ -48,6 +48,7 @@
#include "txExpandedNameMap.h" #include "txExpandedNameMap.h"
#include "txNamespaceMap.h" #include "txNamespaceMap.h"
#include "nsIJSNativeInitializer.h" #include "nsIJSNativeInitializer.h"
#include "nsCycleCollectionParticipant.h"
class nsIDOMNode; class nsIDOMNode;
class nsIPrincipal; class nsIPrincipal;
@ -88,7 +89,9 @@ public:
~txMozillaXSLTProcessor(); ~txMozillaXSLTProcessor();
// nsISupports interface // nsISupports interface
NS_DECL_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(txMozillaXSLTProcessor,
nsIXSLTProcessor)
// nsIXSLTProcessor interface // nsIXSLTProcessor interface
NS_DECL_NSIXSLTPROCESSOR NS_DECL_NSIXSLTPROCESSOR