NS_RELEASE(in);    nsICSSParser* parser; aErrorCode = NS_NewCSSParser(&parser); if (NS_SUCCEEDED(aErrorCode)) { nsICSSStyleSheet* childSheet = nsnull; aErrorCode = parser->Parse(uin, url, childSheet); NS_RELEASE(parser); if (NS_SUCCEEDED(aErrorCode) && (nsnull != childSheet)) { if (0 < aMedia.Length()) { EnumerateString(aMedia, MediumEnumFunc, childSheet); } mSheet->AppendStyleSheet(childSheet); result = PR_TRUE; } NS_IF_RELEASE(childSheet); } NS_RELEASE(uin); }
if (PR_FALSE == mSheet->ContainsStyleSheet(url)) { mChildLoader->LoadChildSheet(mSheet, url, aMedia, mChildSheetCount++);
PRBool CSSParserImpl::ProcessImport(PRInt32& aErrorCode, const nsString& aURLSpec, const nsString& aMedia){  PRBool result = PR_FALSE;  // XXX probably need a way to encode unicode junk for the part of  // the url that follows a "?"  char* cp = aURLSpec.ToNewCString();  nsIURL* url;  aErrorCode = NS_NewURL(&url, cp, mURL);  delete [] cp;  if (NS_FAILED(aErrorCode)) {    // import url is bad    // XXX log this somewhere for easier web page debugging    return PR_FALSE;  }  if (PR_FALSE == mSheet->ContainsStyleSheet(url)) { // don't allow circular references    nsIInputStream* in;    nsresult rv = NS_OpenURL(url, &in);    if (rv != NS_OK) {      // failure to make connection      // XXX log this somewhere for easier web page debugging    }    else {      nsIUnicharInputStream* uin;      aErrorCode = NS_NewConverterStream(&uin, nsnull, in);      if (NS_FAILED(aErrorCode)) {        // XXX no iso-latin-1 converter? out of memory?        NS_RELEASE(in);      }      else {        NS_RELEASE(in);        // Create a new parse to parse the import.         nsICSSParser* parser;        aErrorCode = NS_NewCSSParser(&parser);        if (NS_SUCCEEDED(aErrorCode)) {          nsICSSStyleSheet* childSheet = nsnull;          aErrorCode = parser->Parse(uin, url, childSheet);          NS_RELEASE(parser);          if (NS_SUCCEEDED(aErrorCode) && (nsnull != childSheet)) {            if (0 < aMedia.Length()) {              EnumerateString(aMedia, MediumEnumFunc, childSheet);            }            mSheet->AppendStyleSheet(childSheet);            result = PR_TRUE;          }          NS_IF_RELEASE(childSheet);        }        NS_RELEASE(uin);      }    }  }  NS_RELEASE(url);    return result;}