Fix for bug 460512 (Avoid AddRef/Release in scriptable helper methods for NodeList). r/sr=bz.

This commit is contained in:
Peter Van der Beken
2008-10-22 16:31:14 +02:00
parent 44bfcffe1e
commit d73de97719
47 changed files with 893 additions and 1195 deletions

View File

@@ -456,10 +456,15 @@ nsIContent::FindFirstNonNativeAnonymous() const
//----------------------------------------------------------------------
nsChildContentList::~nsChildContentList()
{
MOZ_COUNT_DTOR(nsChildContentList);
}
NS_IMPL_ADDREF(nsChildContentList)
NS_IMPL_RELEASE(nsChildContentList)
NS_INTERFACE_MAP_BEGIN(nsChildContentList)
NS_INTERFACE_MAP_ENTRY(nsINodeList)
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsINodeList)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsChildContentList::GetLength(PRUint32* aLength)
@@ -469,6 +474,19 @@ nsChildContentList::GetLength(PRUint32* aLength)
return NS_OK;
}
NS_IMETHODIMP
nsChildContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
nsINode* node = GetNodeAt(aIndex);
if (!node) {
*aReturn = nsnull;
return NS_OK;
}
return CallQueryInterface(node, aReturn);
}
nsINode*
nsChildContentList::GetNodeAt(PRUint32 aIndex)
{