mLoader->DidLoadStyle(aLoader, strUnicodeBuffer, this, aStatus);   strUnicodeBuffer = nsnull;
SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,                                nsISupports* context,                                nsresult aStatus,                                PRUint32 stringLen,                                const char* string){  nsresult result = NS_OK;  if (string && stringLen>0) {    nsString *strUnicodeBuffer = nsnull;    // First determine the charset (if one is indicated) and set the data member    // XXX use the HTTP header data too    nsString strStyleDataUndecoded;    nsString strHTTPHeaderData;    strStyleDataUndecoded.AssignWithConversion(string,stringLen);    result = mLoader->SetCharset(strHTTPHeaderData, strStyleDataUndecoded);    if (NS_SUCCEEDED(result)) {      // now get the decoder      NS_WITH_SERVICE(nsICharsetConverterManager,ccm,kCharsetConverterManagerCID,&result);      if (NS_SUCCEEDED(result) && ccm) {        nsString charset;        mLoader->GetCharset(charset);        nsIUnicodeDecoder *decoder = nsnull;        ccm->GetUnicodeDecoder(&charset,&decoder);        if (decoder) {          PRInt32 unicodeLength=0;          if (NS_SUCCEEDED(decoder->GetMaxLength(string,stringLen,&unicodeLength))) {            PRUnichar *unicodeString = nsnull;            strUnicodeBuffer = new nsString;            if (nsnull == strUnicodeBuffer) {              result = NS_ERROR_OUT_OF_MEMORY;            } else {              // make space for the decoding              strUnicodeBuffer->SetCapacity(unicodeLength);              unicodeString = (PRUnichar *) strUnicodeBuffer->GetUnicode();              result = decoder->Convert(string, (PRInt32 *) &stringLen, unicodeString, &unicodeLength);              if (NS_SUCCEEDED(result)) {                strUnicodeBuffer->SetLength(unicodeLength);              } else {                strUnicodeBuffer->SetLength(0);              }            }          }          NS_RELEASE(decoder);        }      }    }    mLoader->DidLoadStyle(aLoader, strUnicodeBuffer, this, aStatus);    // NOTE: passed ownership of strUnicodeBuffer to mLoader in the call,     //       so nulling it out for clarity / safety    strUnicodeBuffer = nsnull;  }  // We added a reference when the loader was created. This  // release should destroy it.  NS_RELEASE(aLoader);  return result;}