if (count > 0) { for (PRUint32 i=0; i<count; i++) { nsCOMPtr<nsIDocumentLoader> loader; loader = getter_AddRefs(NS_STATIC_CAST(nsIDocumentLoader*, mChildList->ElementAt(i)));  if (loader) loader->ClearParentDocLoader(); } mChildList->Clear(); }
NS_PRECONDITION((0 == count), "Document loader has children..."); #endif
nsDocLoaderImpl::~nsDocLoaderImpl(){		/*			|ClearWeakReferences()| here is intended to prevent people holding weak references			from re-entering this destructor since |QueryReferent()| will |AddRef()| me, and the			subsequent |Release()| will try to destroy me.  At this point there should be only			weak references remaining (otherwise, we wouldn't be getting destroyed).			An alternative would be incrementing our refcount (consider it a compressed flag			saying "Don't re-destroy.").  I haven't yet decided which is better. [scc]		*/  ClearWeakReferences();  Destroy();  PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,          ("DocLoader:%p: deleted.\n", this));  PRUint32 count=0;  mChildList->Count(&count);  // if the doc loader still has children...we need to enumerate the children and make  // them null out their back ptr to the parent doc loader  if (count > 0)   {    for (PRUint32 i=0; i<count; i++)     {      nsCOMPtr<nsIDocumentLoader> loader;      loader = getter_AddRefs(NS_STATIC_CAST(nsIDocumentLoader*, mChildList->ElementAt(i)));      if (loader)         loader->ClearParentDocLoader();    }        mChildList->Clear();  } }