NS_IF_ADDREF(*aCSSLoader = document->GetCSSLoader()); NS_ASSERTION(*aCSSLoader, "Document with no CSS loader!");
NS_ADDREF(*aCSSLoader = document->CSSLoader());
DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aSheetURI,                                                 nsIURI** aBaseURI,                                                nsICSSLoader** aCSSLoader,                                                nsICSSParser** aCSSParser){  // null out the out params since some of them may not get initialized below  *aSheetURI = nsnull;  *aBaseURI = nsnull;  *aCSSLoader = nsnull;  *aCSSParser = nsnull;  nsresult result;  nsCOMPtr<nsIStyleSheet> sheet;  if (mRule) {    mRule->GetStyleSheet(*getter_AddRefs(sheet));    if (sheet) {      sheet->GetSheetURI(aSheetURI);      sheet->GetBaseURI(aBaseURI);      nsCOMPtr<nsIDocument> document;      sheet->GetOwningDocument(*getter_AddRefs(document));      if (document) {        NS_IF_ADDREF(*aCSSLoader = document->GetCSSLoader());        NS_ASSERTION(*aCSSLoader, "Document with no CSS loader!");      }    }  }  // XXXldb Why bother if |mRule| is null?  if (*aCSSLoader) {    result = (*aCSSLoader)->GetParserFor(nsnull, aCSSParser);  } else {    result = NS_NewCSSParser(aCSSParser);  }  return result;}