nsresult result = NS_ERROR_NULL_POINTER; if (aURL) {  nsIInputStream* in; nsIURL* urlClone = CloneURL(aURL); if (urlClone) { result = NS_OpenURL(urlClone, &in); NS_RELEASE(urlClone); if (NS_SUCCEEDED(result)) {  nsIUnicharInputStream* uin; result = NS_NewConverterStream(&uin, nsnull, in); if (NS_SUCCEEDED(result)) { SheetLoadData* data = new SheetLoadData(this, aURL, aCallback, aData); URLKey  key(aURL); mLoadingSheets.Put(&key, data); result = ParseSheet(uin, data, aCompleted, aSheet); NS_RELEASE(uin); } NS_RELEASE(in); } else {  const char *url; if (nsnull != aURL) aURL->GetSpec(&url); else url = ""; cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url << "' failed.  Error code: " << NS_ERROR_GET_CODE(result)  << "\n"; } } } return result;
LOG(("CSSLoaderImpl::LoadAgentSheet synchronous")); return InternalLoadAgentSheet(aURL, aSheet, nsnull);
CSSLoaderImpl::LoadAgentSheet(nsIURL* aURL,                               nsICSSStyleSheet*& aSheet,                              PRBool& aCompleted,                              nsCSSLoaderCallbackFunc aCallback,                              void *aData){  nsresult result = NS_ERROR_NULL_POINTER;  if (aURL) {    // Get an input stream from the url    nsIInputStream* in;    nsIURL* urlClone = CloneURL(aURL);  // dont give key URL to netlib, it gets munged    if (urlClone) {      result = NS_OpenURL(urlClone, &in);      NS_RELEASE(urlClone);      if (NS_SUCCEEDED(result)) {        // Translate the input using the argument character set id into unicode        nsIUnicharInputStream* uin;        result = NS_NewConverterStream(&uin, nsnull, in);        if (NS_SUCCEEDED(result)) {          SheetLoadData* data = new SheetLoadData(this, aURL, aCallback, aData);          URLKey  key(aURL);          mLoadingSheets.Put(&key, data);          result = ParseSheet(uin, data, aCompleted, aSheet);          NS_RELEASE(uin);        }        NS_RELEASE(in);      }      else {        // Dump an error message to the console        const char *url;        if (nsnull != aURL)           aURL->GetSpec(&url);        else          url = "";              cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url           << "' failed.  Error code: " << NS_ERROR_GET_CODE(result)  << "\n";      }    }  }  return result;}