NS_RELEASE(rule);
void CSSStyleSheetImpl::AppendStyleRule(nsICSSStyleRule* aRule){  NS_PRECONDITION(nsnull != aRule, "null arg");  //XXX replace this with a binary search?  PRInt32 weight = aRule->GetWeight();  if (nsnull == mRules) {    if (NS_OK != NS_NewISupportsArray(&mRules))      return;  }  PRInt32 count = mRules->Count();  PRInt32 index = -1;  while (++index < count) {    nsICSSStyleRule* rule = (nsICSSStyleRule*)mRules->ElementAt(index);    if (rule->GetWeight() < weight) { // insert after rules with equal or greater weight (before lower weight)      NS_RELEASE(rule);      break;    }    NS_RELEASE(rule);  }  mRules->InsertElementAt(aRule, index);}