nsString* str = new nsString(aBuffer); if (nsnull == str) { return NS_ERROR_OUT_OF_MEMORY; } nsIUnicharInputStream* input = nsnull; nsresult rv = NS_NewStringUnicharInputStream(&input, str); if (NS_OK != rv) { delete str;
nsCOMPtr<nsIUnicharInputStream> input;   nsresult rv = NS_NewStringUnicharInputStream(getter_AddRefs(input), &aBuffer, PR_FALSE); if (NS_FAILED(rv)) {
CSSParserImpl::ParseAndAppendDeclaration(const nsAString&  aBuffer,                                         nsIURI*           aSheetURL,                                         nsIURI*           aBaseURL,                                         nsCSSDeclaration* aDeclaration,                                         PRBool            aParseOnlyOneDecl,                                         PRBool*           aChanged,                                         PRBool            aClearOldDecl){//  NS_ASSERTION(nsnull != aBaseURL, "need base URL");  *aChanged = PR_FALSE;  nsString* str = new nsString(aBuffer);  if (nsnull == str) {    return NS_ERROR_OUT_OF_MEMORY;  }  nsIUnicharInputStream* input = nsnull;  nsresult rv = NS_NewStringUnicharInputStream(&input, str);  if (NS_OK != rv) {    delete str;    return rv;  }  rv = InitScanner(input, aSheetURL, 0, aBaseURL);  NS_RELEASE(input);  if (! NS_SUCCEEDED(rv)) {    return rv;  }  mSection = eCSSSection_General;  nsresult errorCode = NS_OK;  if (aClearOldDecl) {    mData.AssertInitialState();    aDeclaration->ClearData();    // We could check if it was already empty, but...    *aChanged = PR_TRUE;  } else {    aDeclaration->ExpandTo(&mData);  }  do {    if (!ParseDeclaration(errorCode, aDeclaration, PR_FALSE, aChanged)) {      NS_ASSERTION(errorCode != nsresult(-1), "-1 is no longer used for EOF");      rv = errorCode;      if (NS_FAILED(errorCode))        break;      if (!SkipDeclaration(errorCode, PR_FALSE)) {        NS_ASSERTION(errorCode != nsresult(-1), "-1 is no longer used for EOF");        rv = errorCode;        break;      }    }  } while (!aParseOnlyOneDecl);  aDeclaration->CompressFrom(&mData);  ReleaseScanner();  return rv;}