if (nsnull != mDocument) { nsICSSStyleRule* rule;  rule = (nsICSSStyleRule*)mOrderedRules->ElementAt(aIndex); mDocument->StyleRuleAdded(this, rule); NS_IF_RELEASE(rule); }
CSSStyleSheetImpl::InsertRule(const nsString& aRule,                               PRUint32 aIndex,                               PRUint32* aReturn){  nsICSSParser* css;  nsresult result = NS_NewCSSParser(&css);  if (NS_OK == result) {    nsAutoString str(aRule);    nsIUnicharInputStream* input = nsnull;    result = NS_NewStringUnicharInputStream(&input, &str);    if (NS_OK == result) {      nsICSSStyleSheet* tmp;      css->SetStyleSheet(this);      // XXX Currently, the parser will append the rule to the      // style sheet. We shouldn't ignore the index.      result = css->Parse(input, mURL, tmp);      NS_ASSERTION(tmp == this, "parser incorrectly created a new stylesheet");      NS_RELEASE(tmp);      NS_RELEASE(input);      *aReturn = mOrderedRules->Count();    }    NS_RELEASE(css);  }  return result;}