NS_IF_RELEASE(mHiddenForm);
XULDocumentImpl::~XULDocumentImpl(){    NS_IF_RELEASE(mDocumentDataSource);    NS_IF_RELEASE(mLocalDataSource);    NS_IF_RELEASE(mListenerManager);	  NS_IF_RELEASE(mPopup);    // mParentDocument is never refcounted    // Delete references to sub-documents    PRInt32 index = mSubDocuments.Count();    while (--index >= 0) {        nsIDocument* subdoc = (nsIDocument*) mSubDocuments.ElementAt(index);        NS_RELEASE(subdoc);    }    // Delete references to style sheets but only if we aren't a popup document.    if (!mIsPopup) {        index = mStyleSheets.Count();        while (--index >= 0) {            nsIStyleSheet* sheet = (nsIStyleSheet*) mStyleSheets.ElementAt(index);            sheet->SetOwningDocument(nsnull);            NS_RELEASE(sheet);        }    }    // set all builder references to document to nsnull -- out of band notification    // to break ownership cycle    if (mBuilders)    {        PRUint32 cnt = 0;        nsresult rv = mBuilders->Count(&cnt);        NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");#ifdef	DEBUG        printf("# of builders: %lu\n", (unsigned long)cnt);#endif	    for (PRUint32 i = 0; i < cnt; ++i)	    {		// XXX we should QueryInterface() here		nsIRDFContentModelBuilder* builder		    = (nsIRDFContentModelBuilder*) mBuilders->ElementAt(i);		NS_ASSERTION(builder != nsnull, "null ptr");		if (! builder)		    continue;		nsresult rv = builder->SetDocument(nsnull);		NS_ASSERTION(NS_SUCCEEDED(rv), "error creating content");		// XXX ignore error code?		NS_RELEASE(builder);	    }    }    NS_IF_RELEASE(mBuilders);    NS_IF_RELEASE(mXULBuilder);    NS_IF_RELEASE(mSelection);    NS_IF_RELEASE(mAttrStyleSheet);    NS_IF_RELEASE(mCSSLoader);    NS_IF_RELEASE(mRootContent);    NS_IF_RELEASE(mDocumentURLGroup);    NS_IF_RELEASE(mDocumentURL);    NS_IF_RELEASE(mNameSpaceManager);    NS_IF_RELEASE(mLineBreaker);    NS_IF_RELEASE(mWordBreaker);    NS_IF_RELEASE(mFragmentRoot);        if (--gRefCnt == 0) {        NS_IF_RELEASE(kIdAtom);        NS_IF_RELEASE(kObservesAtom);        if (gRDFService) {            nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);            gRDFService = nsnull;        }        NS_IF_RELEASE(kRDF_instanceOf);        NS_IF_RELEASE(kRDF_type);        NS_IF_RELEASE(kXUL_element);    }}