child->mDocument = nsnull;
CSSStyleSheetImpl::~CSSStyleSheetImpl(){  if (mFirstChild) {    CSSStyleSheetImpl* child = mFirstChild;    do {      child->mParent = nsnull;      child = child->mNext;    } while (child);    NS_RELEASE(mFirstChild);  }  NS_IF_RELEASE(mNext);  if (nsnull != mRuleCollection) {    mRuleCollection->DropReference();    NS_RELEASE(mRuleCollection);  }  if (nsnull != mImportsCollection) {    mImportsCollection->DropReference();    NS_RELEASE(mImportsCollection);  }  if (mMedia) {    mMedia->DropReference();    NS_RELEASE(mMedia);  }  mInner->RemoveSheet(this);  // XXX The document reference is not reference counted and should  // not be released. The document will let us know when it is going  // away.  if (mRuleProcessors) {    NS_ASSERTION(mRuleProcessors->Count() == 0, "destucting sheet with rule processor reference");    delete mRuleProcessors; // weak refs, should be empty here anyway  }}