CSSStyleSheetImpl::InsertRule(const nsString& aRule,
CSSStyleSheetImpl::InsertRule(const nsAReadableString& aRule,
CSSStyleSheetImpl::InsertRule(const nsString& aRule,                               PRUint32 aIndex,                               PRUint32* aReturn){  nsICSSParser* css;  // XXX should get parser from CSS loader  nsresult result = NS_NewCSSParser(&css);  if (NS_OK == result) {    nsString* str = new nsString(aRule); // will be deleted by the input stream    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, mInner->mURL, tmp);      NS_ASSERTION(tmp == this, "parser incorrectly created a new stylesheet");      NS_RELEASE(tmp);      NS_RELEASE(input);      PRUint32 cnt;      if (mInner && mInner->mOrderedRules) {        result = mInner->mOrderedRules->Count(&cnt);        if (NS_SUCCEEDED(result)) {          *aReturn = cnt;          if (nsnull != mDocument) {            nsICSSRule* rule;            rule = (nsICSSRule*)(mInner->mOrderedRules->ElementAt(aIndex));            mDocument->StyleRuleAdded(this, rule);            NS_IF_RELEASE(rule);          }        }      }    }    NS_RELEASE(css);  }